From d8d016dc44648fe185577ff82433a32fb17081f7 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Fri, 21 May 2021 08:56:45 -0400 Subject: support trailing comments on profile lines --- test/profiles/comment.profile | 3 +++ test/profiles/profile_comment.exp | 52 +++++++++++++++++++++++++++++++++++++++ test/profiles/profiles.sh | 3 +++ 3 files changed, 58 insertions(+) create mode 100644 test/profiles/comment.profile create mode 100755 test/profiles/profile_comment.exp (limited to 'test') diff --git a/test/profiles/comment.profile b/test/profiles/comment.profile new file mode 100644 index 000000000..4a907a408 --- /dev/null +++ b/test/profiles/comment.profile @@ -0,0 +1,3 @@ +# this is a comment +net none # this is another comment +private # some other comment diff --git a/test/profiles/profile_comment.exp b/test/profiles/profile_comment.exp new file mode 100755 index 000000000..a2be510c1 --- /dev/null +++ b/test/profiles/profile_comment.exp @@ -0,0 +1,52 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2021 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + +send -- "rm -fr /tmp/firejailtest*\r" +send -- "rm -fr /tmp/firejail-strace*\r" +send -- "rm -fr /tmp/firejail-trace*\r" +sleep 1 + +send -- "firejail --profile=comment.profile /usr/bin/true\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Parent is shutting down" +} +sleep 2 + +send -- "firejail --build=/tmp/firejailtest.profile /usr/bin/true\r" +sleep 1 + +send -- "cat /tmp/firejailtest.profile\r" +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "seccomp" +} +after 100 + +send -- "firejail --profile=/tmp/firejailtest.profile /usr/bin/true\r" +expect { + timeout {puts "TESTING ERROR 3\n";exit} + "Child process initialized" +} +expect { + timeout {puts "TESTING ERROR 4\n";exit} + "Parent is shutting down" +} +after 100 + +send -- "rm -fr /tmp/firejailtest*\r" +send -- "rm -fr /tmp/firejail-strace*\r" +send -- "rm -fr /tmp/firejail-trace*\r" +after 100 + +puts "\nall done\n" diff --git a/test/profiles/profiles.sh b/test/profiles/profiles.sh index a5f74f2e2..cbc6fa4d9 100755 --- a/test/profiles/profiles.sh +++ b/test/profiles/profiles.sh @@ -7,6 +7,9 @@ export MALLOC_CHECK_=3 export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) export LC_ALL=C +echo "TESTING: profile comments (test/profiles/profilecomment.exp)" +./profile_comment.exp + echo "TESTING: profile conditional (test/profiles/conditional.exp)" ./conditional.exp -- cgit v1.2.3-70-g09d2