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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
# -*- shell-script -*-
prep_tmp () {
tmp="${AUTOPKGTEST_ARTIFACTS}"
if [ "x$tmp" = x ]; then
rm -rf tmp
mkdir tmp
tmp=tmp
fi
}
expect_output () {
local e_status=$1; shift
local e_stdout=$1; shift
set +e
local g_stdout
g_stdout="$( "$@" )"
local g_status=$?
set -e
test "$g_status" = "$e_status"
test "$g_stdout" = "$e_stdout"
}
prep_cuser () {
cuser=${1-bin}
cuser_uid=$(id -u $cuser)
cuser_gid=$(id -g $cuser)
}
prep_config_t_env () {
local suser="$1"
local cfgdir="$2"
mkdir -p "$cfgdir"/services.d
cat >$cfgdir/services.d/userv-t-env <<END
if ( glob calling-user $cuser
& glob service-user $suser
)
execute printenv
fi
END
}
check_expected_env () {
local got_env="$1"
for expect in \
"USERV_SERVICE=userv-t-env" \
"USERV_USER=$cuser" \
"USERV_GROUP=$cuser $cuser" \
"USERV_UID=$cuser_uid" \
"USERV_GID=$cuser_gid $cuser_gid" \
; do
egrep "^$expect\$" $got_env
done
}
|