guix-commits
[Top][All Lists]
Advanced

[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
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]