]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Change update-test.sh to update multiple tests
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 3 May 2018 10:26:30 +0000 (12:26 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 3 May 2018 10:26:30 +0000 (12:26 +0200)
update-test.sh

index 60359d48dd2c7b7edee07ac919fcec62dd0485d4..8c7d0cabecb243a7be930808331def371bea8efe 100755 (executable)
@@ -1,14 +1,18 @@
 #!/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
+
+# Update the tests given as positional parameters
+
+for TEST in "$@"; do
+    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
+done