firejail/test/features/3.11.exp
2017-05-24 14:38:01 -05:00

171 lines
3 KiB
Text
Executable file

#!/usr/bin/expect -f
#
# mkdir
#
set timeout 10
spawn $env(SHELL)
match_max 100000
set overlay [lindex $argv 0]
set chroot [lindex $argv 1]
#
# N
#
send -- "rm -fr ~/firejail-xy76_u9\r"
sleep 1
send -- "firejail --profile=3.11.profile\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"Child process initialized"
}
sleep 1
send -- "ls -l ~ | grep firejail-xy76_u9\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"drwx------"
}
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"netblue netblue" { puts "Debian\n"}
"netblue users" { puts "Arch\n"}
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"firejail-xy76_u9"
}
after 100
send -- "ls -l ~/firejail-xy76_u9\r"
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"drwx------"
}
expect {
timeout {puts "TESTING ERROR 5\n";exit}
"netblue netblue" { puts "Debian\n"}
"netblue users" { puts "Arch\n"}
}
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"testdir"
}
after 100
send -- "exit\r"
sleep 1
send -- "rm -fr ~/firejail-xy76_u9\r"
sleep 1
#
# O
#
if { $overlay == "overlay" } {
send -- "rm -fr ~/firejail-xy76_u9\r"
sleep 1
send -- "firejail --profile=3.11.profile\r"
expect {
timeout {puts "TESTING ERROR 10\n";exit}
"overlay option is not available" {puts "grsecurity\n"; exit}
"Child process initialized" {puts "normal system\n"}
}
sleep 1
send -- "ls -l ~ | grep firejail-xy76_u9\r"
expect {
timeout {puts "TESTING ERROR 11\n";exit}
"drwx------"
}
expect {
timeout {puts "TESTING ERROR 12\n";exit}
"netblue netblue" { puts "Debian\n"}
"netblue users" { puts "Arch\n"}
}
expect {
timeout {puts "TESTING ERROR 13\n";exit}
"firejail-xy76_u9"
}
after 100
send -- "ls -l ~/firejail-xy76_u9\r"
expect {
timeout {puts "TESTING ERROR 14\n";exit}
"drwx------"
}
expect {
timeout {puts "TESTING ERROR 15\n";exit}
"netblue netblue" { puts "Debian\n"}
"netblue users" { puts "Arch\n"}
}
expect {
timeout {puts "TESTING ERROR 16\n";exit}
"testdir"
}
after 100
send -- "exit\r"
sleep 1
send -- "rm -fr ~/firejail-xy76_u9\r"
sleep 1
}
#
# C
#
if { $chroot == "chroot" } {
send -- "rm -fr ~/firejail-xy76_u9\r"
sleep 1
send -- "firejail --profile=3.11.profile\r"
expect {
timeout {puts "TESTING ERROR 20\n";exit}
"Child process initialized"
}
sleep 1
send -- "ls -l ~ | grep firejail-xy76_u9\r"
expect {
timeout {puts "TESTING ERROR 21\n";exit}
"drwx------"
}
expect {
timeout {puts "TESTING ERROR 22\n";exit}
"netblue netblue" { puts "Debian\n"}
"netblue users" { puts "Arch\n"}
}
expect {
timeout {puts "TESTING ERROR 23\n";exit}
"firejail-xy76_u9"
}
after 100
send -- "ls -l ~/firejail-xy76_u9\r"
expect {
timeout {puts "TESTING ERROR 24\n";exit}
"drwx------"
}
expect {
timeout {puts "TESTING ERROR 25\n";exit}
"netblue netblue" { puts "Debian\n"}
"netblue users" { puts "Arch\n"}
}
expect {
timeout {puts "TESTING ERROR 26\n";exit}
"testdir"
}
after 100
send -- "rm -fr ~/firejail-xy76_u9\r"
sleep 1
send -- "exit\r"
}
puts "\nall done\n"