Skip to content

Commit

Permalink
Improve failure detection in the test suite.
Browse files Browse the repository at this point in the history
hg committed Aug 14, 2021
1 parent ac2a172 commit 4203f7c
Showing 3 changed files with 12 additions and 21 deletions.
1 change: 1 addition & 0 deletions .builds/freebsd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
image: freebsd/13.x

packages:
- coreutils
- autotools
- openssl
- lzo2
12 changes: 6 additions & 6 deletions test/compression.test
Original file line number Diff line number Diff line change
@@ -106,13 +106,13 @@ for level in $levels; do
wait_script foo hosts/bar-up
wait_script bar hosts/foo-up

ip netns exec foo \
socat -u TCP4-LISTEN:$recv_port_foo,reuseaddr OPEN:"$tmp_file",creat &

ip netns exec bar \
socat -u OPEN:"$ref_file" TCP4:$ip_foo:$recv_port_foo,retry=30 &
try_limit_time 60 sh <<EOF
set -eu
ip netns exec foo socat -u TCP4-LISTEN:$recv_port_foo,reuseaddr OPEN:"$tmp_file",creat &
ip netns exec bar socat -u OPEN:"$ref_file" TCP4:$ip_foo:$recv_port_foo,retry=30 &
wait
EOF

wait
diff -w "$ref_file" "$tmp_file"

tinc foo stop
20 changes: 5 additions & 15 deletions test/testlib.sh.in
Original file line number Diff line number Diff line change
@@ -185,21 +185,11 @@ expect_code() {
# Runs its arguments with timeout(1) or gtimeout(1) if either are installed.
# Usage: try_limit_time 10 command --with --args
if type timeout >/dev/null; then
if is_busybox; then
# busybox does not support --foreground
try_limit_time() {
time=$1
shift
timeout "$time" "$@"
}
else
# BSD and GNU timeout do not require special handling
try_limit_time() {
time=$1
shift
timeout --foreground "$time" "$@"
}
fi
try_limit_time() {
time=$1
shift
timeout "$time" "$@"
}
else
try_limit_time() {
echo >&2 "timeout was not found, running without time limits!"

0 comments on commit 4203f7c

Please sign in to comment.