From 4b1a6094d7f4d9c25ff4f0f9a31bcd83732910a1 Mon Sep 17 00:00:00 2001 From: smitsohu Date: Wed, 25 Sep 2019 00:11:05 +0200 Subject: testing --- test/fs/fs.sh | 2 ++ test/fs/readonly-whitelist.exp | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 test/fs/readonly-whitelist.exp (limited to 'test/fs') diff --git a/test/fs/fs.sh b/test/fs/fs.sh index c60d44904..7ea8de542 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh @@ -21,6 +21,8 @@ mkdir ~/_firejail_test_dir/test1 touch ~/_firejail_test_dir/test1/b echo "TESTING: read/write (test/fs/read-write.exp)" ./read-write.exp +echo "TESTING: readonly whitelist (test/fs/readonly-whitelist.exp)" +./readonly-whitelist.exp rm -fr ~/_firejail_test_* echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" diff --git a/test/fs/readonly-whitelist.exp b/test/fs/readonly-whitelist.exp new file mode 100755 index 000000000..784fc36bd --- /dev/null +++ b/test/fs/readonly-whitelist.exp @@ -0,0 +1,28 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2019 Firejail Authors +# License GPL v2 + +set timeout 10 +spawn $env(SHELL) +match_max 100000 + + +send -- "firejail --noprofile --whitelist=~/_firejail_test_dir --read-only=~\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +send -- "echo mytest > ~/_firejail_test_dir/a\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Read-only file system" +} +after 100 + +send -- "exit\r" +sleep 1 + +puts "\nall done\n" -- cgit v1.2.3-54-g00ecf