summaryrefslogtreecommitdiff
path: root/scripts/test
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/test')
-rwxr-xr-xscripts/test/cov-diff3
-rwxr-xr-xscripts/test/cov-test-determinism.sh48
-rwxr-xr-xscripts/test/coverage4
3 files changed, 51 insertions, 4 deletions
diff --git a/scripts/test/cov-diff b/scripts/test/cov-diff
index f3ca856888..8751800966 100755
--- a/scripts/test/cov-diff
+++ b/scripts/test/cov-diff
@@ -16,6 +16,5 @@ for B in "$DIRB"/*; do
fi
perl -pe 's/^\s*\!*\d+(\*?):/ 1$1:/; s/^([^:]+:)[\d\s]+:/$1/; s/^ *-:(Runs|Programs):.*//;' "$B" > "$B.tmp"
diff -u "$A.tmp" "$B.tmp" |perl -pe 's/^((?:\+\+\+|---)(?:.*tmp))\s+.*/$1/;'
- rm "$A.tmp" "$B.tmp"
+ rm -f "$A.tmp" "$B.tmp"
done
-
diff --git a/scripts/test/cov-test-determinism.sh b/scripts/test/cov-test-determinism.sh
new file mode 100755
index 0000000000..3b4f372e04
--- /dev/null
+++ b/scripts/test/cov-test-determinism.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+# To use this script, build Tor with coverage enabled, and then say:
+# ./scripts/test/cov-test-determinism.sh run
+#
+# Let it run for a long time so it can run the tests over and over. It
+# will put their coverage outputs in coverage-raw/coverage-*/.
+#
+# Then say:
+# ./scripts/test/cov-test-determinism.sh check
+#
+# It will diff the other coverage outputs to the first one, and put their
+# diffs in coverage-raw/diff-coverage-*.
+
+run=0
+check=0
+
+if test "$1" = run; then
+ run=1
+elif test "$1" = check; then
+ check=1
+else
+ echo "First use 'run' with this script, then use 'check'."
+ exit 1
+fi
+
+if test "$run" = 1; then
+ while true; do
+ make reset-gcov
+ CD=coverage-raw/coverage-$(date +%s)
+ make -j5 check
+ mkdir -p "$CD"
+ ./scripts/test/coverage "$CD"
+ done
+fi
+
+if test "$check" = 1; then
+ cd coverage-raw || exit 1
+
+ FIRST="$(find . -name "coverage-*" -type d | head -1)"
+ rm -f A
+ ln -sf "$FIRST" A
+ for dir in coverage-*; do
+ rm -f B
+ ln -sf "$dir" B
+ ../scripts/test/cov-diff A B > "diff-$dir"
+ done
+fi
diff --git a/scripts/test/coverage b/scripts/test/coverage
index 7a417cdc89..f61c83bc72 100755
--- a/scripts/test/coverage
+++ b/scripts/test/coverage
@@ -13,8 +13,8 @@ for fn in src/core/*/*.c src/feature/*/*.c src/app/*/*.c src/lib/*/*.c; do
F=$(echo "$BN" | sed -e 's/\.c$//;')
GC="${BN}.gcov"
# Figure out the object file names
- ONS=$(echo "${DN}"/src_*-"${F}".o)
- ONS_WILDCARD_LITERAL="${DN}/src_*-${F}.o"
+ ONS=$(echo "${DN}"/*testing_a-"${F}".o)
+ ONS_WILDCARD_LITERAL="${DN}/*testing_a-${F}.o"
# If the wildcard didn't expand, no files
if [ "$ONS" != "${ONS_WILDCARD_LITERAL}" ]
then