From: Davin McCall Date: Thu, 26 Dec 2019 05:03:29 +0000 (+0000) Subject: Add int. test for failing to load service X-Git-Tag: v0.8.1~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8d357dc3880097c2fc18af1dd308ae624cb9e3a8;p=oweals%2Fdinit.git Add int. test for failing to load service --- diff --git a/.gitignore b/.gitignore index 7b8e784..324338b 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ /src/igr-tests/check-cycle/output.txt /src/igr-tests/reload1/sd /src/igr-tests/reload2/sd +/src/igr-tests/no-command-error/dinit-run.log # Generated man pages: /doc/manpages/*.5 diff --git a/src/igr-tests/igr-runner.cc b/src/igr-tests/igr-runner.cc index 130cfed..bc26801 100644 --- a/src/igr-tests/igr-runner.cc +++ b/src/igr-tests/igr-runner.cc @@ -13,7 +13,7 @@ extern char **environ; int main(int argc, char **argv) { const char * const test_dirs[] = { "basic", "environ", "ps-environ", "chain-to", "force-stop", "restart", - "check-basic", "check-cycle", "reload1", "reload2" }; + "check-basic", "check-cycle", "reload1", "reload2", "no-command-error" }; constexpr int num_tests = sizeof(test_dirs) / sizeof(test_dirs[0]); int passed = 0; diff --git a/src/igr-tests/no-command-error/dinit-run.expected b/src/igr-tests/no-command-error/dinit-run.expected new file mode 100644 index 0000000..028a7c8 --- /dev/null +++ b/src/igr-tests/no-command-error/dinit-run.expected @@ -0,0 +1 @@ +dinit: no-command: Service command not specified. diff --git a/src/igr-tests/no-command-error/run-test.sh b/src/igr-tests/no-command-error/run-test.sh new file mode 100755 index 0000000..ca0ec8f --- /dev/null +++ b/src/igr-tests/no-command-error/run-test.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Check that a service without a command configured causes the appropriate error. +# + +rm -f dinit-run.log + +../../dinit -d sd -u -p socket -q \ + no-command -l dinit-run.log + +STATUS=FAIL +if [ -e dinit-run.log ]; then + if [ "$(cat dinit-run.log)" = "$(cat dinit-run.expected)" ]; then + STATUS=PASS + fi +fi + +if [ $STATUS = PASS ]; then exit 0; fi +exit 1 diff --git a/src/igr-tests/no-command-error/sd/no-command b/src/igr-tests/no-command-error/sd/no-command new file mode 100644 index 0000000..72ab343 --- /dev/null +++ b/src/igr-tests/no-command-error/sd/no-command @@ -0,0 +1,2 @@ +type=scripted +# no command= setting!