Test infrastructure fixes.

- A new helper script to btest-diff a bunch of files simulatiously.

- Fixes to btest.cfg.

- A few further script updates.
This commit is contained in:
Robin Sommer 2011-09-08 15:17:05 -07:00
parent 07dd8eb952
commit 7a989c476d
6 changed files with 36 additions and 10 deletions

View file

@ -27,7 +27,7 @@ git clone $repo $name
cd $name cd $name
for dir in Traces tests Baseline; do for dir in tests Baseline; do
mkdir $dir mkdir $dir
touch $dir/.gitignore touch $dir/.gitignore
done done

27
testing/external/scripts/diff-all vendored Executable file
View file

@ -0,0 +1,27 @@
#! /usr/bin/env bash
#
# Runs btest-diff on $@ and fails if any fails.
diag=$TEST_DIAGNOSTICS
export TEST_DIAGNOSTICS=$diag.tmp
if [ "$diag" = "" ]; then
diag=/dev/stdout
else
rm -f $diag
fi
rc=0;
for i in $@; do
if ! btest-diff $i; then
echo "" >>$diag
echo "#### btest-diff $i" >>$diag
echo "" >>$diag
cat $diag.tmp >>$diag
rc=1
fi
done
exit $rc

View file

@ -1,2 +1,2 @@
@TEST-EXEC: bro -r $TRACES/test.trace test-all @TEST-EXEC: zcat $TRACES/test.trace.gz | bro -r - test-all-policy
@TEST-EXEC: for i in *.log; do btest-diff $i; done @TEST-EXEC: $SCRIPTS/diff-all *.log

View file

@ -1,7 +1,4 @@
# #
# Format: # Format:
# #
# <url> <md5sum> # <url> [<http-user>[:<http-password>]]
#
# Use scripts/make-md5sum to calculate the md5sum.
#

View file

@ -25,6 +25,8 @@ for proxy in .proxy ../.proxy; do
fi fi
done done
mkdir -p $1
cat $cfg | while read line; do cat $cfg | while read line; do
if echo $line | grep -q '^[ \t]*$'; then if echo $line | grep -q '^[ \t]*$'; then
@ -36,7 +38,7 @@ cat $cfg | while read line; do
fi fi
url=`echo $line | awk '{print $1}'` url=`echo $line | awk '{print $1}'`
auth=`echo $line | awk '{print $3}'` auth=`echo $line | awk '{print $2}'`
file=$1/`echo $url | sed 's#^.*/##g'` file=$1/`echo $url | sed 's#^.*/##g'`
fp=$file.md5sum fp=$file.md5sum
@ -47,7 +49,7 @@ cat $cfg | while read line; do
# Get the fingerprint file. # Get the fingerprint file.
if ! eval "$proxy curl $auth -fsS --anyauth $url.md5sum -o $fp.tmp"; then if ! eval "$proxy curl $auth -fsS --anyauth $url.md5sum -o $fp.tmp"; then
echo "Error: Could not get $url.fingerprint, skipping download." echo "Error: Could not get $url.md5sum, skipping download."
continue continue
fi fi

View file

@ -11,7 +11,7 @@ BRO_SEED_FILE=%(testbase)s/../random.seed
TZ=UTC TZ=UTC
LC_ALL=C LC_ALL=C
PATH=%(testbase)s/../../../build/src:%(testbase)s/../../../aux/btest:%(default_path)s PATH=%(testbase)s/../../../build/src:%(testbase)s/../../../aux/btest:%(default_path)s
TEST_DIFF_CANONIFIER=%(testbase)s/../../btest/Scripts/diff-canonifier-external TEST_DIFF_CANONIFIER=%(testbase)s/../../scripts/diff-canonifier-external
TRACES=%(testbase)s/Traces TRACES=%(testbase)s/Traces
SCRIPTS=%(testbase)s/../scripts SCRIPTS=%(testbase)s/../scripts
DIST=%(testbase)s/../../.. DIST=%(testbase)s/../../..