chiark / gitweb /
autopkgtests: Test persistence after restart
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Dec 2021 00:56:41 +0000 (00:56 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Dec 2021 01:05:06 +0000 (01:05 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/tests/control
tests/t-persist [new file with mode: 0755]

index e779ebabd75d7bf86856c3e577b7bbccf7a13912..0b846be0d4de04463e3d61cf70204d217d791493 100644 (file)
@@ -12,3 +12,8 @@ Tests: t-userconfig
 Depends: @, bash, chiark-really
 Tests-Directory: tests
 Restrictions: isolation-container, allow-stderr, needs-root, breaks-testbed
+
+Tests: t-persist
+Depends: @, bash
+Tests-Directory: tests
+Restrictions: isolation-container, allow-stderr, needs-root
diff --git a/tests/t-persist b/tests/t-persist
new file mode 100755 (executable)
index 0000000..b886f85
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+set -ex
+
+. tests/lib
+
+coproc userv --override 'execute cat -vet' games spong
+
+stdout=${COPROC[0]}
+stdin=${COPROC[1]}
+
+print_expect_reply () {
+    local m=$1
+    local got
+    echo >&$stdin "$m"
+    read <&$stdout got
+    local exp="$(printf '%s$\n' "$m")"
+    test "$got" = "$exp"
+}
+
+print_expect_reply hi
+
+service userv restart
+
+print_expect_reply ho
+
+echo ok.