tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

cov-test-determinism.sh (1214B)


      1 #!/bin/sh
      2 
      3 # To use this script, build Tor with coverage enabled, and then say:
      4 #  ./scripts/test/cov-test-determinism.sh run
      5 #
      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-*/.
      8 #
      9 # Then say:
     10 #  ./scripts/test/cov-test-determinism.sh check
     11 #
     12 # It will diff the other coverage outputs to the first one, and put their
     13 # diffs in coverage-raw/diff-coverage-*.
     14 
     15 run=0
     16 check=0
     17 
     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
     25 fi
     26 
     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
     38 fi
     39 
     40 if test "$check" = 1; then
     41    cd coverage-raw || exit 1
     42 
     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
     51 fi