[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 03/04: tests: Test 'make-system-constructor' service started
From: |
Ludovic Courtès |
Subject: |
[shepherd] 03/04: tests: Test 'make-system-constructor' service started from config file. |
Date: |
Wed, 12 Jul 2023 09:40:45 -0400 (EDT) |
civodul pushed a commit to branch master
in repository shepherd.
commit ba5d471e23da9894d8c11903d74483aefa898a75
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Jul 11 15:26:55 2023 +0200
tests: Test 'make-system-constructor' service started from config file.
Prompted by <https://issues.guix.gnu.org/64455>.
* tests/system-star.sh: Add 'test-system-constructor' service and test it.
---
tests/system-star.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tests/system-star.sh b/tests/system-star.sh
index 0320df2..9260109 100755
--- a/tests/system-star.sh
+++ b/tests/system-star.sh
@@ -44,6 +44,10 @@ cat > "$conf" <<EOF
(system* "$SHELL" "-c" "echo STOPPING")
(delete-file "$stamp"))
#:respawn? #f)
+ (service
+ '(test-system-constructor)
+ #:start (make-system-constructor "date; echo SYSTEM-START")
+ #:stop (make-system-destructor "date; echo SYSTEM-STOP"))
(service
'(test-command-not-found)
#:start (lambda _
@@ -61,6 +65,10 @@ cat > "$conf" <<EOF
(delete-file "$stamp")
#f)))
#:respawn? #t)))
+
+;; Start this one upfront. This ensures signal handling and the process
+;; monitor are working as expected early on.
+(start-service (lookup-service 'test-system-constructor))
EOF
rm -f "$pid"
@@ -73,6 +81,13 @@ shepherd_pid="`cat $pid`"
kill -0 $shepherd_pid
+# Did the 'make-system-destructor' start?
+until $herd start test-system-constructor | grep running; do sleep 0.3; done
+grep SYSTEM-START "$log"
+$herd stop test-system-constructor
+$herd status test-system-constructor | grep stopped
+grep SYSTEM-STOP "$log"
+
# 'herd start' will block until the script exits...
$herd start test &