summaryrefslogtreecommitdiffstats
path: root/test/environment/deterministic-exit-code.exp
diff options
context:
space:
mode:
authorLibravatar ಚಿರಾಗ್ ನಟರಾಜ್ <chiraag.nataraj@gmail.com>2019-05-21 11:05:21 +0000
committerLibravatar GitHub <noreply@github.com>2019-05-21 11:05:21 +0000
commit5e963fd2a68de8a030e7a70c7310a77836413b58 (patch)
treee089afbf223264a6cfb1880040281462dc92a023 /test/environment/deterministic-exit-code.exp
parentAdd security vulnerability disclosure best practices to README as well (diff)
parentAdd deterministic-exit-code option to ensure firejail exits with the first ch... (diff)
downloadfirejail-5e963fd2a68de8a030e7a70c7310a77836413b58.tar.gz
firejail-5e963fd2a68de8a030e7a70c7310a77836413b58.tar.zst
firejail-5e963fd2a68de8a030e7a70c7310a77836413b58.zip
Merge pull request #2715 from apmorton/features/deterministic-exit-code
Add deterministic-exit-code option
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"