summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Windl <Ulrich.Windl@RZ.Uni-Regensburg.DE>2017-09-28 09:14:50 +0200
committerUlrich Windl <Ulrich.Windl@RZ.Uni-Regensburg.DE>2017-09-28 09:14:50 +0200
commit09f0179cf9022922aa856d3b2adc483b4dc5c9c2 (patch)
treed80f0d57fb7cc9d84e8504c105818c6d87b6f023
parentd42caa312811012da8b04641de8fbdca8fdc06ea (diff)
downloadtcpdump-09f0179cf9022922aa856d3b2adc483b4dc5c9c2.tar.gz
Provide and suggest update-test.sh in CONTRIBUTING
Provide shell script to update the output for a single test, and suggest using it in CONTRIBUTING.
-rw-r--r--CONTRIBUTING4
-rwxr-xr-xupdate-test.sh14
2 files changed, 17 insertions, 1 deletions
diff --git a/CONTRIBUTING b/CONTRIBUTING
index 0f4a5d85..cc312dff 100644
--- a/CONTRIBUTING
+++ b/CONTRIBUTING
@@ -80,9 +80,11 @@ How to add new code and to update existing code
Each line in this file has the following format:
test-name sample.pcap sample.out tcpdump-options
- the sample.out file can be build by:
+ The sample.out file can be build by:
(cd tests && ../tcpdump -n -t -r sample.pcap tcpdump-options > sample.out)
+ Or, for convenience, use "./update-test.sh test-name"
+
It is often useful to have test outputs with different verbosity levels
(none, -v, -vv, -vvv, etc.) depending on the code.
diff --git a/update-test.sh b/update-test.sh
new file mode 100755
index 00000000..60359d48
--- /dev/null
+++ b/update-test.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+TEST="$1"
+PREFIX=tests
+MATCH=0
+while read name input output options
+do
+ [ _$name = _ ] && continue # ignore empty lines
+ [ _${name#\#} != _$name ] && continue # ignore comment lines
+ [ $name != "$TEST" ] && continue # not the requested test
+ [ _$output = _ ] && continue # ignore incomplete lines
+ MATCH=1
+ ./tcpdump -n -t -r "$PREFIX/$input" $options >"$PREFIX/$output"
+done < $PREFIX/TESTLIST
+[ $MATCH = 0 ] && echo "test $TEST not found" >&2