From 4e86686da02b39e650edbb80e2fc837d2ccd3a33 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Tue, 23 Feb 2016 08:43:05 -0500 Subject: x11 work --- test/chromium-x11.exp | 75 +++++++++++++++++++++++++++++++++++++++++++ test/firefox-x11.exp | 68 +++++++++++++++++++++++++++++++++++++++ test/test-apps-x11.sh | 29 +++++++++++++++++ test/test.sh | 1 + test/transmission-gtk-x11.exp | 74 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 247 insertions(+) create mode 100755 test/chromium-x11.exp create mode 100755 test/firefox-x11.exp create mode 100755 test/test-apps-x11.sh create mode 100755 test/transmission-gtk-x11.exp (limited to 'test') diff --git a/test/chromium-x11.exp b/test/chromium-x11.exp new file mode 100755 index 000000000..0d8a5dfb3 --- /dev/null +++ b/test/chromium-x11.exp @@ -0,0 +1,75 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --name=test --x11 --net=br0 chromium www.gentoo.org\r" +sleep 10 + +spawn $env(SHELL) +send -- "firejail --list\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "chromium" +} +sleep 1 + +send -- "firejail --name=blablabla\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" +} +sleep 2 + +spawn $env(SHELL) +send -- "firemon --seccomp\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 5.0\n";exit} + "chromium" +} +expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "Seccomp: 0" +} +expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "name=blablabla" +} +sleep 1 +send -- "firemon --caps\r" +expect { + timeout {puts "TESTING ERROR 6\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 6.0\n";exit} + "chromium" +} +expect { + timeout {puts "TESTING ERROR 6.1\n";exit} + "CapBnd:" +} +expect { + timeout {puts "TESTING ERROR 6.2\n";exit} + "fffffffff" +} +expect { + timeout {puts "TESTING ERROR 6.3\n";exit} + "name=blablabla" +} +sleep 1 +send -- "firejail --shutdown=test\r" +sleep 3 + + +puts "\nall done\n" + diff --git a/test/firefox-x11.exp b/test/firefox-x11.exp new file mode 100755 index 000000000..c82408896 --- /dev/null +++ b/test/firefox-x11.exp @@ -0,0 +1,68 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --name=test --x11 --net=br0 firefox www.gentoo.org\r" +sleep 10 + +spawn $env(SHELL) +send -- "firejail --list\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "firefox" {puts "firefox detected\n";} + "iceweasel" {puts "iceweasel detected\n";} +} +sleep 1 +send -- "firejail --name=blablabla\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" +} +sleep 2 + +spawn $env(SHELL) +send -- "firemon --seccomp\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + " firefox" {puts "firefox detected\n";} + " iceweasel" {puts "iceweasel detected\n";} +} +expect { + timeout {puts "TESTING ERROR 5.1 (seccomp)\n";exit} + "Seccomp: 2" +} +expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "name=blablabla" +} +sleep 1 +send -- "firemon --caps\r" +expect { + timeout {puts "TESTING ERROR 6\n";exit} + " firefox" {puts "firefox detected\n";} + " iceweasel" {puts "iceweasel detected\n";} +} +expect { + timeout {puts "TESTING ERROR 6.1\n";exit} + "CapBnd:" +} +expect { + timeout {puts "TESTING ERROR 6.2\n";exit} + "0000000000000000" +} +expect { + timeout {puts "TESTING ERROR 6.3\n";exit} + "name=blablabla" +} +sleep 1 +send -- "firejail --shutdown=test\r" +sleep 3 + +puts "\nall done\n" + diff --git a/test/test-apps-x11.sh b/test/test-apps-x11.sh new file mode 100755 index 000000000..6521fa2b0 --- /dev/null +++ b/test/test-apps-x11.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +which firefox +if [ "$?" -eq 0 ]; +then + echo "TESTING: firefox x11" + ./firefox-x11.exp +else + echo "TESTING: firefox not found" +fi + +which chromium +if [ "$?" -eq 0 ]; +then + echo "TESTING: chromium x11" + ./chromium-x11.exp +else + echo "TESTING: chromium not found" +fi + +which transmission-gtk +if [ "$?" -eq 0 ]; +then + echo "TESTING: transmission-gtk x11" + ./transmission-gtk.exp +else + echo "TESTING: transmission-gtk not found" +fi + diff --git a/test/test.sh b/test/test.sh index ddb8431c8..d7e9e2aed 100755 --- a/test/test.sh +++ b/test/test.sh @@ -166,6 +166,7 @@ else fi ./test-apps.sh +./test-apps-x11.sh echo "TESTING: PID (pid.exp)" ./pid.exp diff --git a/test/transmission-gtk-x11.exp b/test/transmission-gtk-x11.exp new file mode 100755 index 000000000..6192b277c --- /dev/null +++ b/test/transmission-gtk-x11.exp @@ -0,0 +1,74 @@ +#!/usr/bin/expect -f + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --name=test --net=br0 --x11 transmission-gtk\r" +sleep 10 + +spawn $env(SHELL) +send -- "firejail --list\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 3.1\n";exit} + "transmission-gtk" +} +sleep 1 + +send -- "firejail --name=blablabla\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Child process initialized" +} +sleep 2 + +spawn $env(SHELL) +send -- "firemon --seccomp\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 5.0\n";exit} + "transmission-gtk" +} +expect { + timeout {puts "TESTING ERROR 5.1 (seccomp)\n";exit} + "Seccomp: 2" +} +expect { + timeout {puts "TESTING ERROR 5.1\n";exit} + "name=blablabla" +} +sleep 1 +send -- "firemon --caps\r" +expect { + timeout {puts "TESTING ERROR 6\n";exit} + ":firejail" +} +expect { + timeout {puts "TESTING ERROR 6.0\n";exit} + "transmission-gtk" +} +expect { + timeout {puts "TESTING ERROR 6.1\n";exit} + "CapBnd" +} +expect { + timeout {puts "TESTING ERROR 6.2\n";exit} + "0000000000000000" +} +expect { + timeout {puts "TESTING ERROR 6.3\n";exit} + "name=blablabla" +} +sleep 1 +send -- "firejail --shutdown=test\r" +sleep 3 + +puts "\nall done\n" + -- cgit v1.2.3-54-g00ecf