chiark / gitweb /
autopkgtests: wip, an actual very simple test
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Dec 2021 00:00:34 +0000 (00:00 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Dec 2021 01:05:06 +0000 (01:05 +0000)
Passes with
   autopkgtest -- qemu /path/to/buster.image

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/tests/control
tests/lib [new file with mode: 0644]
tests/t-basic

index bb74a1f0a93f8ef70a87b862437bc8d98cc374a1..cc11fad9daa7b36d60a4c3da9122fe7028c712c4 100644 (file)
@@ -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 (file)
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"
+}
index bd2089230e697a4146c7904f6849e647c30e49d5..969bbc470458b124b08832a885f865b833658dbe 100755 (executable)
@@ -1,2 +1,7 @@
 #!/bin/bash
 set -ex
+
+. tests/lib
+
+expect_output 0 'games' \
+userv --override 'execute whoami' games spong