Provide shell script to update the output for a single test, and suggest
using it in CONTRIBUTING.
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.
--- /dev/null
+#!/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