#!/bin/sh
export RUSTFLAGS="-Z sanitizer=thread"
cargo build \
--bin=stress \
--features="race" \
--target x86_64-unknown-linux-gnu
target/x86_64-unknown-linux-gnu/debug/stress &
PID=$!
while [ -e /proc/$PID ]; do
TIDS=`ls /proc/$PID/task`
TID=`echo $TIDS | tr " " "\n" | shuf -n1`
NICE=$((`shuf -i 0-39 -n 1` - 20))
sudo renice -n $NICE -p $TID > /dev/null
sleep 0.01
done