diff options
Diffstat (limited to 'debian/tests/state')
-rw-r--r-- | debian/tests/state | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/debian/tests/state b/debian/tests/state new file mode 100644 index 0000000..e78bf4d --- /dev/null +++ b/debian/tests/state @@ -0,0 +1,25 @@ +#!/bin/sh + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" EXIT INT QUIT ABRT PIPE TERM + +touch ${WORKDIR}/foo + +fakeroot -s ${WORKDIR}/state chown nobody ${WORKDIR}/foo + +real=$(stat --format '%u' ${WORKDIR}/foo) +fake=$(fakeroot -i ${WORKDIR}/state stat --format '%U' ${WORKDIR}/foo) + +case "${real}:${fake}" in + (0:*) + echo >&2 "test run under root: failure" + exit 1 + ;; + (*:nobody) + echo "state: OK" + ;; + (*) + echo >&2 "unexpected result (${real}:${fake}): failure" + exit 2 + ;; +esac |