aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2023-01-31 11:15:21 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2023-01-31 11:15:21 -0500
commit1e6116cf15d03745b2f1d8667b8c06a3fe1cce3d (patch)
tree3aff0e9f825566778831719ad3a5512279801def
parentmerges (diff)
downloadfirejail-1e6116cf15d03745b2f1d8667b8c06a3fe1cce3d.tar.gz
firejail-1e6116cf15d03745b2f1d8667b8c06a3fe1cce3d.tar.zst
firejail-1e6116cf15d03745b2f1d8667b8c06a3fe1cce3d.zip
testing sysutils
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--Makefile2
-rwxr-xr-xtest/sysutils/curl.exp34
-rwxr-xr-xtest/sysutils/less.exp9
-rwxr-xr-xtest/sysutils/man.exp4
-rwxr-xr-xtest/sysutils/sysutils.sh31
-rwxr-xr-xtest/sysutils/wget.exp34
7 files changed, 101 insertions, 15 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index deebbe69f..a4dd7097d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -69,5 +69,7 @@ jobs:
69 run: sudo make install 69 run: sudo make install
70 - name: print version 70 - name: print version
71 run: command -V firejail && firejail --version 71 run: command -V firejail && firejail --version
72 - name: run sysutils tests
73 run: SHELL=/bin/bash make test-sysutils
72 - name: run tests 74 - name: run tests
73 run: SHELL=/bin/bash make test-github 75 run: SHELL=/bin/bash make test-github
diff --git a/Makefile b/Makefile
index 443c3183f..7def8d940 100644
--- a/Makefile
+++ b/Makefile
@@ -370,7 +370,7 @@ test-noprofiles: lab-setup test-fcopy test-fnetfilter test-fs test-utils test-sy
370 echo "TEST COMPLETE" 370 echo "TEST COMPLETE"
371 371
372 372
373test-github: lab-setup test-profiles test-fcopy test-fnetfilter test-fs test-utils test-sysutils test-environment 373test-github: lab-setup test-profiles test-fcopy test-fnetfilter test-fs test-utils test-environment
374 echo "TEST COMPLETE" 374 echo "TEST COMPLETE"
375 375
376########################################## 376##########################################
diff --git a/test/sysutils/curl.exp b/test/sysutils/curl.exp
new file mode 100755
index 000000000..29c9883a4
--- /dev/null
+++ b/test/sysutils/curl.exp
@@ -0,0 +1,34 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "rm index.html*\r"
11after 500
12
13send -- "firejail --ignore=quiet curl -s -o index.html debian.org\r"
14expect {
15 timeout {puts "TESTING ERROR 1\n";exit}
16 "Child process initialized"
17}
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "Parent is shutting down"
21}
22after 100
23
24send -- "ls -l index.html\r"
25expect {
26 timeout {puts "TESTING ERROR 3\n";exit}
27 "No such file or directory" {puts "TESTING ERROR 4\n";exit}
28 "rw"
29}
30after 100
31send -- "rm index.html*\r"
32after 500
33
34puts "\nall done\n"
diff --git a/test/sysutils/less.exp b/test/sysutils/less.exp
index 01a298fe0..7bbd76942 100755
--- a/test/sysutils/less.exp
+++ b/test/sysutils/less.exp
@@ -10,13 +10,14 @@ match_max 100000
10send -- "firejail less sysutils.sh\r" 10send -- "firejail less sysutils.sh\r"
11expect { 11expect {
12 timeout {puts "TESTING ERROR 1\n";exit} 12 timeout {puts "TESTING ERROR 1\n";exit}
13 "(press RETURN)" {puts "TESTING SKIP 1.1\n";exit} 13 "(press RETURN)" {puts "TESTING SKIP: terminal is not fully functional - 1.1\n";exit}
14 "Press RETURN to continue" {puts "TESTING SKIP 1.2\n";exit} 14 "Press RETURN to continue" {puts "TESTING SKIP: terminal is not fully functional - 1.2\n";exit}
15 "MALLOC_CHECK" 15 "Firejail Authors"
16} 16}
17expect { 17expect {
18 timeout {puts "TESTING ERROR 2\n";exit} 18 timeout {puts "TESTING ERROR 2\n";exit}
19 "./cpio.exp" 19 "MALLOC_CHECK"
20} 20}
21 21
22after 100
22puts "\nall done\n" 23puts "\nall done\n"
diff --git a/test/sysutils/man.exp b/test/sysutils/man.exp
index a263180b5..c569653c6 100755
--- a/test/sysutils/man.exp
+++ b/test/sysutils/man.exp
@@ -10,8 +10,8 @@ match_max 100000
10send -- "firejail man firejail\r" 10send -- "firejail man firejail\r"
11expect { 11expect {
12 timeout {puts "TESTING ERROR 0\n";exit} 12 timeout {puts "TESTING ERROR 0\n";exit}
13 "(press RETURN)" {puts "TESTING SKIP 1.1\n";exit} 13 "(press RETURN)" {puts "TESTING SKIP: terminal is not fully functional - 1.1\n";exit}
14 "Press RETURN to continue" {puts "TESTING SKIP 1.2\n";exit} 14 "Press RETURN to continue" {puts "TESTING SKIP: terminal is not fully functional - 1.2\n";exit}
15 "NAME" 15 "NAME"
16} 16}
17after 100 17after 100
diff --git a/test/sysutils/sysutils.sh b/test/sysutils/sysutils.sh
index a46cfb1ad..bab243c4b 100755
--- a/test/sysutils/sysutils.sh
+++ b/test/sysutils/sysutils.sh
@@ -15,14 +15,6 @@ else
15 echo "TESTING SKIP: cpio not found" 15 echo "TESTING SKIP: cpio not found"
16fi 16fi
17 17
18#if command -v strings
19#then
20# echo "TESTING: strings"
21# ./strings.exp
22#else
23# echo "TESTING SKIP: strings not found"
24#fi
25
26if command -v gzip 18if command -v gzip
27then 19then
28 echo "TESTING: gzip" 20 echo "TESTING: gzip"
@@ -111,4 +103,27 @@ else
111 echo "TESTING SKIP: man not found" 103 echo "TESTING SKIP: man not found"
112fi 104fi
113 105
106if command -v wget
107then
108 echo "TESTING: wget"
109 ./wget.exp
110else
111 echo "TESTING SKIP: wget not found"
112fi
113
114if command -v curl
115then
116 echo "TESTING: curl"
117 ./curl.exp
118else
119 echo "TESTING SKIP: curl not found"
120fi
121
122if command -v strings
123then
124 echo "TESTING: strings"
125 ./strings.exp
126else
127 echo "TESTING SKIP: strings not found"
128fi
114 129
diff --git a/test/sysutils/wget.exp b/test/sysutils/wget.exp
new file mode 100755
index 000000000..c6d2765c7
--- /dev/null
+++ b/test/sysutils/wget.exp
@@ -0,0 +1,34 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "rm index.html*\r"
11after 500
12
13send -- "firejail --ignore=quiet wget -q debian.org\r"
14expect {
15 timeout {puts "TESTING ERROR 1\n";exit}
16 "Child process initialized"
17}
18expect {
19 timeout {puts "TESTING ERROR 2\n";exit}
20 "Parent is shutting down"
21}
22after 100
23
24send -- "ls -l index.html\r"
25expect {
26 timeout {puts "TESTING ERROR 3\n";exit}
27 "No such file or directory" {puts "TESTING ERROR 4\n";exit}
28 "rw"
29}
30after 100
31send -- "rm index.html*\r"
32after 500
33
34puts "\nall done\n"