firejail/test/blacklist.exp
2015-08-20 09:06:07 -04:00

76 lines
1.2 KiB
Text
Executable file

#!/usr/bin/expect -f
set timeout 10
spawn $env(SHELL)
match_max 100000
# directory with ~
send -- "firejail --blacklist=~/.config\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"Child process initialized"
}
sleep 1
send -- "ls -al ~/.config\r"
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"cannot open directory"
}
send -- "exit\r"
sleep 1
# directory with ~ in profile file
send -- "firejail --profile=blacklist1.profile\r"
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"Child process initialized"
}
sleep 1
send -- "ls -al ~/.config\r"
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"cannot open directory"
}
send -- "exit\r"
sleep 1
# directory with space
send -- "firejail \"--blacklist=dir with space\"\r"
expect {
timeout {puts "TESTING ERROR 5\n";exit}
"Child process initialized"
}
sleep 1
send -- "ls -al \"dir with space\"\r"
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"cannot open directory"
}
send -- "exit\r"
sleep 1
# directory with space in profile
send -- "firejail --profile=blacklist2.profile\r"
expect {
timeout {puts "TESTING ERROR 7\n";exit}
"Child process initialized"
}
sleep 1
send -- "ls -al \"dir with space\"\r"
expect {
timeout {puts "TESTING ERROR 8\n";exit}
"cannot open directory"
}
puts "\n"