chiark / gitweb /
autopkgtests: Banners in the test script
[userv.git] / tests / t-config
1 #!/bin/bash
2 set -ex
3
4 . tests/lib
5
6 (
7     cat >/etc/userv/services.d/userv-t-env <<END
8 if ( glob calling-user bin
9    & glob service-user games
10    )
11         execute printenv
12 fi
13 END
14 )
15
16 tmp="${AUTOPKGTEST_ARTIFACTS}"
17 if [ "x$tmp" = x ]; then
18     rm -rf tmp
19     mkdir tmp
20     tmp=tmp
21 fi
22
23 bin_uid=$(id -u bin)
24 bin_gid=$(id -g bin)
25
26 : '---------- test service invocation ----------'
27
28 really -u bin \
29 userv games userv-t-env >"$tmp"/env
30
31 for expect in                                   \
32     'USERV_SERVICE=userv-t-env'                 \
33     'USERV_USER=bin'                            \
34     'USERV_GROUP=bin bin'                       \
35     "USERV_UID=$bin_uid"                        \
36     "USERV_GID=$bin_gid $bin_gid"               \
37 ; do
38     egrep "^$expect\$" "$tmp"/env
39 done
40
41 : '---------- test rejection (wrong calling user) ----------'
42
43 expect_output 255 '' \
44 really -u daemon \
45 userv games userv-t-env
46
47
48 echo ok.