From 820de6829fedccffb8b3c32f079436fa7e89273e Mon Sep 17 00:00:00 2001 From: netblue30 Date: Mon, 24 Aug 2015 09:05:18 -0400 Subject: added --env option --- test/env.exp | 55 +++++++++++++++++++++++++++++++++++++++++++ test/env.profile | 2 ++ test/firejail-in-firejail.exp | 18 +------------- test/fscheck-private.exp | 39 +++++++++++++----------------- test/test.sh | 3 +++ 5 files changed, 77 insertions(+), 40 deletions(-) create mode 100755 test/env.exp create mode 100644 test/env.profile (limited to 'test') diff --git a/test/env.exp b/test/env.exp new file mode 100755 index 000000000..d2edb0477 --- /dev/null +++ b/test/env.exp @@ -0,0 +1,55 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +#*********************************************** +send -- "firejail --env=ENV1=env1 --env=ENV2=env2 --env=ENV3=env3\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "env | grep ENV\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "ENV1" +} +send -- "env | grep ENV\r" +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "ENV2" +} +send -- "env | grep ENV\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "ENV3" +} +send -- "exit\r" +sleep 1 + +#*********************************************** +send -- "firejail --profile=env.profile\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" +} +sleep 1 +send -- "env | grep LD_LIBRARY_PATH\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "/opt/test/lib" +} +send -- "env | grep CFLAGS\r" +expect { + timeout {puts "TESTING ERROR 6\n";exit} + "Wall" +} +expect { + timeout {puts "TESTING ERROR 7\n";exit} + "Werror" +} + +puts "\n" diff --git a/test/env.profile b/test/env.profile new file mode 100644 index 000000000..ba66e6210 --- /dev/null +++ b/test/env.profile @@ -0,0 +1,2 @@ +env LD_LIBRARY_PATH=/opt/test/lib +env CFLAGS="-W -Wall -Werror" diff --git a/test/firejail-in-firejail.exp b/test/firejail-in-firejail.exp index 404eb03bb..59a94a7fb 100755 --- a/test/firejail-in-firejail.exp +++ b/test/firejail-in-firejail.exp @@ -14,24 +14,8 @@ sleep 1 send -- "firejail\r" expect { timeout {puts "TESTING ERROR 1\n";exit} - "Child process initialized" -} -sleep 1 - -send -- "firejail\r" -expect { - timeout {puts "TESTING ERROR 1\n";exit} - "Child process initialized" + "Warning: an existing sandbox was detected" } sleep 1 -puts "\n" - -send -- "exit\r" -sleep 1 -send -- "exit\r" -sleep 1 -send -- "exit\r" -sleep 1 - puts "\n" diff --git a/test/fscheck-private.exp b/test/fscheck-private.exp index 4c791423d..8e485cc03 100755 --- a/test/fscheck-private.exp +++ b/test/fscheck-private.exp @@ -4,37 +4,30 @@ set timeout 10 spawn $env(SHELL) match_max 100000 -# dir -#send -- "firejail --net=br0 --private=fscheck-dir\r" + +# .. +#send -- "firejail --net=br0 --private=../test/fscheck-dir\r" #expect { -# timeout {puts "TESTING ERROR 0\n";exit} +# timeout {puts "TESTING ERROR 0.1\n";exit} # "Error" #} #after 100 -# .. -send -- "firejail --net=br0 --private=../test/fscheck-dir\r" -expect { - timeout {puts "TESTING ERROR 0.1\n";exit} - "Error" -} -after 100 - # dir link -send -- "firejail --net=br0 --private=fscheck-dir-link\r" -expect { - timeout {puts "TESTING ERROR 1\n";exit} - "Error" -} -after 100 +#send -- "firejail --net=br0 --private=fscheck-dir-link\r" +#expect { +# timeout {puts "TESTING ERROR 1\n";exit} +# "Error" +#} +#after 100 # .. -send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r" -expect { - timeout {puts "TESTING ERROR 1.1\n";exit} - "Error" -} -after 100 +#send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r" +#expect { +# timeout {puts "TESTING ERROR 1.1\n";exit} +# "Error" +#} +#after 100 # file link send -- "firejail --net=br0 --private=fscheck-file-link\r" diff --git a/test/test.sh b/test/test.sh index 83d249b4f..8ddbc476f 100755 --- a/test/test.sh +++ b/test/test.sh @@ -4,6 +4,9 @@ ./fscheck.sh +echo "TESTING: environment variables" +./env.exp + echo "TESTING: private-etc" ./private-etc.exp -- cgit v1.2.3-70-g09d2