firejail/test/utils/ls.exp
Kelvin M. Klann 68427a2333
test: fix unescaped newlines in error messages (#7146)
Commands used to search and replace:

    $ git grep -IElz 'ERROR [0-9]+n"' -- test |
      xargs -0 perl -pi -e 's/(ERROR [0-9]+)n"/$1\\n"/'

Related commits:

* 63e16bfcd ("major cleanup and testing", 2016-11-13)
* 2155203b3 ("xdg macro testing", 2018-08-07)
2026-04-27 07:36:57 +00:00

72 lines
1.2 KiB
Text
Executable file

#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2026 Firejail Authors
# License GPL v2
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}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
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 2\n";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"