File: t-persist

package info (click to toggle)
userv 1.2.3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 832 kB
  • sloc: ansic: 4,228; lex: 287; sh: 247; makefile: 159
file content (28 lines) | stat: -rwxr-xr-x 480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -ex

. tests/lib

for service_user in games root; do
    coproc userv --override 'execute cat -vet' "$service_user" 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
done

echo ok.