From ca79ff961cc303670f1ccb8841495ddd7f17a76b Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sat, 12 Nov 2016 07:36:41 -0500 Subject: testing --- test/overlay/fs-named.exp | 66 +++++++++++++++++++++++++++++++++++++++++++++++ test/overlay/fs-tmpfs.exp | 62 ++++++++++++++++++++++++++++++++++++++++++++ test/overlay/overlay.sh | 12 ++++++++- test/root/firecfg.exp | 46 +++++++++++++++++++++++++++++++++ 4 files changed, 185 insertions(+), 1 deletion(-) create mode 100755 test/overlay/fs-named.exp create mode 100755 test/overlay/fs-tmpfs.exp create mode 100755 test/root/firecfg.exp (limited to 'test') diff --git a/test/overlay/fs-named.exp b/test/overlay/fs-named.exp new file mode 100755 index 000000000..2ccb22bb1 --- /dev/null +++ b/test/overlay/fs-named.exp @@ -0,0 +1,66 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --overlay-named=firejail-test\r" +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"} +} +sleep 1 + +send -- "echo xyzxyzxyz > ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "done" +} +after 100 + +send -- "cat ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "xyzxyzxyz" +} +expect { + timeout {puts "TESTING ERROR 4.1\n";exit} + "done" +} +after 100 + +send -- "exit\r" +sleep 2 + +send -- "cat ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "xyzxyzxyz" {puts "TESTING ERROR 5.1\n";exit} + "done" +} +after 100 + +send -- "firejail --overlay-named=firejail-test\r" +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"} +} +sleep 1 + +send -- "cat ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "xyzxyzxyz" +} +expect { + timeout {puts "TESTING ERROR 4.1\n";exit} + "done" +} +after 100 + +puts "\nall done\n" + diff --git a/test/overlay/fs-tmpfs.exp b/test/overlay/fs-tmpfs.exp new file mode 100755 index 000000000..658d16779 --- /dev/null +++ b/test/overlay/fs-tmpfs.exp @@ -0,0 +1,62 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --overlay-clean\r" +after 100 +send -- "file ~/.firejail\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "cannot open" +} +after 100 + +send -- "firejail --overlay-tmpfs\r" +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"} +} +sleep 1 + +send -- "echo xyzxyzxyz > ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "done" +} +after 100 + +send -- "cat ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "xyzxyzxyz" +} +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "done" +} +after 100 + +send -- "exit\r" +sleep 1 + +send -- "cat ~/_firejail_test_file; echo done\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "xyzxyzxyz" {puts "TESTING ERROR 6\n";exit} + "done" +} +after 100 + +send -- "file ~/.firejail\r" +expect { + timeout {puts "TESTING ERROR 7\n";exit} + "cannot open" +} +after 100 + +puts "\nall done\n" + diff --git a/test/overlay/overlay.sh b/test/overlay/overlay.sh index 971adddfe..4c9ebe5b0 100755 --- a/test/overlay/overlay.sh +++ b/test/overlay/overlay.sh @@ -11,6 +11,16 @@ rm -fr ~/_firejail_test_* ./fs.exp rm -fr ~/_firejail_test_* +echo "TESTING: overlay named fs (test/overlay/fs-named.exp)" +rm -fr ~/_firejail_test_* +./fs-named.exp +rm -fr ~/_firejail_test_* + +echo "TESTING: overlay tmpfs fs (test/overlay/fs-tmpfs.exp)" +rm -fr ~/_firejail_test_* +./fs-tmpfs.exp +rm -fr ~/_firejail_test_* + which firefox if [ "$?" -eq 0 ]; then @@ -51,7 +61,7 @@ which firefox if [ "$?" -eq 0 ]; then echo "TESTING: overlay firefox x11" - ./firefox.exp + ./firefox-x11.exp else echo "TESTING SKIP: firefox not found" fi diff --git a/test/root/firecfg.exp b/test/root/firecfg.exp new file mode 100755 index 000000000..b4864988d --- /dev/null +++ b/test/root/firecfg.exp @@ -0,0 +1,46 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2016 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firecfg\r" +sleep 1 + +send -- "firecfg --clean\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "/usr/local/bin/firefox removed" +} +after 100 +send -- "file /usr/local/bin/firefox; echo done\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "symbolic link to /usr/bin/firejail" {puts "TESTING ERROR 2\n";exit} + "done" +} +after 100 + +send -- "firecfg\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "/usr/local/bin/firefox created" +} +after 100 +send -- "file /usr/local/bin/firefox\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "symbolic link to /usr/bin/firejail" +} +after 100 + +send -- "firecfg --list\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + "/usr/local/bin/firefox" +} +after 100 +puts "\nall done\n" -- cgit v1.2.3-54-g00ecf