chiark / gitweb /
wip tests, but they don't work
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Aug 2021 18:51:56 +0000 (19:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 22 Aug 2021 18:51:56 +0000 (19:51 +0100)
UML trouble

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
test/t-basic [new file with mode: 0755]
uml/run-test [new file with mode: 0755]

diff --git a/test/t-basic b/test/t-basic
new file mode 100755 (executable)
index 0000000..3dbc782
--- /dev/null
@@ -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 (executable)
index 0000000..773d637
--- /dev/null
@@ -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