mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
tests: rlimit: add missing tests for rlimit-as / rlimit-cpu (#6895)
This is a follow-up to #6893. Relates to #1604.
This commit is contained in:
parent
2dbd31618c
commit
aca3376a77
6 changed files with 49 additions and 14 deletions
1
test/environment/rlimit-bad-as.profile
Normal file
1
test/environment/rlimit-bad-as.profile
Normal file
|
|
@ -0,0 +1 @@
|
|||
rlimit-as -1234567890
|
||||
1
test/environment/rlimit-bad-cpu.profile
Normal file
1
test/environment/rlimit-bad-cpu.profile
Normal file
|
|
@ -0,0 +1 @@
|
|||
rlimit-cpu -100
|
||||
|
|
@ -7,29 +7,43 @@ set timeout 10
|
|||
spawn $env(SHELL)
|
||||
match_max 100000
|
||||
|
||||
send -- "firejail --profile=rlimit-bad-as.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 0\n";exit}
|
||||
"invalid rlimit-as:"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --profile=rlimit-bad-cpu.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1\n";exit}
|
||||
"invalid rlimit-cpu:"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --profile=rlimit-bad-fsize.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 4\n";exit}
|
||||
timeout {puts "TESTING ERROR 2\n";exit}
|
||||
"invalid rlimit-fsize:"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --profile=rlimit-bad-nofile.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 5\n";exit}
|
||||
timeout {puts "TESTING ERROR 3\n";exit}
|
||||
"invalid rlimit-nofile:"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --profile=rlimit-bad-nproc.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 6\n";exit}
|
||||
timeout {puts "TESTING ERROR 4\n";exit}
|
||||
"invalid rlimit-nproc:"
|
||||
}
|
||||
after 100
|
||||
send -- "firejail --profile=rlimit-bad-sigpending.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 7\n";exit}
|
||||
timeout {puts "TESTING ERROR 5\n";exit}
|
||||
"invalid rlimit-sigpending:"
|
||||
}
|
||||
after 100
|
||||
|
|
|
|||
|
|
@ -7,29 +7,43 @@ set timeout 10
|
|||
spawn $env(SHELL)
|
||||
match_max 100000
|
||||
|
||||
send -- "firejail --rlimit-fsize=-1024\r"
|
||||
send -- "firejail --rlimit-as=-1234567890\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 0\n";exit}
|
||||
"invalid rlimit-as: -1234567890"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --rlimit-cpu=-100\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1\n";exit}
|
||||
"invalid rlimit-cpu: -100"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --rlimit-fsize=-1024\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 2\n";exit}
|
||||
"invalid rlimit-fsize: -1024"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --rlimit-nofile=asdf\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1\n";exit}
|
||||
timeout {puts "TESTING ERROR 3\n";exit}
|
||||
"invalid rlimit-nofile: asdf"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "firejail --rlimit-nproc=100.23\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 2\n";exit}
|
||||
timeout {puts "TESTING ERROR 4\n";exit}
|
||||
"invalid rlimit-nproc: 100.23"
|
||||
}
|
||||
after 100
|
||||
send -- "firejail --rlimit-sigpending=2345-78\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 3\n";exit}
|
||||
timeout {puts "TESTING ERROR 5\n";exit}
|
||||
"invalid rlimit-sigpending: 2345-78"
|
||||
}
|
||||
after 100
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ cd /home
|
|||
spawn $env(SHELL)
|
||||
match_max 100000
|
||||
|
||||
send -- "firejail --rlimit-as=1234567890 --rlimit-fsize=1024 --rlimit-nproc=1000 --rlimit-nofile=500 --rlimit-sigpending=200\r"
|
||||
send -- "firejail --rlimit-as=1234567890 --rlimit-cpu=100 --rlimit-fsize=1024 --rlimit-nproc=1000 --rlimit-nofile=500 --rlimit-sigpending=200\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 0\n";exit}
|
||||
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
|
||||
|
|
@ -18,26 +18,30 @@ sleep 1
|
|||
send -- "cat /proc/self/limits; pwd\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.1\n";exit}
|
||||
"Max file size 1024 1024"
|
||||
"Max cpu time 100 100"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.2\n";exit}
|
||||
"Max processes 1000 1000"
|
||||
"Max file size 1024 1024"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.3\n";exit}
|
||||
"Max open files 500 500"
|
||||
"Max processes 1000 1000"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.4\n";exit}
|
||||
"Max address space 1234567890 1234567890"
|
||||
"Max open files 500 500"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.5\n";exit}
|
||||
"Max pending signals 200 200"
|
||||
"Max address space 1234567890 1234567890"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.6\n";exit}
|
||||
"Max pending signals 200 200"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1.7\n";exit}
|
||||
"home"
|
||||
}
|
||||
after 100
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
rlimit-as 1234567890
|
||||
rlimit-cpu 100
|
||||
rlimit-fsize 1024
|
||||
rlimit-nofile 500
|
||||
rlimit-nproc 1000
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue