From 921c9cc153174434c6464498274ae0ae9ca51efd Mon Sep 17 00:00:00 2001 From: smitsohu Date: Wed, 22 Sep 2021 20:12:58 +0200 Subject: join: add support for rlimit options --- test/environment/environment.sh | 7 +++++-- test/environment/rlimit-join.exp | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100755 test/environment/rlimit-join.exp (limited to 'test/environment') diff --git a/test/environment/environment.sh b/test/environment/environment.sh index 152975c9d..1e1dd549b 100755 --- a/test/environment/environment.sh +++ b/test/environment/environment.sh @@ -112,14 +112,17 @@ echo "TESTING: rlimit (test/environment/rlimit.exp)" echo "TESTING: rlimit profile (test/environment/rlimit-profile.exp)" ./rlimit-profile.exp +echo "TESTING: rlimit join (test/environment/rlimit-join.exp)" +./rlimit-join.exp + echo "TESTING: rlimit errors (test/environment/rlimit-bad.exp)" ./rlimit-bad.exp echo "TESTING: rlimit errors profile (test/environment/rlimit-bad-profile.exp)" ./rlimit-bad-profile.exp -echo "TESTING: deterministic exit code (test/environment/deterministic-exit-code.exp" +echo "TESTING: deterministic exit code (test/environment/deterministic-exit-code.exp)" ./deterministic-exit-code.exp -echo "TESTING: retain umask (test/environment/umask.exp" +echo "TESTING: retain umask (test/environment/umask.exp)" (umask 123 && ./umask.exp) diff --git a/test/environment/rlimit-join.exp b/test/environment/rlimit-join.exp new file mode 100755 index 000000000..aa8a203c0 --- /dev/null +++ b/test/environment/rlimit-join.exp @@ -0,0 +1,36 @@ +#!/usr/bin/expect -f +# This file is part of Firejail project +# Copyright (C) 2014-2021 Firejail Authors +# License GPL v2 + +set timeout 10 +cd /home +spawn $env(SHELL) +match_max 100000 + +send -- "firejail --noprofile --name=\"rlimit testing\"\r" +expect { + timeout {puts "TESTING ERROR 0\n";exit} + "Child process initialized" +} +sleep 1 + +spawn $env(SHELL) +send -- "firejail --rlimit-nofile=1234 --join=\"rlimit testing\"\r" +expect { + timeout {puts "TESTING ERROR 1\n";exit} + "Switching to pid" +} +sleep 1 + +send -- "cat /proc/self/limits\r" +expect { + timeout {puts "TESTING ERROR 2\n";exit} + "Max open files 1234 1234" +} +after 100 + +send -- "exit\r" +after 100 + +puts "\nall done\n" -- cgit v1.2.3-54-g00ecf