diff options
author | 2018-09-27 08:21:15 -0400 | |
---|---|---|
committer | 2018-09-27 08:21:15 -0400 | |
commit | 74f0de5299ede5567ba8aa3e34f006feee7d57aa (patch) | |
tree | 1a2cbc8df55e6ad858c5f3cd18d74e0463955f3f /test | |
parent | mainline merge: fix apparmor profile path (diff) | |
download | firejail-74f0de5299ede5567ba8aa3e34f006feee7d57aa.tar.gz firejail-74f0de5299ede5567ba8aa3e34f006feee7d57aa.tar.zst firejail-74f0de5299ede5567ba8aa3e34f006feee7d57aa.zip |
fixed test-arguments
Diffstat (limited to 'test')
-rw-r--r-- | test/arguments/args.c | 12 | ||||
-rwxr-xr-x | test/arguments/arguments.sh | 12 | ||||
-rwxr-xr-x | test/arguments/bashrun.sh | 12 | ||||
-rwxr-xr-x | test/arguments/joinrun.sh | 12 | ||||
-rwxr-xr-x | test/arguments/outrun.exp | 90 | ||||
-rwxr-xr-x | test/arguments/symrun.sh | 14 |
6 files changed, 38 insertions, 114 deletions
diff --git a/test/arguments/args.c b/test/arguments/args.c new file mode 100644 index 000000000..941850767 --- /dev/null +++ b/test/arguments/args.c | |||
@@ -0,0 +1,12 @@ | |||
1 | #include <stdio.h> | ||
2 | |||
3 | int main(int argc, char **argv) { | ||
4 | printf("Arguments:\n"); | ||
5 | |||
6 | int i; | ||
7 | for (i = 0; i < argc; i++) { | ||
8 | printf("#%s#\n", argv[i]); | ||
9 | } | ||
10 | |||
11 | return 0; | ||
12 | } | ||
diff --git a/test/arguments/arguments.sh b/test/arguments/arguments.sh index c3505c188..cbef6459f 100755 --- a/test/arguments/arguments.sh +++ b/test/arguments/arguments.sh | |||
@@ -1,10 +1,10 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | if [ -f /etc/debian_version ]; then | 3 | export MALLOC_CHECK_=3 |
4 | libdir=$(dirname "$(dpkg -L firejail | grep faudit)") | 4 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) |
5 | export PATH="$PATH:$libdir" | 5 | |
6 | fi | 6 | rm -f ./args |
7 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" | 7 | gcc -o args args.c |
8 | 8 | ||
9 | echo "TESTING: 1. regular bash session" | 9 | echo "TESTING: 1. regular bash session" |
10 | ./bashrun.exp | 10 | ./bashrun.exp |
@@ -18,3 +18,5 @@ sleep 1 | |||
18 | echo "TESTING: 3. --join option" | 18 | echo "TESTING: 3. --join option" |
19 | ./joinrun.exp | 19 | ./joinrun.exp |
20 | sleep 1 | 20 | sleep 1 |
21 | |||
22 | rm ./args | ||
diff --git a/test/arguments/bashrun.sh b/test/arguments/bashrun.sh index a4773fd6c..8128ae37d 100755 --- a/test/arguments/bashrun.sh +++ b/test/arguments/bashrun.sh | |||
@@ -1,22 +1,22 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | echo "TESTING: 1.1 - simple args" | 3 | echo "TESTING: 1.1 - simple args" |
4 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1 arg2 | 4 | firejail --quiet ./args arg1 arg2 |
5 | 5 | ||
6 | # simple quotes, testing spaces in file names | 6 | # simple quotes, testing spaces in file names |
7 | echo "TESTING: 1.2 - args with space and \"" | 7 | echo "TESTING: 1.2 - args with space and \"" |
8 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1 tail" "arg2 tail" | 8 | firejail --quiet ./args "arg1 tail" "arg2 tail" |
9 | 9 | ||
10 | echo "TESTING: 1.3 - args with space and '" | 10 | echo "TESTING: 1.3 - args with space and '" |
11 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1 tail' 'arg2 tail' | 11 | firejail --quiet ./args 'arg1 tail' 'arg2 tail' |
12 | 12 | ||
13 | # escaped space in file names | 13 | # escaped space in file names |
14 | echo "TESTING: 1.4 - args with space and \\" | 14 | echo "TESTING: 1.4 - args with space and \\" |
15 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1\ tail arg2\ tail | 15 | firejail --quiet ./args arg1\ tail arg2\ tail |
16 | 16 | ||
17 | # & char appears in URLs - URLs should be quoted | 17 | # & char appears in URLs - URLs should be quoted |
18 | echo "TESTING: 1.5 - args with & and \"" | 18 | echo "TESTING: 1.5 - args with & and \"" |
19 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1&tail" "arg2&tail" | 19 | firejail --quiet ./args "arg1&tail" "arg2&tail" |
20 | 20 | ||
21 | echo "TESTING: 1.6 - args with & and '" | 21 | echo "TESTING: 1.6 - args with & and '" |
22 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1&tail' 'arg2&tail' | 22 | firejail --quiet ./args 'arg1&tail' 'arg2&tail' |
diff --git a/test/arguments/joinrun.sh b/test/arguments/joinrun.sh index b00ea0e80..12bd543c0 100755 --- a/test/arguments/joinrun.sh +++ b/test/arguments/joinrun.sh | |||
@@ -1,22 +1,22 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | echo "TESTING: 3.1 - simple args" | 3 | echo "TESTING: 3.1 - simple args" |
4 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit arg1 arg2 | 4 | firejail --join=joinrun ./args arg1 arg2 |
5 | 5 | ||
6 | # simple quotes, testing spaces in file names | 6 | # simple quotes, testing spaces in file names |
7 | echo "TESTING: 3.2 - args with space and \"" | 7 | echo "TESTING: 3.2 - args with space and \"" |
8 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit "arg1 tail" "arg2 tail" | 8 | firejail --join=joinrun ./args "arg1 tail" "arg2 tail" |
9 | 9 | ||
10 | echo "TESTING: 3.3 - args with space and '" | 10 | echo "TESTING: 3.3 - args with space and '" |
11 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit 'arg1 tail' 'arg2 tail' | 11 | firejail --join=joinrun ./args 'arg1 tail' 'arg2 tail' |
12 | 12 | ||
13 | # escaped space in file names | 13 | # escaped space in file names |
14 | echo "TESTING: 3.4 - args with space and \\" | 14 | echo "TESTING: 3.4 - args with space and \\" |
15 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit arg1\ tail arg2\ tail | 15 | firejail --join=joinrun ./args arg1\ tail arg2\ tail |
16 | 16 | ||
17 | # & char appears in URLs - URLs should be quoted | 17 | # & char appears in URLs - URLs should be quoted |
18 | echo "TESTING: 3.5 - args with & and \"" | 18 | echo "TESTING: 3.5 - args with & and \"" |
19 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit "arg1&tail" "arg2&tail" | 19 | firejail --join=joinrun ./args "arg1&tail" "arg2&tail" |
20 | 20 | ||
21 | echo "TESTING: 3.6 - args with & and '" | 21 | echo "TESTING: 3.6 - args with & and '" |
22 | firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit 'arg1&tail' 'arg2&tail' | 22 | firejail --join=joinrun ./args 'arg1&tail' 'arg2&tail' |
diff --git a/test/arguments/outrun.exp b/test/arguments/outrun.exp deleted file mode 100755 index d28e75661..000000000 --- a/test/arguments/outrun.exp +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | send -- "./outrun.sh\r" | ||
8 | expect { | ||
9 | timeout {puts "TESTING ERROR 4.1.1\n";exit} | ||
10 | "Arguments:" | ||
11 | } | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 4.1.2\n";exit} | ||
14 | "#arg1#" | ||
15 | } | ||
16 | expect { | ||
17 | timeout {puts "TESTING ERROR 4.1.3\n";exit} | ||
18 | "#arg2#" | ||
19 | } | ||
20 | |||
21 | exit | ||
22 | #*************************************************** | ||
23 | # breaking down from here on - bug to fix | ||
24 | #*************************************************** | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 4.2.1\n";exit} | ||
27 | "Arguments:" | ||
28 | } | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 4.2.2\n";exit} | ||
31 | "#arg1 tail#" | ||
32 | } | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 4.2.3\n";exit} | ||
35 | "#arg2 tail#" | ||
36 | } | ||
37 | |||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 4.3.1\n";exit} | ||
40 | "Arguments:" | ||
41 | } | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 4.3.2\n";exit} | ||
44 | "#arg1 tail#" | ||
45 | } | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 4.3.3\n";exit} | ||
48 | "#arg2 tail#" | ||
49 | } | ||
50 | |||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 4.4.1\n";exit} | ||
53 | "Arguments:" | ||
54 | } | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 4.4.2\n";exit} | ||
57 | "#arg1 tail#" | ||
58 | } | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 4.4.3\n";exit} | ||
61 | "#arg2 tail#" | ||
62 | } | ||
63 | |||
64 | expect { | ||
65 | timeout {puts "TESTING ERROR 4.5.1\n";exit} | ||
66 | "Arguments:" | ||
67 | } | ||
68 | expect { | ||
69 | timeout {puts "TESTING ERROR 4.5.2\n";exit} | ||
70 | "#arg1&tail#" | ||
71 | } | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 4.5.3\n";exit} | ||
74 | "#arg2&tail#" | ||
75 | } | ||
76 | |||
77 | expect { | ||
78 | timeout {puts "TESTING ERROR 4.6.1\n";exit} | ||
79 | "Arguments:" | ||
80 | } | ||
81 | expect { | ||
82 | timeout {puts "TESTING ERROR 4.6.2\n";exit} | ||
83 | "#arg1&tail#" | ||
84 | } | ||
85 | expect { | ||
86 | timeout {puts "TESTING ERROR 4.6.3\n";exit} | ||
87 | "#arg2&tail#" | ||
88 | } | ||
89 | |||
90 | puts "\nall done\n" | ||
diff --git a/test/arguments/symrun.sh b/test/arguments/symrun.sh index db5f06835..b3932bf24 100755 --- a/test/arguments/symrun.sh +++ b/test/arguments/symrun.sh | |||
@@ -1,31 +1,31 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | mkdir symtest | 3 | mkdir symtest |
4 | ln -s /usr/bin/firejail symtest/faudit | 4 | ln -s /usr/bin/firejail symtest/firejail |
5 | 5 | ||
6 | # search for faudit in current directory | 6 | # search for faudit in current directory |
7 | export PATH=$PATH:. | 7 | export PATH=$PATH:. |
8 | export FIREJAIL_TEST_ARGUMENTS=yes | 8 | export FIREJAIL_TEST_ARGUMENTS=yes |
9 | 9 | ||
10 | echo "TESTING: 2.1 - simple args" | 10 | echo "TESTING: 2.1 - simple args" |
11 | symtest/faudit arg1 arg2 | 11 | symtest/firejail ./args arg1 arg2 |
12 | 12 | ||
13 | # simple quotes, testing spaces in file names | 13 | # simple quotes, testing spaces in file names |
14 | echo "TESTING: 2.2 - args with space and \"" | 14 | echo "TESTING: 2.2 - args with space and \"" |
15 | symtest/faudit "arg1 tail" "arg2 tail" | 15 | symtest/firejail ./args "arg1 tail" "arg2 tail" |
16 | 16 | ||
17 | echo "TESTING: 2.3 - args with space and '" | 17 | echo "TESTING: 2.3 - args with space and '" |
18 | symtest/faudit 'arg1 tail' 'arg2 tail' | 18 | symtest/firejail ./args 'arg1 tail' 'arg2 tail' |
19 | 19 | ||
20 | # escaped space in file names | 20 | # escaped space in file names |
21 | echo "TESTING: 2.4 - args with space and \\" | 21 | echo "TESTING: 2.4 - args with space and \\" |
22 | symtest/faudit arg1\ tail arg2\ tail | 22 | symtest/firejail ./args arg1\ tail arg2\ tail |
23 | 23 | ||
24 | # & char appears in URLs - URLs should be quoted | 24 | # & char appears in URLs - URLs should be quoted |
25 | echo "TESTING: 2.5 - args with & and \"" | 25 | echo "TESTING: 2.5 - args with & and \"" |
26 | symtest/faudit "arg1&tail" "arg2&tail" | 26 | symtest/firejail ./args "arg1&tail" "arg2&tail" |
27 | 27 | ||
28 | echo "TESTING: 2.6 - args with & and '" | 28 | echo "TESTING: 2.6 - args with & and '" |
29 | symtest/faudit 'arg1&tail' 'arg2&tail' | 29 | symtest/firejail ./args 'arg1&tail' 'arg2&tail' |
30 | 30 | ||
31 | rm -fr symtest | 31 | rm -fr symtest |