From 504b5020785ec98ad5467483f80977c7068a5370 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 22 Aug 2021 19:51:56 +0100 Subject: [PATCH] wip tests, but they don't work UML trouble Signed-off-by: Ian Jackson --- test/t-basic | 24 ++++++++++++++++++++++++ uml/run-test | 15 +++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 test/t-basic create mode 100755 uml/run-test diff --git a/test/t-basic b/test/t-basic new file mode 100755 index 0000000..3dbc782 --- /dev/null +++ b/test/t-basic @@ -0,0 +1,24 @@ +#!/bin/bash +set -ex + +# expects to be run inside the uml + +fail () { echo >&2 "$0: fail: $*"; exit 1; } + +tname="${0#**/t-}" +case "$tname" in +.* | */* | '') fail "bad tname $tname" ;;# +esac + +test="${0%/*}" + +tmp=tmp/$tname +rm -rf "$tmp" +mkdir -p $tmp + +$test/netns-setup "$tname" +$test/run-server "$tname" & spid=$! +$test/run-client "$tname" & cpid=$1 + +$test/netns-run-client "$tname" -- ping -c 10 192.0.2.1 >$tmp/ping +grep ' 0% packet loss' $tmp/ping diff --git a/uml/run-test b/uml/run-test new file mode 100755 index 0000000..773d637 --- /dev/null +++ b/uml/run-test @@ -0,0 +1,15 @@ +#!/bin/sh +set -e +set -x + +uml="${0%/*}"/psusan-uml + +if timeout --foreground 5 $uml-run true; then : +else + $uml-setup 2>&1 |ts >tmp/uml-setup & + sleep 5 + timeout --foreground 5 $uml-run true ||: + timeout --foreground 5 $uml-run true +fi + +echo hi -- 2.30.2