n2n/scripts/test_harness.sh
Hamish Coleman e4e2aba420
Increase code Coverage (#897)
* Make it clear which hash we are testing

* Coverage for all pearson hash variants

* Initial coverage for auth.c

* Add some more auth.c coverage

* Ensure new bins are added to both build systems

* Ensure new source files are fully linted
2021-11-10 06:02:05 +00:00

41 lines
838 B
Bash
Executable File

#!/bin/sh
#
# This expects to find the tests in the tools dir and the expected results
# in the tests dir.
TESTS="
tests-auth
tests-compress
tests-elliptic
tests-hashing
tests-transform
tests-wire
"
TOOLSDIR=tools
TESTDATA=tests
# Allow both dirs be overidden
[ -n "$1" ] && TOOLSDIR="$1"
[ -n "$2" ] && TESTDATA="$2"
# Confirm we have all the tools and data
for i in $TESTS; do
if [ ! -e "$TOOLSDIR/$i" ]; then
echo "Could not find test $TOOLSDIR/$i"
exit 1
fi
if [ ! -e "$TESTDATA/$i.expected" ]; then
echo "Could not find testdata $TESTDATA/$i.expected"
exit 1
fi
done
# Actually run the tests
set -e
for i in $TESTS; do
echo "$TOOLSDIR/$i >$TESTDATA/$i.out"
"$TOOLSDIR/$i" >"$TESTDATA/$i.out"
cmp "$TESTDATA/$i.expected" "$TESTDATA/$i.out"
done