firejail/test/utils/ls.exp
2016-11-13 10:47:20 -05:00

69 lines
1 KiB
Text
Executable file

#!/usr/bin/expect -f
set timeout 10
spawn $env(SHELL)
match_max 100000
set firstspawn $spawn_id
send -- "rm -f lstesting\r"
sleep 1
send -- "firejail --private --name=test\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"Child process initialized"
}
sleep 1
send -- "echo my_testing > ~/lstesting\r"
after 100
# ls
spawn $env(SHELL)
send -- "firejail --ls=test ~/.\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"lstesting"
}
sleep 1
# get
send -- "firejail --get=test ~/lstesting\r"
sleep 1
send -- "cat lstesting\r"
expect {
timeout {puts "TESTING ERROR 2n";exit}
"my_testing"
}
after 100
# put
send -- "echo put_test > ~/lstesting\r"
after 100
send -- "firejail --put=test ~/lstesting ~/lstesting_2\r"
sleep 1
set spawn_id $firstspawn
send -- "ls -al ~\r"
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"lstesting_2"
}
after 100
send -- "cat ~/lstesting_2\r"
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"put_test"
}
after 100
send -- "exit\r"
sleep 1
send -- "rm -f lstesting\r"
after 100
puts "\nall done\n"