firejail/test/fs/macro-subpath.exp
Kelvin M. Klann 98fe3af8ba test/fs/macro-subpath.exp: fix permissions (644 -> 755)
The tests from this file are currently not even being executed in CI[1]:

    TESTING: macro subpaths (test/fs/macro-subpath.exp)
    ./fs.sh: line 130: ./macro-subpath.exp: Permission denied
    TESTING: whitelist empty (test/fs/whitelist-empty.exp)

This amends commit aff7cb630 ("feature: allow subpaths in xdg macros",
2026-04-21) / PR #7151.

Relates to #7147.

[1] https://github.com/netblue30/firejail/actions/runs/25602127293/job/75157737035
2026-05-11 11:08:51 -03:00

233 lines
7.3 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
# Test that macros work with subpaths (see #2359).
send -- "firejail --profile=./macro-subpath-whitelist.profile find \
~/Desktop/_firejail_test_dir \
~/Documents/_firejail_test_dir \
~/Downloads/_firejail_test_dir \
~/Music/_firejail_test_dir \
~/Pictures/_firejail_test_dir \
~/Projects/_firejail_test_dir \
~/Videos/_firejail_test_dir \
| LC_ALL=C sort
\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 1.1 Desktop\n";exit}
"Desktop/_firejail_test_dir/a" {}
"Desktop/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Desktop\n";exit}
}
expect {
timeout {puts "TESTING ERROR 1.1 Documents\n";exit}
"Documents/_firejail_test_dir/a" {}
"Documents/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Documents\n";exit}
}
expect {
timeout {puts "TESTING ERROR 1.1 Downloads\n";exit}
"Downloads/_firejail_test_dir/a" {}
"Downloads/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Downloads\n";exit}
}
expect {
timeout {puts "TESTING ERROR 1.1 Music\n";exit}
"Music/_firejail_test_dir/a" {}
"Music/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Music\n";exit}
}
expect {
timeout {puts "TESTING ERROR 1.1 Pictures\n";exit}
"Pictures/_firejail_test_dir/a" {}
"Pictures/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Pictures\n";exit}
}
expect {
timeout {puts "TESTING ERROR 1.1 Projects\n";exit}
"Projects/_firejail_test_dir/a" {}
"Projects/_firejail_test_dir/b" {puts "TESTING ERROR 1.2 Projects\n";exit}
}
expect {
timeout {puts "TESTING ERROR 1.1 Videos\n";exit}
"Videos/_firejail_test_dir/a" {}
"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 2 Desktop\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Desktop\n";exit}
"Permission denied" {}
-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 2 Documents\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Documents\n";exit}
"Permission denied" {}
-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 2 Downloads\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Downloads\n";exit}
"Permission denied" {}
-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 2 Music\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Music\n";exit}
"Permission denied" {}
-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 2 Pictures\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Pictures\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 2.2 Pictures\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Projects/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 2 Projects\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Projects\n";exit}
"Permission denied" {}
-re {ret 0} {puts "TESTING ERROR 2.2 Projects\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-blacklist.profile ls ~/Videos/_firejail_test_dir; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 2 Videos\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 2.1 Videos\n";exit}
"Permission denied" {}
-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 3 Desktop\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Desktop\n";exit}
"Read-only file system" {}
-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 3 Documents\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Documents\n";exit}
"Read-only file system" {}
-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 3 Downloads\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Downloads\n";exit}
"Read-only file system" {}
-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 3 Music\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Music\n";exit}
"Read-only file system" {}
-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 3 Pictures\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Pictures\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 3.2 Pictures\n";exit}
}
after 100
send -- "firejail --profile=./macro-subpath-readonly.profile touch ~/Projects/_firejail_test_dir/_firejail_test_file; echo ret \$?\r"
expect {
timeout {puts "TESTING ERROR 3 Projects\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Projects\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 3.2 Projects\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 3 Videos\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
expect {
timeout {puts "TESTING ERROR 3.1 Videos\n";exit}
"Read-only file system" {}
-re {ret 0} {puts "TESTING ERROR 3.2 Videos\n";exit}
}
after 100
puts "\nall done\n"