aboutsummaryrefslogtreecommitdiffstats
path: root/test/environment/deterministic-exit-code.exp
diff options
context:
space:
mode:
authorLibravatar Austin Morton <austinpmorton@gmail.com>2019-05-20 20:50:48 -0400
committerLibravatar Austin Morton <austinpmorton@gmail.com>2019-05-20 20:59:49 -0400
commitd380de39f039cf23a992b08c506cc200a7cf6292 (patch)
tree681aa830ee7c657a7bfe2e0c8de92d91e38d19bf /test/environment/deterministic-exit-code.exp
parentCreate a profile for mp3splt-gtk (diff)
downloadfirejail-d380de39f039cf23a992b08c506cc200a7cf6292.tar.gz
firejail-d380de39f039cf23a992b08c506cc200a7cf6292.tar.zst
firejail-d380de39f039cf23a992b08c506cc200a7cf6292.zip
Add deterministic-exit-code option to ensure firejail exits with the first childs exit code regardless of the termination ordering of orphaned children
Diffstat (limited to 'test/environment/deterministic-exit-code.exp')
-rwxr-xr-xtest/environment/deterministic-exit-code.exp55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/environment/deterministic-exit-code.exp b/test/environment/deterministic-exit-code.exp
new file mode 100755
index 000000000..165b9ebe0
--- /dev/null
+++ b/test/environment/deterministic-exit-code.exp
@@ -0,0 +1,55 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2019 Firejail Authors
4# License GPL v2
5
6set timeout 4
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15sleep 1
16
17send -- "({ nohup bash -c \"sleep 0.2; exit 53\" &> /dev/null & } &)\r"
18send -- "exit 35\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 "Parent is shutting down"
22}
23after 300
24
25send -- "echo $?\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "53"
29}
30after 100
31
32send -- "firejail --deterministic-exit-code\r"
33expect {
34 timeout {puts "TESTING ERROR 3\n";exit}
35 "Child process initialized"
36}
37sleep 1
38
39send -- "({ nohup bash -c \"sleep 0.2; exit 53\" &> /dev/null & } &)\r"
40send -- "exit 35\r"
41expect {
42 timeout {puts "TESTING ERROR 4\n";exit}
43 "Parent is shutting down"
44}
45after 300
46
47send -- "echo $?\r"
48expect {
49 timeout {puts "TESTING ERROR 5\n";exit}
50 "35"
51}
52after 100
53
54
55puts "\nall done\n"