From 2905b9f9ab5c5ed6f9210d1d843a8bcf41451854 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sat, 23 Apr 2016 08:53:07 -0400 Subject: make test-utils --- test/profiles/ignore.exp | 50 +++++++++++++++++++++++++++++++++++++++++++ test/profiles/ignore.profile | 3 +++ test/profiles/ignore2.profile | 3 +++ test/profiles/profiles.sh | 7 ++++-- 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100755 test/profiles/ignore.exp create mode 100644 test/profiles/ignore.profile create mode 100644 test/profiles/ignore2.profile (limited to 'test/profiles') diff --git a/test/profiles/ignore.exp b/test/profiles/ignore.exp new file mode 100755 index 000000000..281697b26 --- /dev/null +++ b/test/profiles/ignore.exp @@ -0,0 +1,50 @@ +#!/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 -- "firejail --profile=ignore.profile --ignore=seccomp \r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Error: please use --profile after --ignore" +} + +send -- "firejail --debug --ignore=seccomp\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + BLACKLIST {puts "TESTING ERROR 2\n";exit} + "Child process initialized" +} +sleep 1 +send -- "exit\r" +sleep 1 + +send -- "firejail --ignore=seccomp --ignore=shell --profile=ignore.profile \r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "ps aux | wc -l\r" +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "5" +} +sleep 1 +send -- "exit\r" +sleep 1 + +send -- "firejail --debug --profile=ignore2.profile\r" +expect { + timeout {puts "TESTING ERROR 5\n";exit} + BLACKLIST {puts "TESTING ERROR 6\n";exit} + "Child process initialized" +} + + +puts "\nall done\n" diff --git a/test/profiles/ignore.profile b/test/profiles/ignore.profile new file mode 100644 index 000000000..aec231ad2 --- /dev/null +++ b/test/profiles/ignore.profile @@ -0,0 +1,3 @@ +private +seccomp +shell none diff --git a/test/profiles/ignore2.profile b/test/profiles/ignore2.profile new file mode 100644 index 000000000..49fcd8324 --- /dev/null +++ b/test/profiles/ignore2.profile @@ -0,0 +1,3 @@ +ignore seccomp +private +seccomp diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh index a20ed5432..e3adc8a4f 100755 --- a/test/profiles/profiles.sh +++ b/test/profiles/profiles.sh @@ -14,9 +14,12 @@ do ./test-profile.exp $PROFILE done -echo "TESTING: profile syntax (profiles/profile_syntax.exp)" +echo "TESTING: profile syntax (test/profiles/profile_syntax.exp)" ./profile_syntax.exp -echo "TESTING: profile syntax 2 (profiles/profile_syntax2.exp)" +echo "TESTING: profile syntax 2 (test/profiles/profile_syntax2.exp)" ./profile_syntax2.exp +echo "TESTING: ignore command (test/profiles/ignore.exp)" +./ignore.exp + -- cgit v1.2.3-54-g00ecf