Created
September 4, 2020 09:13
-
-
Save richvdh/edf5454b880e8959872a57a982e3b4ff to your computer and use it in GitHub Desktop.
Run sytest in a loop for git bisect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set +x | |
function run_test { | |
run=$1 | |
for i in `seq 1 10`; do | |
docker run --rm --name=sytest$run -e POSTGRES=true -e WORKERS=true \ | |
-e xOFFLINE=1 \ | |
-v `pwd`:/src:ro \ | |
-v /tmp/sytest$run:/logs \ | |
-v `pwd`/../sytest:/sytest:ro \ | |
matrixdotorg/sytest-synapse:py37 \ | |
tests/31sync/09archived0.pl -s --torture-replication=200 || return 1 | |
done | |
} | |
function cleanup { | |
echo "killing test processes..." | |
kill $test1_pid $test2_pid | |
echo "stopping test containers..." | |
docker stop sytest1 sytest2 | |
echo "done" | |
} | |
trap cleanup EXIT | |
( | |
run_test 1 || { | |
echo "test1 failed" | |
kill $test2_pid; | |
exit 1; | |
} | |
) & | |
test1_pid=$! | |
sleep 5 | |
( | |
run_test 2 || { | |
echo "test2 failed" | |
kill $test1_pid; | |
exit 1; | |
} | |
) & | |
test2_pid=$! | |
wait $test1_pid | |
wait $test2_pid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment