diff options
Diffstat (limited to 'test')
| -rwxr-xr-x | test/run.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/run.sh b/test/run.sh index 1316bae..915c728 100755 --- a/test/run.sh +++ b/test/run.sh @@ -16,5 +16,35 @@ if [ -n "$container" ]; then fi cc -O2 -Wall -o "$tmp/test" "$here/test.c" +cc -O2 -Wall -o "$tmp/daemon" "$here/../bin/run-guix-system-container.c" + +# The daemon's own switches: --log-dir must stay advertised (it is how a host +# with a read-only /var keeps container logs), and anything unknown must +# print the usage rather than start a half-configured daemon. +echo "daemon switches:" +if "$tmp/daemon" --help 2>&1 | grep -q -- "--log-dir"; then + echo " ok --log-dir advertised" +else + echo " FAIL --log-dir missing from --help"; exit 1 +fi +# ... and the chosen directory must actually reach the daemon: it names it at +# startup, which is observable without root. +if "$tmp/daemon" --log-dir /tmp/rgsc-test-logs --port 8994 2>&1 \ + | grep -q "container logs: /tmp/rgsc-test-logs"; then + echo " ok --log-dir reaches the daemon" +else + echo " FAIL --log-dir did not reach the daemon"; exit 1 +fi +if GUIX_CONTAINER_LOG_DIR=/tmp/rgsc-env-logs "$tmp/daemon" --port 8994 2>&1 \ + | grep -q "container logs: /tmp/rgsc-env-logs"; then + echo " ok GUIX_CONTAINER_LOG_DIR reaches the daemon" +else + echo " FAIL GUIX_CONTAINER_LOG_DIR did not reach the daemon"; exit 1 +fi +if "$tmp/daemon" --no-such-option >/dev/null 2>&1; then + echo " FAIL unknown option accepted"; exit 1 +else + echo " ok unknown option refused" +fi "$tmp/test" "$container" "$tmp" |
