[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 01/03: tests: Check 'system*' behavior for commands that are
From: |
Ludovic Courtès |
Subject: |
[shepherd] 01/03: tests: Check 'system*' behavior for commands that are not found. |
Date: |
Thu, 2 Mar 2023 17:00:19 -0500 (EST) |
civodul pushed a commit to branch master
in repository shepherd.
commit 8888bbd9aab3cd53720758aec06a5de1b976a045
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Thu Mar 2 22:36:02 2023 +0100
tests: Check 'system*' behavior for commands that are not found.
* tests/system-star.sh: Add test with 'test-command-not-found'.
---
tests/system-star.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tests/system-star.sh b/tests/system-star.sh
index 3e56498..893705d 100755
--- a/tests/system-star.sh
+++ b/tests/system-star.sh
@@ -44,6 +44,12 @@ cat > "$conf" <<EOF
(system* "$SHELL" "-c" "echo STOPPING")
(delete-file "$stamp"))
#:respawn? #f)
+ (make <service>
+ #:provides '(test-command-not-found)
+ #:start (lambda _
+ (zero? (system* "this command does not exist")))
+ #:stop (const #f)
+ #:respawn? #f)
(make <service>
#:provides '(test-with-respawn)
#:start (make-forkexec-constructor
@@ -95,6 +101,11 @@ $herd stop test
! test -f "$stamp"
grep "STOPPING" "$log"
+# This service uses 'system*' but the command is not found.
+! $herd start test-command-not-found
+$herd status test-command-not-found
+$herd status test-command-not-found | grep "stopped"
+
# What about a service with a custom 'stop' procedure that uses 'system*'?
# Stopping the service should not trigger the respawn machinery.
$herd start test-with-respawn