2 # Copyright 2021-2022 Ian Jackson and contributors to Hippotat
3 # SPDX-License-Identifier: GPL-3.0-or-later WITH LicenseRef-Hippotat-OpenSSL-Exception
4 # There is NO WARRANTY.
10 test="${ssrc%/*}/test"
12 fail () { echo >&2 "$0: fail: $*"; exit 1; }
17 t-*) tname="${0##*/t-}" ;;
18 *) fail "bad test script name $0" ;;
25 $test/netns-setup "$tname"
30 if [ $rc = 0 ]; then echo "OK $tname"; fi
35 for p in $pids; do kill -9 $p; done
43 local client_server=$1; shift
44 $exec ip netns exec hippotat-t-$tname-$client_server "$@"
49 target/debug/hippotat --config $test/test.cfg -DD "$@"
53 target/debug/hippotatd --config $test/test.cfg -DD "$@"
56 { exec=exec; "$@"; } &
62 local addr="$1"; shift
64 while sleep $(( $t / 10 )).$(( $t % 10 )); do
65 if in-ns $sc ip -o addr show | fgrep " inet $addr "; then
69 if [ $t -gt 10 ]; then fail "$sc did not come up $addr"; fi
75 in-ns-await-up server 192.0.2.1
79 in-ns-await-up client 192.0.2.3