test/fs: simplify error messages in macro tests
Some checks failed
Build / build (push) Has been cancelled
Codespell / codespell (push) Has been cancelled
Test / test-main (push) Has been cancelled
Test / test-fs (push) Has been cancelled
Test / test-environment (push) Has been cancelled
Test / test-utils (push) Has been cancelled
Test / test-network (push) Has been cancelled

To make it easier to add new directories.

This is similar to commit 1511aab5f
("test/fs/disable-devnull-symlink.exp: simplify error messages",
2026-04-27).

Relates to #7147 #7151.
This commit is contained in:
Kelvin M. Klann 2026-05-05 04:46:59 -03:00
parent 6b65860e89
commit 46a111166e
2 changed files with 96 additions and 92 deletions

View file

@ -18,182 +18,184 @@ send -- "firejail --profile=./macro-subpath-whitelist.profile ls \
\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
timeout {puts "TESTING ERROR 1\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 1\n";exit}
timeout {puts "TESTING ERROR 1.1 Desktop\n";exit}
"Desktop/_firejail_test_dir/a" {}
"Desktop/_firejail_test_dir/b" {puts "TESTING ERROR 1.1\n";exit}
"Desktop/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Desktop\n";exit}
}
expect {
timeout {puts "TESTING ERROR 2\n";exit}
timeout {puts "TESTING ERROR 1.1 Documents\n";exit}
"Documents/_firejail_test_dir/a" {}
"Documents/_firejail_test_dir/b" {puts "TESTING ERROR 2.1\n";exit}
"Documents/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Documents\n";exit}
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
timeout {puts "TESTING ERROR 1.1 Downloads\n";exit}
"Downloads/_firejail_test_dir/a" {}
"Downloads/_firejail_test_dir/b" {puts "TESTING ERROR 3.1\n";exit}
"Downloads/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Downloads\n";exit}
}
expect {
timeout {puts "TESTING ERROR 4\n";exit}
timeout {puts "TESTING ERROR 1.1 Music\n";exit}
"Music/_firejail_test_dir/a" {}
"Music/_firejail_test_dir/b" {puts "TESTING ERROR 4.1\n";exit}
"Music/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Music\n";exit}
}
expect {
timeout {puts "TESTING ERROR 5\n";exit}
timeout {puts "TESTING ERROR 1.1 Pictures\n";exit}
"Pictures/_firejail_test_dir/a" {}
"Pictures/_firejail_test_dir/b" {puts "TESTING ERROR 5.1\n";exit}
"Pictures/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Pictures\n";exit}
}
expect {
timeout {puts "TESTING ERROR 6\n";exit}
timeout {puts "TESTING ERROR 1.1 Videos\n";exit}
"Videos/_firejail_test_dir/a" {}
"Videos/_firejail_test_dir/b" {puts "TESTING ERROR 6.1\n";exit}
"Videos/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Videos\n";exit}
}
after 100
# blacklist
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Desktop/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 7\n";exit}
timeout {puts "TESTING ERROR 2 Desktop\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 8\n";exit}
timeout {puts "TESTING ERROR 2.1 Desktop\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 8.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Desktop\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Documents/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 9\n";exit}
timeout {puts "TESTING ERROR 2 Documents\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 10\n";exit}
timeout {puts "TESTING ERROR 2.1 Documents\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 10.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Documents\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Downloads/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 11\n";exit}
timeout {puts "TESTING ERROR 2 Downloads\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 12\n";exit}
timeout {puts "TESTING ERROR 2.1 Downloads\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 12.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Downloads\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Music/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 13\n";exit}
timeout {puts "TESTING ERROR 2 Music\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 14\n";exit}
timeout {puts "TESTING ERROR 2.1 Music\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 14.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Music\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Pictures/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 15\n";exit}
timeout {puts "TESTING ERROR 2 Pictures\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 16\n";exit}
timeout {puts "TESTING ERROR 2.1 Pictures\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 16.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Pictures\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Videos/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 17\n";exit}
timeout {puts "TESTING ERROR 2 Videos\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 18\n";exit}
timeout {puts "TESTING ERROR 2.1 Videos\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 18.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Videos\n";exit}
}
after 100
# read-only
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Desktop/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 19\n";exit}
timeout {puts "TESTING ERROR 3 Desktop\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 20\n";exit}
timeout {puts "TESTING ERROR 3.1 Desktop\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 20.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Desktop\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Documents/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 21\n";exit}
timeout {puts "TESTING ERROR 3 Documents\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 22\n";exit}
timeout {puts "TESTING ERROR 3.1 Documents\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 22.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Documents\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Downloads/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 23\n";exit}
timeout {puts "TESTING ERROR 3 Downloads\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 24\n";exit}
timeout {puts "TESTING ERROR 3.1 Downloads\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 24.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Downloads\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Music/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 25\n";exit}
timeout {puts "TESTING ERROR 3 Music\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 26\n";exit}
timeout {puts "TESTING ERROR 3.1 Music\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 26.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Music\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Pictures/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 27\n";exit}
timeout {puts "TESTING ERROR 3 Pictures\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 28\n";exit}
timeout {puts "TESTING ERROR 3.1 Pictures\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 28.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Pictures\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Videos/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 29\n";exit}
timeout {puts "TESTING ERROR 3 Videos\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 30\n";exit}
timeout {puts "TESTING ERROR 3.1 Videos\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 30.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Videos\n";exit}
}
after 100

View file

@ -10,176 +10,178 @@ match_max 100000
send -- "firejail --profile=./macro-whitelist.profile ls ~\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
timeout {puts "TESTING ERROR 1\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 1\n";exit}
timeout {puts "TESTING ERROR 1.1 Desktop\n";exit}
"Desktop"
}
expect {
timeout {puts "TESTING ERROR 2\n";exit}
timeout {puts "TESTING ERROR 1.1 Documents\n";exit}
"Documents"
}
expect {
timeout {puts "TESTING ERROR 3\n";exit}
timeout {puts "TESTING ERROR 1.1 Downloads\n";exit}
"Downloads"
}
expect {
timeout {puts "TESTING ERROR 4\n";exit}
timeout {puts "TESTING ERROR 1.1 Music\n";exit}
"Music"
}
expect {
timeout {puts "TESTING ERROR 5\n";exit}
timeout {puts "TESTING ERROR 1.1 Pictures\n";exit}
"Pictures"
}
expect {
timeout {puts "TESTING ERROR 6\n";exit}
timeout {puts "TESTING ERROR 1.1 Videos\n";exit}
"Videos"
}
after 100
# blacklist
send -- "firejail --profile=./macro-blacklist.profile ls ~/Desktop; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 7\n";exit}
timeout {puts "TESTING ERROR 2 Desktop\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 8\n";exit}
timeout {puts "TESTING ERROR 2.1 Desktop\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 8.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Desktop\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Documents; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 9\n";exit}
timeout {puts "TESTING ERROR 2 Documents\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 10\n";exit}
timeout {puts "TESTING ERROR 2.1 Documents\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 10.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Documents\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Downloads; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 11\n";exit}
timeout {puts "TESTING ERROR 2 Downloads\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 12\n";exit}
timeout {puts "TESTING ERROR 2.1 Downloads\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 12.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Downloads\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Music; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 13\n";exit}
timeout {puts "TESTING ERROR 2 Music\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 14\n";exit}
timeout {puts "TESTING ERROR 2.1 Music\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 14.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Music\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Pictures; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 15\n";exit}
timeout {puts "TESTING ERROR 2 Pictures\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 16\n";exit}
timeout {puts "TESTING ERROR 2.1 Pictures\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 16.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Pictures\n";exit}
}
after 100
send -- "firejail --profile=./macro-blacklist.profile ls ~/Videos; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 17\n";exit}
timeout {puts "TESTING ERROR 2 Videos\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 18\n";exit}
timeout {puts "TESTING ERROR 2.1 Videos\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 18.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 2.2 Videos\n";exit}
}
after 100
# read-only
send -- "firejail --profile=./macro-readonly.profile touch ~/Desktop/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 19\n";exit}
timeout {puts "TESTING ERROR 3 Desktop\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 20\n";exit}
timeout {puts "TESTING ERROR 3.1 Desktop\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 20.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Desktop\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}
timeout {puts "TESTING ERROR 3 Documents\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 22\n";exit}
timeout {puts "TESTING ERROR 3.1 Documents\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 22.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Documents\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}
timeout {puts "TESTING ERROR 3 Downloads\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 24\n";exit}
timeout {puts "TESTING ERROR 3.1 Downloads\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 24.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Downloads\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}
timeout {puts "TESTING ERROR 3 Music\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 26\n";exit}
timeout {puts "TESTING ERROR 3.1 Music\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 26.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Music\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}
timeout {puts "TESTING ERROR 3 Pictures\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 28\n";exit}
timeout {puts "TESTING ERROR 3.1 Pictures\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 28.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Pictures\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}
timeout {puts "TESTING ERROR 3 Videos\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 30\n";exit}
timeout {puts "TESTING ERROR 3.1 Videos\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 30.1\n";exit}
-re {ret 0} {puts "TESTING ERROR 3.2 Videos\n";exit}
}
after 100