aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in5
-rw-r--r--src/faudit/main.c13
-rw-r--r--test/arguments/Makefile13
-rwxr-xr-xtest/arguments/arguments.sh4
-rwxr-xr-xtest/arguments/bashrun.sh12
-rwxr-xr-xtest/arguments/joinrun.sh12
-rw-r--r--test/arguments/main.c31
-rwxr-xr-xtest/arguments/outrun.sh12
-rw-r--r--test/arguments/readme9
9 files changed, 39 insertions, 72 deletions
diff --git a/Makefile.in b/Makefile.in
index 1861fb7ca..d93eee502 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -215,13 +215,16 @@ test-environment:
215test-filters: 215test-filters:
216 cd test/filters; ./filters.sh | grep TESTING 216 cd test/filters; ./filters.sh | grep TESTING
217 217
218test-arguments:
219 cd test/arguments; ./arguments.sh | grep TESTING
220
218test-network: 221test-network:
219 echo "Please read test/network/README file and run the test manually" 222 echo "Please read test/network/README file and run the test manually"
220 223
221test-fs: 224test-fs:
222 cd test/fs; ./fs.sh | grep TESTING 225 cd test/fs; ./fs.sh | grep TESTING
223 226
224test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters 227test: test-profiles test-fs test-utils test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments
225 echo "TEST COMPLETE" 228 echo "TEST COMPLETE"
226 229
227gcov:; 230gcov:;
diff --git a/src/faudit/main.c b/src/faudit/main.c
index 61005945d..7f47ccaf0 100644
--- a/src/faudit/main.c
+++ b/src/faudit/main.c
@@ -21,6 +21,19 @@
21char *prog; 21char *prog;
22 22
23int main(int argc, char **argv) { 23int main(int argc, char **argv) {
24 // make test-arguments helper
25 if (getenv("FIREJAIL_TEST_ARGUMENTS")) {
26 printf("Arguments:\n");
27
28 int i;
29 for (i = 0; i < argc; i++) {
30 printf("#%s#\n", argv[i]);
31 }
32
33 return 0;
34 }
35
36
24 if (argc != 1) { 37 if (argc != 1) {
25 int i; 38 int i;
26 39
diff --git a/test/arguments/Makefile b/test/arguments/Makefile
deleted file mode 100644
index 3ccab3702..000000000
--- a/test/arguments/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
1all: argtest
2
3argtest: main.c
4 gcc -o argtest main.c
5
6clean:; rm -f argtest; rm -fr symtest; rm -f out out.*
7
8install:;install -c -m 0755 argtest /usr/local/bin/argtest
9
10uninstall:; rm -f /usr/local/bin/argtest
11
12
13test:; ./arguments.sh | grep TESTING
diff --git a/test/arguments/arguments.sh b/test/arguments/arguments.sh
index 2f53eb3fa..db4c9b472 100755
--- a/test/arguments/arguments.sh
+++ b/test/arguments/arguments.sh
@@ -4,12 +4,16 @@
4 4
5echo "TESTING: 1. regular bash session" 5echo "TESTING: 1. regular bash session"
6./bashrun.exp 6./bashrun.exp
7sleep 1
7 8
8echo "TESTING: 2. symbolic link to firejail" 9echo "TESTING: 2. symbolic link to firejail"
9./symrun.exp 10./symrun.exp
11rm -fr symtest
12sleep 1
10 13
11echo "TESTING: 3. --join option" 14echo "TESTING: 3. --join option"
12./joinrun.exp 15./joinrun.exp
16sleep 1
13 17
14echo "TESTING: 4. --output option" 18echo "TESTING: 4. --output option"
15./outrun.exp 19./outrun.exp
diff --git a/test/arguments/bashrun.sh b/test/arguments/bashrun.sh
index c2f209548..0797c92c2 100755
--- a/test/arguments/bashrun.sh
+++ b/test/arguments/bashrun.sh
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "TESTING: 1.1 - simple args" 3echo "TESTING: 1.1 - simple args"
4firejail --quiet ./argtest arg1 arg2 4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit arg1 arg2
5 5
6# simple quotes, testing spaces in file names 6# simple quotes, testing spaces in file names
7echo "TESTING: 1.2 - args with space and \"" 7echo "TESTING: 1.2 - args with space and \""
8firejail --quiet ./argtest "arg1 tail" "arg2 tail" 8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 1.3 - args with space and '" 10echo "TESTING: 1.3 - args with space and '"
11firejail --quiet ./argtest 'arg1 tail' 'arg2 tail' 11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1 tail' 'arg2 tail'
12 12
13# escaped space in file names 13# escaped space in file names
14echo "TESTING: 1.4 - args with space and \\" 14echo "TESTING: 1.4 - args with space and \\"
15firejail --quiet ./argtest arg1\ tail arg2\ tail 15firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit arg1\ tail arg2\ tail
16 16
17# & char appears in URLs - URLs should be quoted 17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 1.5 - args with & and \"" 18echo "TESTING: 1.5 - args with & and \""
19firejail --quiet ./argtest "arg1&tail" "arg2&tail" 19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 1.6 - args with & and '" 21echo "TESTING: 1.6 - args with & and '"
22firejail --quiet ./argtest 'arg1&tail' 'arg2&tail' 22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/arguments/joinrun.sh b/test/arguments/joinrun.sh
index f6c2b2e22..2743d823e 100755
--- a/test/arguments/joinrun.sh
+++ b/test/arguments/joinrun.sh
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "TESTING: 3.1 - simple args" 3echo "TESTING: 3.1 - simple args"
4firejail --join=joinrun ./argtest arg1 arg2 4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun /usr/lib/firejail/faudit arg1 arg2
5 5
6# simple quotes, testing spaces in file names 6# simple quotes, testing spaces in file names
7echo "TESTING: 3.2 - args with space and \"" 7echo "TESTING: 3.2 - args with space and \""
8firejail --quiet ./argtest "arg1 tail" "arg2 tail" 8firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 3.3 - args with space and '" 10echo "TESTING: 3.3 - args with space and '"
11firejail --quiet ./argtest 'arg1 tail' 'arg2 tail' 11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1 tail' 'arg2 tail'
12 12
13# escaped space in file names 13# escaped space in file names
14echo "TESTING: 3.4 - args with space and \\" 14echo "TESTING: 3.4 - args with space and \\"
15firejail --quiet ./argtest arg1\ tail arg2\ tail 15firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit arg1\ tail arg2\ tail
16 16
17# & char appears in URLs - URLs should be quoted 17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 3.5 - args with & and \"" 18echo "TESTING: 3.5 - args with & and \""
19firejail --quiet ./argtest "arg1&tail" "arg2&tail" 19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 3.6 - args with & and '" 21echo "TESTING: 3.6 - args with & and '"
22firejail --quiet ./argtest 'arg1&tail' 'arg2&tail' 22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet /usr/lib/firejail/faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/arguments/main.c b/test/arguments/main.c
deleted file mode 100644
index 75bdca715..000000000
--- a/test/arguments/main.c
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2014-2016 Firejail Authors
3 *
4 * This file is part of firejail project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20#include <stdio.h>
21
22int main(int argc, char **argv) {
23 printf("Arguments:\n");
24
25 int i;
26 for (i = 0; i < argc; i++) {
27 printf("#%s#\n", argv[i]);
28 }
29
30 return 0;
31}
diff --git a/test/arguments/outrun.sh b/test/arguments/outrun.sh
index cfd8e684c..a21243873 100755
--- a/test/arguments/outrun.sh
+++ b/test/arguments/outrun.sh
@@ -1,22 +1,22 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "TESTING: 4.1 - simple args" 3echo "TESTING: 4.1 - simple args"
4firejail --output=out ./argtest arg1 arg2 4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit arg1 arg2
5 5
6# simple quotes, testing spaces in file names 6# simple quotes, testing spaces in file names
7echo "TESTING: 4.2 - args with space and \"" 7echo "TESTING: 4.2 - args with space and \""
8firejail --output=out ./argtest "arg1 tail" "arg2 tail" 8firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 4.3 - args with space and '" 10echo "TESTING: 4.3 - args with space and '"
11firejail --output=out ./argtest 'arg1 tail' 'arg2 tail' 11firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit 'arg1 tail' 'arg2 tail'
12 12
13# escaped space in file names 13# escaped space in file names
14echo "TESTING: 4.4 - args with space and \\" 14echo "TESTING: 4.4 - args with space and \\"
15firejail --output=out ./argtest arg1\ tail arg2\ tail 15firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit arg1\ tail arg2\ tail
16 16
17# & char appears in URLs - URLs should be quoted 17# & char appears in URLs - URLs should be quoted
18echo "TESTING: 4.5 - args with & and \"" 18echo "TESTING: 4.5 - args with & and \""
19firejail --output=out ./argtest "arg1&tail" "arg2&tail" 19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 4.6 - args with & and '" 21echo "TESTING: 4.6 - args with & and '"
22firejail --output=out ./argtest 'arg1&tail' 'arg2&tail' 22firejail--env=FIREJAIL_TEST_ARGUMENTS=yes --output=out /usr/lib/firejail/faudit 'arg1&tail' 'arg2&tail'
diff --git a/test/arguments/readme b/test/arguments/readme
deleted file mode 100644
index c28461478..000000000
--- a/test/arguments/readme
+++ /dev/null
@@ -1,9 +0,0 @@
1Argument testing fremework for Firejail.
2
3A small test program, argtest, is compiled and installed in /usr/local/bin directory.
4Run "make && sudo make install" to install it.
5
6Run "make test" to run the tests.
7
8Run "sudo make uninstall" to remove the test program.
9