From: Ian Jackson Date: Sun, 26 Dec 2021 00:00:34 +0000 (+0000) Subject: autopkgtests: wip, an actual very simple test X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=c2c43c3f847194ee51ed4e926d530eaaba8f7087;hp=7e907ce4b629a6473cd1ee2581e5f188ef52e2b6;p=userv.git autopkgtests: wip, an actual very simple test Passes with autopkgtest -- qemu /path/to/buster.image Signed-off-by: Ian Jackson --- diff --git a/debian/tests/control b/debian/tests/control index bb74a1f..cc11fad 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,4 +1,4 @@ Tests: t-basic Depends: @, bash Tests-Directory: tests -Restrictions: isolation-container, allow-stderr +Restrictions: isolation-container, allow-stderr, needs-root diff --git a/tests/lib b/tests/lib new file mode 100644 index 0000000..ae2aa50 --- /dev/null +++ b/tests/lib @@ -0,0 +1,12 @@ +# -*- shell-script -*- + +expect_output () { + local e_status=$1; shift + local e_stdout=$1; shift + set +e + local g_stdout="$( "$@" )" + local g_status=$? + set -e + test "$g_status" = "$e_status" + test "$g_stdout" = "$e_stdout" +} diff --git a/tests/t-basic b/tests/t-basic index bd20892..969bbc4 100755 --- a/tests/t-basic +++ b/tests/t-basic @@ -1,2 +1,7 @@ #!/bin/bash set -ex + +. tests/lib + +expect_output 0 'games' \ +userv --override 'execute whoami' games spong