#!/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
