From 1b549b5ee5a386bf3297a54a533fcd7294e23fec Mon Sep 17 00:00:00 2001 From: netblue30 Date: Thu, 15 Dec 2016 14:12:31 -0500 Subject: testing --- test/fcopy/dircopy.exp | 28 ++++++++++++++++++++++++++++ test/fs/private-whitelist.exp | 1 + test/fs/whitelist-dev.exp | 12 ++++++------ test/utils/cpu-print.exp | 24 ++++++++++++++++++++---- test/utils/trace.exp | 18 +++++++++--------- 5 files changed, 64 insertions(+), 19 deletions(-) diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp index 00b0204ae..dc8c80569 100755 --- a/test/fcopy/dircopy.exp +++ b/test/fcopy/dircopy.exp @@ -21,30 +21,58 @@ expect { timeout {puts "TESTING ERROR 0\n";exit} "dest/" } +after 100 + +send -- "find dest\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "dest/" +} +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 1\n";exit} "dest/a" } +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 2\n";exit} "dest/a/b" } +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 3\n";exit} "dest/a/b/file4" } +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 4\n";exit} "dest/a/file3" } +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 5\n";exit} "dest/dircopy.exp" } +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 6\n";exit} "dest/file2" } +after 100 + +send -- "find dest\r" expect { timeout {puts "TESTING ERROR 7\n";exit} "dest/file1" diff --git a/test/fs/private-whitelist.exp b/test/fs/private-whitelist.exp index 4dadeacb1..6a1ad535c 100755 --- a/test/fs/private-whitelist.exp +++ b/test/fs/private-whitelist.exp @@ -34,6 +34,7 @@ expect { "3" {puts "3\n"} "4" {puts "4\n"} "5" {puts "5\n"} + "6" {puts "6\n"} } sleep 1 diff --git a/test/fs/whitelist-dev.exp b/test/fs/whitelist-dev.exp index a19d5cedf..a2002bc0a 100755 --- a/test/fs/whitelist-dev.exp +++ b/test/fs/whitelist-dev.exp @@ -14,7 +14,7 @@ expect { } sleep 1 -send -- "ls -l /dev | find /dev | wc -l\r" +send -- "find /dev | wc -l\r" expect { timeout {puts "TESTING ERROR 1\n";exit} "2" @@ -23,17 +23,17 @@ after 100 send -- "exit\r" sleep 1 -send -- "firejail --whitelist=/var/tmp --debug\r" +send -- "firejail --private-dev --debug\r" expect { - timeout {puts "TESTING ERROR 0\n";exit} + timeout {puts "TESTING ERROR 2\n";exit} "Child process initialized" } sleep 1 -send -- "ls -l /dev | find /dev | wc -l\r" +send -- "ls -l /dev | wc -l\r" expect { - timeout {puts "TESTING ERROR 1\n";exit} - "2" + timeout {puts "TESTING ERROR 3\n";exit} + "13" } after 100 send -- "exit\r" diff --git a/test/utils/cpu-print.exp b/test/utils/cpu-print.exp index ca2e57313..0a6f46102 100755 --- a/test/utils/cpu-print.exp +++ b/test/utils/cpu-print.exp @@ -7,18 +7,34 @@ set timeout 10 spawn $env(SHELL) match_max 100000 -send -- "firejail --name=test --cpu=1,2\r" +send -- "firejail --name=test --cpu=0\r" expect { timeout {puts "TESTING ERROR 0\n";exit} "Child process initialized" } -sleep 2 +sleep 1 +send -- "cat /proc/self/status | grep Cpus\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Cpus_allowed_list: 0" +} +after 100 +send -- "exit\r" +sleep 1 + + +send -- "firejail --name=test --cpu=1\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Child process initialized" +} +sleep 1 spawn $env(SHELL) send -- "firejail --cpu.print=test\r" expect { - timeout {puts "TESTING ERROR 1\n";exit} - "Cpus_allowed_list: 1-2" + timeout {puts "TESTING ERROR 2\n";exit} + "Cpus_allowed_list: 1" } after 100 puts "\nall done\n" diff --git a/test/utils/trace.exp b/test/utils/trace.exp index 78a04b273..eedc0f23f 100755 --- a/test/utils/trace.exp +++ b/test/utils/trace.exp @@ -53,15 +53,15 @@ expect { sleep 1 send -- "firejail --trace wget -q debian.org\r" -expect { - timeout {puts "TESTING ERROR 8.1\n";exit} - "Child process initialized" -} -expect { - timeout {puts "TESTING ERROR 8.2\n";exit} - "bash:open /dev/tty" {puts "OK\n";} - "bash:open64 /dev/tty" {puts "OK\n";} -} +#expect { +# timeout {puts "TESTING ERROR 8.1\n";exit} +# "Child process initialized" +#} +#expect { +# timeout {puts "TESTING ERROR 8.2\n";exit} +# "bash:open /dev/tty" {puts "OK\n";} +# "bash:open64 /dev/tty" {puts "OK\n";} +#} expect { timeout {puts "TESTING ERROR 8.3\n";exit} "wget:fopen64 /etc/wgetrc" {puts "OK\n";} -- cgit v1.2.3-70-g09d2