[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 01/02: tests: Add 'make-system-constructor' test.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 01/02: tests: Add 'make-system-constructor' test. |
Date: |
Sat, 11 Mar 2023 09:56:18 -0500 (EST) |
civodul pushed a commit to branch master
in repository shepherd.
commit a93b15a328bb7f3104fa10d3ab7e803827cf9bef
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Mar 11 15:47:56 2023 +0100
tests: Add 'make-system-constructor' test.
* tests/basic.sh: Define 'spawn-with-system' test and use it.
---
tests/basic.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/basic.sh b/tests/basic.sh
index de0a7d9..32a1279 100644
--- a/tests/basic.sh
+++ b/tests/basic.sh
@@ -61,6 +61,10 @@ cat > "$conf"<<EOF
#t))
(fail "Fail." (const #f)))
#:respawn? #f)
+ (make <service>
+ #:provides '(spawn-with-system)
+ #:start (make-system-constructor "echo starting from $PWD")
+ #:stop (make-system-destructor "echo stopping from $PWD"))
(make <service>
#:provides '(broken)
#:requires '()
@@ -145,6 +149,12 @@ then false; else true; fi
! $herd start broken
$herd status broken | grep "stopped"
+# Check 'make-system-constructor' and 'make-system-destructor'.
+$herd start spawn-with-system
+$herd status spawn-with-system | grep "started"
+$herd stop spawn-with-system
+$herd status spawn-with-system | grep "stopped"
+
# Wrong number of arguments for an action.
if $herd status root foo bar baz;
then false; else true; fi