Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/locks_critical_section.sh')
-rw-r--r--test/locks_critical_section.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/locks_critical_section.sh b/test/locks_critical_section.sh
index 3d0487e5..095a1445 100644
--- a/test/locks_critical_section.sh
+++ b/test/locks_critical_section.sh
@@ -63,3 +63,24 @@ lock_release TEST
assert 1 ${main_sigint} "INT should be delivered on lock_release"
assert 1 ${main_sigterm} "TERM should be delivered on lock_release"
assert 0 ${main_siginfo} "INFO should not be delivered on lock_release"
+
+# Forking with a lock does bad things
+{
+ lock_acquire TEST 0
+ assert 0 "$?" "lock_acquire"
+
+ (
+ trap - INT
+ lock_have TEST
+ assert_not 0 "$?" "child should not have lock TEST"
+ sleep 300
+ ) &
+ bgpid="$!"
+
+ sleep 2
+ kill_and_wait 10 "${bgpid}"
+ assert 143 "$?" "kill bgpid - it should exit on INT rather than wait"
+
+ lock_release TEST
+ assert 0 "$?" "lock_release"
+}