Bump to 0.4.3.7-dev
[tor.git] / scripts / test / cov-test-determinism.sh
blob3458f96968a371a088b8750c57fa87da9da5b71d
1 #!/bin/sh
3 # To use this script, build Tor with coverage enabled, and then say:
4 # ./scripts/test/cov-test-determinism.sh run
6 # Let it run for a long time so it can run the tests over and over. It
7 # will put their coverage outputs in coverage-raw/coverage-*/.
9 # Then say:
10 # ./scripts/test/cov-test-determinism.sh check
12 # It will diff the other coverage outputs to the first one, and put their
13 # diffs in coverage-raw/diff-coverage-*.
15 run=0
16 check=0
18 if test "$1" = run; then
19 run=1
20 elif test "$1" = check; then
21 check=1
22 else
23 echo "First use 'run' with this script, then use 'check'."
24 exit 1
27 if test "$run" = 1; then
28 # same seed as in travis.yml
29 TOR_TEST_RNG_SEED="636f766572616765"
30 export TOR_TEST_RNG_SEED
31 while true; do
32 make reset-gcov
33 CD=coverage-raw/coverage-$(date +%s)
34 make -j5 check
35 mkdir -p "$CD"
36 ./scripts/test/coverage "$CD"
37 done
40 if test "$check" = 1; then
41 cd coverage-raw || exit 1
43 FIRST="$(find . -name "coverage-*" -type d | head -1)"
44 rm -f A
45 ln -sf "$FIRST" A
46 for dir in coverage-*; do
47 rm -f B
48 ln -sf "$dir" B
49 ../scripts/test/cov-diff A B > "diff-$dir"
50 done