From bea36a608f028f67d4c7f65ef7ea6a55945e0b93 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 26 Dec 2021 00:56:41 +0000 Subject: [PATCH] autopkgtests: Test persistence after restart Signed-off-by: Ian Jackson --- debian/tests/control | 5 +++++ tests/t-persist | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 tests/t-persist diff --git a/debian/tests/control b/debian/tests/control index e779eba..0b846be 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -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 index 0000000..b886f85 --- /dev/null +++ b/tests/t-persist @@ -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. -- 2.30.2