[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[shepherd] 02/06: tests: Deal with ‘setrlimit’ behavior on GNU/Hurd.
From: |
Ludovic Courtès |
Subject: |
[shepherd] 02/06: tests: Deal with ‘setrlimit’ behavior on GNU/Hurd. |
Date: |
Mon, 1 Jan 2024 17:38:52 -0500 (EST) |
civodul pushed a commit to branch main
in repository shepherd.
commit d15e833544f35f76b06e5b457bf2638d7d0cec72
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Dec 31 20:51:18 2023 +0100
tests: Deal with ‘setrlimit’ behavior on GNU/Hurd.
* tests/forking-service.sh, tests/system-star.sh: Conditionalize tests
that rely on ‘setrlimit’.
---
tests/forking-service.sh | 12 ++++++++++--
tests/system-star.sh | 18 ++++++++++++------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/tests/forking-service.sh b/tests/forking-service.sh
index 8e07359..4b8206a 100644
--- a/tests/forking-service.sh
+++ b/tests/forking-service.sh
@@ -140,11 +140,19 @@ test "`cat $PWD/$service2_started`" = "started
started"
-
# test if nofiles was set properly
test -f "$service_nofiles"
nofiles_value="`cat $service_nofiles`"
-test 1567 -eq $nofiles_value
+case $(uname) in
+ GNU)
+ # On GNU/Hurd, rlimits are maintained in libc and are not inherited
+ # across 'fork'.
+ echo "rlimit not inherited: $nofiles_value; skipping" >&2
+ ;;
+ *)
+ test 1567 -eq $nofiles_value
+ ;;
+esac
# Try to trigger potential race conditions, when killing a process, between
# the fork and execv calls.
diff --git a/tests/system-star.sh b/tests/system-star.sh
index 9260109..b0bf66d 100755
--- a/tests/system-star.sh
+++ b/tests/system-star.sh
@@ -135,12 +135,18 @@ do
done
$herd stop test-with-respawn
-# What happens when we cause the process monitor to throw an exception while
-# trying to fork? The process monitor fiber should remain alive.
-$herd eval root "(setrlimit 'nproc 1 1)"
-$herd start test && false
-$herd status test
-$herd status test | grep "stopped"
+if guile -c "(setrlimit 'nproc 1 1) (primitive-fork) #t"
+then
+ # On GNU/Hurd, 'fork' does not honor RLIMIT_NPROC.
+ echo "RLIMIT_NPROC is not honored; skipping" >&2
+else
+ # What happens when we cause the process monitor to throw an exception
while
+ # trying to fork? The process monitor fiber should remain alive.
+ $herd eval root "(setrlimit 'nproc 1 1)"
+ $herd start test && false
+ $herd status test
+ $herd status test | grep "stopped"
+fi
$herd stop root
- [shepherd] branch main updated (07006e4 -> 520094a), Ludovic Courtès, 2024/01/01
- [shepherd] 02/06: tests: Deal with ‘setrlimit’ behavior on GNU/Hurd.,
Ludovic Courtès <=
- [shepherd] 01/06: tests: Check whether /proc/*/fd exists before relying on it., Ludovic Courtès, 2024/01/01
- [shepherd] 06/06: support: Update copyright year in ‘--version’ output., Ludovic Courtès, 2024/01/01
- [shepherd] 04/06: service: No SO_REUSEADDR for AF_UNIX sockets., Ludovic Courtès, 2024/01/01
- [shepherd] 03/06: service: Improve handling of the no-PR_SET_CHILD_SUBREAPER case., Ludovic Courtès, 2024/01/01
- [shepherd] 05/06: service: inetd: Clear O_NONBLOCK on the connection socket., Ludovic Courtès, 2024/01/01