From 7578e86ef8ddb78da44d426b94def77366627e0e Mon Sep 17 00:00:00 2001 From: smitsohu Date: Wed, 9 Feb 2022 18:04:36 +0100 Subject: 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. --- test/root/join.exp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'test/root/join.exp') diff --git a/test/root/join.exp b/test/root/join.exp index 19b4c8f02..291ee9115 100755 --- a/test/root/join.exp +++ b/test/root/join.exp @@ -11,7 +11,7 @@ match_max 100000 send -- "firejail --name=jointesting --cpu=0 --nice=2\r" expect { timeout {puts "TESTING ERROR 0\n";exit} - "Child process initialized" + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } sleep 2 @@ -21,14 +21,18 @@ expect { timeout {puts "TESTING ERROR 1\n";exit} "Switching to pid" } +expect { + timeout {puts "TESTING ERROR 2\n";exit} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" +} sleep 1 send -- "ps aux\r" expect { - timeout {puts "TESTING ERROR 2\n";exit} + timeout {puts "TESTING ERROR 3\n";exit} "/bin/bash" } expect { - timeout {puts "TESTING ERROR 3\n";exit} + timeout {puts "TESTING ERROR 4\n";exit} "/bin/bash" } @@ -36,15 +40,15 @@ send -- "exit\r" sleep 1 send -- "firejail --join-network=jointesting\r" expect { - timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" + timeout {puts "TESTING ERROR 5\n";exit} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } send -- "exit\r" sleep 1 send -- "firejail --join-filesystem=jointesting\r" expect { - timeout {puts "TESTING ERROR 5\n";exit} - "Child process initialized" + timeout {puts "TESTING ERROR 6\n";exit} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } after 100 -- cgit v1.2.3-70-g09d2