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/overlay/firefox-x11-xorg.exp | 2 +- test/overlay/firefox-x11.exp | 2 +- test/overlay/firefox.exp | 4 ++-- test/overlay/fs-named.exp | 4 ++-- test/overlay/fs-tmpfs.exp | 2 +- test/overlay/fs.exp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'test/overlay') diff --git a/test/overlay/firefox-x11-xorg.exp b/test/overlay/firefox-x11-xorg.exp index da8948b86..691e58437 100755 --- a/test/overlay/firefox-x11-xorg.exp +++ b/test/overlay/firefox-x11-xorg.exp @@ -36,7 +36,7 @@ expect { send -- "firejail --overlay --name=blablabla\r" expect { timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } sleep 2 diff --git a/test/overlay/firefox-x11.exp b/test/overlay/firefox-x11.exp index 652385cda..96c6796bb 100755 --- a/test/overlay/firefox-x11.exp +++ b/test/overlay/firefox-x11.exp @@ -36,7 +36,7 @@ expect { send -- "firejail --name=blablabla --overlay\r" expect { timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } sleep 2 diff --git a/test/overlay/firefox.exp b/test/overlay/firefox.exp index d77d85498..eb7276f99 100755 --- a/test/overlay/firefox.exp +++ b/test/overlay/firefox.exp @@ -14,7 +14,7 @@ expect { } expect { timeout {puts "TESTING ERROR 1\n";exit} - "Child process initialized" + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } sleep 10 @@ -47,7 +47,7 @@ expect { send -- "firejail --name=blablabla --overlay\r" expect { timeout {puts "TESTING ERROR 4\n";exit} - "Child process initialized" + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" } sleep 2 diff --git a/test/overlay/fs-named.exp b/test/overlay/fs-named.exp index d2bfd43a3..25762337b 100755 --- a/test/overlay/fs-named.exp +++ b/test/overlay/fs-named.exp @@ -12,7 +12,7 @@ expect { timeout {puts "TESTING ERROR 2\n";exit} "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit} "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit} - "Child process initialized" {puts "found\n"} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" {puts "found\n"} } sleep 1 send -- "stty -echo\r" @@ -52,7 +52,7 @@ expect { timeout {puts "TESTING ERROR 2\n";exit} "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit} "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit} - "Child process initialized" {puts "found\n"} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" {puts "found\n"} } sleep 1 diff --git a/test/overlay/fs-tmpfs.exp b/test/overlay/fs-tmpfs.exp index c3794ffed..442a0fffa 100755 --- a/test/overlay/fs-tmpfs.exp +++ b/test/overlay/fs-tmpfs.exp @@ -21,7 +21,7 @@ expect { timeout {puts "TESTING ERROR 1\n";exit} "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit} "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit} - "Child process initialized" {puts "found\n"} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" {puts "found\n"} } sleep 1 send -- "stty -echo\r" diff --git a/test/overlay/fs.exp b/test/overlay/fs.exp index 85d8c50b1..21de942ec 100755 --- a/test/overlay/fs.exp +++ b/test/overlay/fs.exp @@ -12,7 +12,7 @@ expect { timeout {puts "TESTING ERROR 2\n";exit} "not available for kernels older than 3.18" {puts "\nTESTING: overlayfs not available\n"; exit} "Error: --overlay option is not available on Grsecurity systems" {puts "\nTESTING: overlayfs not available\n"; exit} - "Child process initialized" {puts "found\n"} + -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" {puts "found\n"} } sleep 1 -- cgit v1.2.3-70-g09d2