xref: /aosp_15_r20/external/tcpdump/update-test.sh (revision 05b00f6010a2396e3db2409989fc67270046269f)
1#!/bin/sh
2
3# Update the tests given as positional parameters
4
5TZ=GMT0; export TZ
6
7for TEST in "$@"; do
8    PREFIX=tests
9    MATCH=0
10    while read -r name input output options
11    do
12        [ -z "$name" ] && continue        # ignore empty lines
13        [ "${name#\#}" != "$name" ] && continue    # ignore comment lines
14        [ "$name" != "$TEST" ] && continue    # not the requested test
15        [ -z "$output" ] && continue    # ignore incomplete lines
16        MATCH=1
17        # Word splitting is intentional for $options.
18        # shellcheck disable=SC2086
19        ./tcpdump -# -n -r "$PREFIX/$input" $options >"$PREFIX/$output"
20    done < $PREFIX/TESTLIST
21    [ $MATCH = 0 ] && echo "test $TEST not found" >&2
22done
23