firejail/test/fs/macro.exp
Kelvin M. Klann d9739c6d55 test/fs/macro.exp: increase timeout to 3s
The test is failing at multiple parts in CI due to timeouts.

From [1]:

    runner@runnervmrc6n4:~/work/firejail/firejail/test/fs$
    <=./macro-blacklist.profile ls ~/Videos; echo ret $?
    Reading profile ./macro-blacklist.profile
    firejail version 0.9.81

    Parent pid 6385, child pid 6386
    Base filesystem installed in 0.25 ms
    firejail ls /home/runner/Videos
    Child process initialized in 7.58 ms
    ls: cannot open directory '/home/runner/Videos': Permission denied

    Parent is shutting down, bye...
    ret 2
    runner@runnervmrc6n4:~/work/firejail/firejail/test/fs$
    <le touch ~/Desktop/_firejail_test_file; echo ret $?
    Reading profile ./macro-readonly.profile
    firejail version 0.9.81

    Parent pid 6390, child pid 6391
    Base filesystem installed in 3.23 ms
    TESTING ERROR 19

From [2]:

    runner@runnervmrc6n4:~/work/firejail/firejail/test/fs$
    <macro-blacklist.profile ls ~/Documents; echo ret $?
    Reading profile ./macro-blacklist.profile
    firejail version 0.9.81

    Parent pid 6382, child pid 6383
    Base filesystem installed in 0.26 ms
    firejail ls /home/runner/Documents
    Child process initialized in 7.84 ms
    ls: cannot open directory '/home/runner/Documents': Permission denied

    Parent is shutting down, bye...
    ret 2
    runner@runnervmrc6n4:~/work/firejail/firejail/test/fs$
    <macro-blacklist.profile ls ~/Downloads; echo ret $?
    Reading profile ./macro-blacklist.profile
    firejail version 0.9.81

    Parent pid 6387, child pid 6388
    Base filesystem installed in 0.25 ms
    firejail ls /home/runner/Downloads
    TESTING ERROR 11

This amends commit 574885778 ("test/fs/macro.exp: reduce timeout and
sleep", 2026-04-24) / PR #7147.

[1] https://github.com/netblue30/firejail/actions/runs/25076422708/job/73470137137
[2] https://github.com/netblue30/firejail/actions/runs/25076422708/job/73522630528
2026-04-29 02:58:06 -03:00

186 lines
4.8 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 3
spawn $env(SHELL)
match_max 100000
send -- "firejail --profile=./macro-whitelist.profile ls ~\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"Desktop"
}
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"Documents"
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"Downloads"
}
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"Music"
}
expect {
timeout {puts "TESTING ERROR 5\n";exit}
"Pictures"
}
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"Videos"
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Desktop; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 7\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 8\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 8.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Documents; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 9\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 10\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 10.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Downloads; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 11\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 12\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 12.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Music; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 13\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 14\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 14.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Pictures; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 15\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 16\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 16.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Videos; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 17\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 18\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 18.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-readonly.profile touch ~/Desktop/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 19\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 20\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 20.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-readonly.profile touch ~/Documents/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 21\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 22\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 22.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-readonly.profile touch ~/Downloads/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 23\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 24\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 24.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-readonly.profile touch ~/Music/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 25\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 26\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 26.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-readonly.profile touch ~/Pictures/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 27\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 28\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 28.1\n";exit}
}
after 100
send -- "firejail --profile=./macro-readonly.profile touch ~/Videos/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 29\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 30\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 30.1\n";exit}
}
after 100
puts "\nall done\n"