aboutsummaryrefslogtreecommitdiffstats
path: root/test/root/cgroup.exp
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2022-02-09 18:04:36 +0100
committerLibravatar smitsohu <smitsohu@gmail.com>2022-02-09 18:30:45 +0100
commit7578e86ef8ddb78da44d426b94def77366627e0e (patch)
treee752d23f1b61a50fb7b7372d6799fe9ef4d111e4 /test/root/cgroup.exp
parentMerge pull request #4915 from kmk3/keepassx-restore-nou2f (diff)
downloadfirejail-7578e86ef8ddb78da44d426b94def77366627e0e.tar.gz
firejail-7578e86ef8ddb78da44d426b94def77366627e0e.tar.zst
firejail-7578e86ef8ddb78da44d426b94def77366627e0e.zip
testing: fix expect matching of numbers
The sandbox timestamp should not be available for matching when output is already expected from the next command (this is only a problem if numeric output if expected from the first command in the sandbox). A possible alternative would be to flush the expect output buffer with 'expect "*"' after the sandbox is up.
Diffstat (limited to 'test/root/cgroup.exp')
-rwxr-xr-xtest/root/cgroup.exp12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/root/cgroup.exp b/test/root/cgroup.exp
index f64edf4b9..9a1bbe161 100755
--- a/test/root/cgroup.exp
+++ b/test/root/cgroup.exp
@@ -20,7 +20,7 @@ expect {
20send -- "firejail --name=\"join testing\" --cgroup=/sys/fs/cgroup/systemd/firejail/tasks\r" 20send -- "firejail --name=\"join testing\" --cgroup=/sys/fs/cgroup/systemd/firejail/tasks\r"
21expect { 21expect {
22 timeout {puts "TESTING ERROR 1\n";exit} 22 timeout {puts "TESTING ERROR 1\n";exit}
23 "Child process initialized" 23 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
24} 24}
25sleep 2 25sleep 2
26 26
@@ -37,14 +37,18 @@ expect {
37 timeout {puts "TESTING ERROR 3\n";exit} 37 timeout {puts "TESTING ERROR 3\n";exit}
38 "Switching to pid" 38 "Switching to pid"
39} 39}
40expect {
41 timeout {puts "TESTING ERROR 4\n";exit}
42 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
43}
40sleep 1 44sleep 1
41send -- "ps aux\r" 45send -- "ps aux\r"
42expect { 46expect {
43 timeout {puts "TESTING ERROR 4\n";exit} 47 timeout {puts "TESTING ERROR 5\n";exit}
44 "/bin/bash" 48 "/bin/bash"
45} 49}
46expect { 50expect {
47 timeout {puts "TESTING ERROR 5\n";exit} 51 timeout {puts "TESTING ERROR 6\n";exit}
48 "/bin/bash" 52 "/bin/bash"
49} 53}
50 54
@@ -53,7 +57,7 @@ after 100
53spawn $env(SHELL) 57spawn $env(SHELL)
54send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" 58send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r"
55expect { 59expect {
56 timeout {puts "TESTING ERROR 6\n";exit} 60 timeout {puts "TESTING ERROR 7\n";exit}
57 "3" 61 "3"
58} 62}
59after 100 63after 100