diff options
author | smitsohu <smitsohu@gmail.com> | 2022-02-09 18:04:36 +0100 |
---|---|---|
committer | smitsohu <smitsohu@gmail.com> | 2022-02-09 18:30:45 +0100 |
commit | 7578e86ef8ddb78da44d426b94def77366627e0e (patch) | |
tree | e752d23f1b61a50fb7b7372d6799fe9ef4d111e4 /test/root/cgroup.exp | |
parent | Merge pull request #4915 from kmk3/keepassx-restore-nou2f (diff) | |
download | firejail-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-x | test/root/cgroup.exp | 12 |
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 { | |||
20 | send -- "firejail --name=\"join testing\" --cgroup=/sys/fs/cgroup/systemd/firejail/tasks\r" | 20 | send -- "firejail --name=\"join testing\" --cgroup=/sys/fs/cgroup/systemd/firejail/tasks\r" |
21 | expect { | 21 | expect { |
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 | } |
25 | sleep 2 | 25 | sleep 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 | } |
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 4\n";exit} | ||
42 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
43 | } | ||
40 | sleep 1 | 44 | sleep 1 |
41 | send -- "ps aux\r" | 45 | send -- "ps aux\r" |
42 | expect { | 46 | expect { |
43 | timeout {puts "TESTING ERROR 4\n";exit} | 47 | timeout {puts "TESTING ERROR 5\n";exit} |
44 | "/bin/bash" | 48 | "/bin/bash" |
45 | } | 49 | } |
46 | expect { | 50 | expect { |
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 | |||
53 | spawn $env(SHELL) | 57 | spawn $env(SHELL) |
54 | send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" | 58 | send -- "wc -l /sys/fs/cgroup/systemd/firejail/tasks\r" |
55 | expect { | 59 | expect { |
56 | timeout {puts "TESTING ERROR 6\n";exit} | 60 | timeout {puts "TESTING ERROR 7\n";exit} |
57 | "3" | 61 | "3" |
58 | } | 62 | } |
59 | after 100 | 63 | after 100 |