chiark / gitweb /
autopkgtests: Test persistence after restart
[userv.git] / tests / t-persist
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.