mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Cleaning up some testing stuff.
- The Makefiles now run btest with "-f diag.log" so that diangnostics output will always be written into that file. - Makefiles now hardcode path to btest to avoid picking up the wrong version if in PATH. - The canonifier scripts now live in testing/scripts, and they are used from both btest/ and external/. - There's a new diff-remove-uids scripts that removed connection UIDs for diffing. The external/* tests now use that by default. - Timestamp removal now has its own script: diff-remove-timestamps. diff-canonifier calls that. - All Makefile have a "brief" target that runs btest with -b. - The higher-level directories have Makefile to call the subdirs.
This commit is contained in:
parent
1fded82c32
commit
c738701ffd
20 changed files with 75 additions and 21 deletions
8
testing/Makefile
Normal file
8
testing/Makefile
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
DIRS=btest external
|
||||
|
||||
all:
|
||||
@for repo in $(DIRS); do (cd $$repo && make ); done
|
||||
|
||||
brief:
|
||||
@for repo in $(DIRS); do (cd $$repo && make brief ); done
|
|
@ -11,3 +11,5 @@ operation:
|
|||
size, these are not included directly. See the README for more
|
||||
information.
|
||||
|
||||
scripts/
|
||||
Helpers scripts used by some tests.
|
||||
|
|
1
testing/btest/.gitignore
vendored
1
testing/btest/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
.tmp
|
||||
diag.log
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
DIAG=diag.log
|
||||
BTEST=../../aux/btest/btest
|
||||
|
||||
all:
|
||||
# Showing all tests.
|
||||
@btest
|
||||
@rm -f $(DIAG)
|
||||
@$(BTEST) -f $(DIAG)
|
||||
|
||||
brief:
|
||||
# Brief output showing only failed tests.
|
||||
@btest -b
|
||||
|
||||
brief-debug:
|
||||
# Verbose output for failed tests, also recorded in test.log.
|
||||
@rm -f test.log
|
||||
@btest -b -d -f test.log
|
||||
@echo Output in test.log
|
||||
@rm -f $(DIAG)
|
||||
@$(BTEST) -b -f $(DIAG)
|
||||
|
|
|
@ -13,6 +13,6 @@ LC_ALL=C
|
|||
PATH=%(testbase)s/../../build/src:%(testbase)s/../../aux/btest:%(default_path)s
|
||||
TEST_DIFF_CANONIFIER=%(testbase)s/Scripts/diff-canonifier
|
||||
TRACES=%(testbase)s/Traces
|
||||
SCRIPTS=%(testbase)s/Scripts
|
||||
SCRIPTS=%(testbase)s/../scripts
|
||||
DIST=%(testbase)s/../..
|
||||
BUILD=%(testbase)s/../../build
|
||||
|
|
1
testing/external/.gitignore
vendored
1
testing/external/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
*.git
|
||||
diag.log
|
||||
|
|
9
testing/external/Makefile
vendored
9
testing/external/Makefile
vendored
|
@ -1,8 +1,15 @@
|
|||
|
||||
PUBLIC_REPO=git://git.bro-ids.org/bro-testing
|
||||
|
||||
DIAG=diag.log
|
||||
|
||||
all:
|
||||
@for repo in *.git; do (echo "==== $$repo" && cd $$repo && btest ); echo; done
|
||||
@rm -f $(DIAG)
|
||||
@for repo in *.git; do (cd $$repo && make ); done
|
||||
|
||||
brief:
|
||||
@rm -f $(DIAG)
|
||||
@for repo in *.git; do (cd $$repo && make brief ); done
|
||||
|
||||
init:
|
||||
git clone $(PUBLIC_REPO) bro-testing.git
|
||||
|
|
5
testing/external/scripts/create-new-repo
vendored
5
testing/external/scripts/create-new-repo
vendored
|
@ -34,8 +34,9 @@ done
|
|||
|
||||
ln -s ../subdir-btest.cfg ./btest.cfg
|
||||
|
||||
cp $cwd/`dirname $0`/files/test.skeleton tests
|
||||
cp $cwd/`dirname $0`/files/Makefile .
|
||||
cp $cwd/`dirname $0`/skel/test.skeleton tests
|
||||
cp $cwd/`dirname $0`/skel/Makefile .
|
||||
cp $cwd/`dirname $0`/skel/.gitignore .
|
||||
|
||||
git add *
|
||||
|
||||
|
|
5
testing/external/scripts/diff-canonifier
vendored
5
testing/external/scripts/diff-canonifier
vendored
|
@ -1,5 +0,0 @@
|
|||
#! /usr/bin/env bash
|
||||
#
|
||||
# Replace anything which looks like timestamps with XXXs.
|
||||
|
||||
sed 's/[0-9]\{10\}\.[0-9]\{2,8\}/XXXXXXXXXX.XXXXXX/g'
|
3
testing/external/scripts/files/Makefile
vendored
3
testing/external/scripts/files/Makefile
vendored
|
@ -1,3 +0,0 @@
|
|||
|
||||
all:
|
||||
@btest
|
1
testing/external/scripts/skel/.gitignore
vendored
Normal file
1
testing/external/scripts/skel/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
diag.log
|
11
testing/external/scripts/skel/Makefile
vendored
Normal file
11
testing/external/scripts/skel/Makefile
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
DIAG=diag.log
|
||||
BTEST=../../../aux/btest/btest
|
||||
|
||||
all:
|
||||
@rm -f $(DIAG)
|
||||
@$(BTEST) -f $(DIAG)
|
||||
|
||||
brief:
|
||||
@rm -f $(DIAG)
|
||||
@$(BTEST) -b -f $(DIAG)
|
2
testing/external/subdir-btest.cfg
vendored
2
testing/external/subdir-btest.cfg
vendored
|
@ -11,7 +11,7 @@ BRO_SEED_FILE=%(testbase)s/../random.seed
|
|||
TZ=UTC
|
||||
LC_ALL=C
|
||||
PATH=%(testbase)s/../../../build/src:%(testbase)s/../../../aux/btest:%(default_path)s
|
||||
TEST_DIFF_CANONIFIER=%(testbase)s/../scripts/diff-canonifier
|
||||
TEST_DIFF_CANONIFIER=%(testbase)s/../../btest/Scripts/diff-canonifier-external
|
||||
TRACES=%(testbase)s/Traces
|
||||
SCRIPTS=%(testbase)s/../scripts
|
||||
DIST=%(testbase)s/../../..
|
||||
|
|
5
testing/scripts/diff-canonifier
Executable file
5
testing/scripts/diff-canonifier
Executable file
|
@ -0,0 +1,5 @@
|
|||
#! /usr/bin/env bash
|
||||
#
|
||||
# Default canonifier used with the tests in testing/btest/*.
|
||||
|
||||
`dirname $0`/diff-remove-timestamps
|
5
testing/scripts/diff-canonifier-external
Executable file
5
testing/scripts/diff-canonifier-external
Executable file
|
@ -0,0 +1,5 @@
|
|||
#! /usr/bin/env bash
|
||||
#
|
||||
# Default canonifier used with the trace-based tests in testing/external/*.
|
||||
|
||||
`dirname $0`/diff-remove-timestamps | `dirname $0`/diff-remove-uids
|
21
testing/scripts/diff-remove-uids
Executable file
21
testing/scripts/diff-remove-uids
Executable file
|
@ -0,0 +1,21 @@
|
|||
#! /usr/bin/awk -f
|
||||
#
|
||||
# A diff canonifier that removes all connection UIDs.
|
||||
|
||||
BEGIN { IFS="\t"; OFS="\t"; }
|
||||
|
||||
column > 0 {
|
||||
$column = "XXXXXXXXXXX";
|
||||
}
|
||||
|
||||
/^#/ {
|
||||
for ( i = 0; i < NF; ++i ) {
|
||||
if ( $i == "uid" )
|
||||
column = i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
{ print }
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue