aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar startx2017 <vradu.startx@yandex.com>2018-09-27 08:21:15 -0400
committerLibravatar startx2017 <vradu.startx@yandex.com>2018-09-27 08:21:15 -0400
commit74f0de5299ede5567ba8aa3e34f006feee7d57aa (patch)
tree1a2cbc8df55e6ad858c5f3cd18d74e0463955f3f
parentmainline merge: fix apparmor profile path (diff)
downloadfirejail-74f0de5299ede5567ba8aa3e34f006feee7d57aa.tar.gz
firejail-74f0de5299ede5567ba8aa3e34f006feee7d57aa.tar.zst
firejail-74f0de5299ede5567ba8aa3e34f006feee7d57aa.zip
fixed test-arguments
-rw-r--r--test/arguments/args.c12
-rwxr-xr-xtest/arguments/arguments.sh12
-rwxr-xr-xtest/arguments/bashrun.sh12
-rwxr-xr-xtest/arguments/joinrun.sh12
-rwxr-xr-xtest/arguments/outrun.exp90
-rwxr-xr-xtest/arguments/symrun.sh14
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
3int 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
3if [ -f /etc/debian_version ]; then 3export MALLOC_CHECK_=3
4 libdir=$(dirname "$(dpkg -L firejail | grep faudit)") 4export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
5 export PATH="$PATH:$libdir" 5
6fi 6rm -f ./args
7export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" 7gcc -o args args.c
8 8
9echo "TESTING: 1. regular bash session" 9echo "TESTING: 1. regular bash session"
10./bashrun.exp 10./bashrun.exp
@@ -18,3 +18,5 @@ sleep 1
18echo "TESTING: 3. --join option" 18echo "TESTING: 3. --join option"
19./joinrun.exp 19./joinrun.exp
20sleep 1 20sleep 1
21
22rm ./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
3echo "TESTING: 1.1 - simple args" 3echo "TESTING: 1.1 - simple args"
4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1 arg2 4firejail --quiet ./args 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 --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1 tail" "arg2 tail" 8firejail --quiet ./args "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 1.3 - args with space and '" 10echo "TESTING: 1.3 - args with space and '"
11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1 tail' 'arg2 tail' 11firejail --quiet ./args '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 --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit arg1\ tail arg2\ tail 15firejail --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
18echo "TESTING: 1.5 - args with & and \"" 18echo "TESTING: 1.5 - args with & and \""
19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit "arg1&tail" "arg2&tail" 19firejail --quiet ./args "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 1.6 - args with & and '" 21echo "TESTING: 1.6 - args with & and '"
22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --quiet faudit 'arg1&tail' 'arg2&tail' 22firejail --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
3echo "TESTING: 3.1 - simple args" 3echo "TESTING: 3.1 - simple args"
4firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit arg1 arg2 4firejail --join=joinrun ./args 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 --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit "arg1 tail" "arg2 tail" 8firejail --join=joinrun ./args "arg1 tail" "arg2 tail"
9 9
10echo "TESTING: 3.3 - args with space and '" 10echo "TESTING: 3.3 - args with space and '"
11firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit 'arg1 tail' 'arg2 tail' 11firejail --join=joinrun ./args '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 --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit arg1\ tail arg2\ tail 15firejail --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
18echo "TESTING: 3.5 - args with & and \"" 18echo "TESTING: 3.5 - args with & and \""
19firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit "arg1&tail" "arg2&tail" 19firejail --join=joinrun ./args "arg1&tail" "arg2&tail"
20 20
21echo "TESTING: 3.6 - args with & and '" 21echo "TESTING: 3.6 - args with & and '"
22firejail --env=FIREJAIL_TEST_ARGUMENTS=yes --join=joinrun faudit 'arg1&tail' 'arg2&tail' 22firejail --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
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "./outrun.sh\r"
8expect {
9 timeout {puts "TESTING ERROR 4.1.1\n";exit}
10 "Arguments:"
11}
12expect {
13 timeout {puts "TESTING ERROR 4.1.2\n";exit}
14 "#arg1#"
15}
16expect {
17 timeout {puts "TESTING ERROR 4.1.3\n";exit}
18 "#arg2#"
19}
20
21exit
22#***************************************************
23# breaking down from here on - bug to fix
24#***************************************************
25expect {
26 timeout {puts "TESTING ERROR 4.2.1\n";exit}
27 "Arguments:"
28}
29expect {
30 timeout {puts "TESTING ERROR 4.2.2\n";exit}
31 "#arg1 tail#"
32}
33expect {
34 timeout {puts "TESTING ERROR 4.2.3\n";exit}
35 "#arg2 tail#"
36}
37
38expect {
39 timeout {puts "TESTING ERROR 4.3.1\n";exit}
40 "Arguments:"
41}
42expect {
43 timeout {puts "TESTING ERROR 4.3.2\n";exit}
44 "#arg1 tail#"
45}
46expect {
47 timeout {puts "TESTING ERROR 4.3.3\n";exit}
48 "#arg2 tail#"
49}
50
51expect {
52 timeout {puts "TESTING ERROR 4.4.1\n";exit}
53 "Arguments:"
54}
55expect {
56 timeout {puts "TESTING ERROR 4.4.2\n";exit}
57 "#arg1 tail#"
58}
59expect {
60 timeout {puts "TESTING ERROR 4.4.3\n";exit}
61 "#arg2 tail#"
62}
63
64expect {
65 timeout {puts "TESTING ERROR 4.5.1\n";exit}
66 "Arguments:"
67}
68expect {
69 timeout {puts "TESTING ERROR 4.5.2\n";exit}
70 "#arg1&tail#"
71}
72expect {
73 timeout {puts "TESTING ERROR 4.5.3\n";exit}
74 "#arg2&tail#"
75}
76
77expect {
78 timeout {puts "TESTING ERROR 4.6.1\n";exit}
79 "Arguments:"
80}
81expect {
82 timeout {puts "TESTING ERROR 4.6.2\n";exit}
83 "#arg1&tail#"
84}
85expect {
86 timeout {puts "TESTING ERROR 4.6.3\n";exit}
87 "#arg2&tail#"
88}
89
90puts "\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
3mkdir symtest 3mkdir symtest
4ln -s /usr/bin/firejail symtest/faudit 4ln -s /usr/bin/firejail symtest/firejail
5 5
6# search for faudit in current directory 6# search for faudit in current directory
7export PATH=$PATH:. 7export PATH=$PATH:.
8export FIREJAIL_TEST_ARGUMENTS=yes 8export FIREJAIL_TEST_ARGUMENTS=yes
9 9
10echo "TESTING: 2.1 - simple args" 10echo "TESTING: 2.1 - simple args"
11symtest/faudit arg1 arg2 11symtest/firejail ./args arg1 arg2
12 12
13# simple quotes, testing spaces in file names 13# simple quotes, testing spaces in file names
14echo "TESTING: 2.2 - args with space and \"" 14echo "TESTING: 2.2 - args with space and \""
15symtest/faudit "arg1 tail" "arg2 tail" 15symtest/firejail ./args "arg1 tail" "arg2 tail"
16 16
17echo "TESTING: 2.3 - args with space and '" 17echo "TESTING: 2.3 - args with space and '"
18symtest/faudit 'arg1 tail' 'arg2 tail' 18symtest/firejail ./args 'arg1 tail' 'arg2 tail'
19 19
20# escaped space in file names 20# escaped space in file names
21echo "TESTING: 2.4 - args with space and \\" 21echo "TESTING: 2.4 - args with space and \\"
22symtest/faudit arg1\ tail arg2\ tail 22symtest/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
25echo "TESTING: 2.5 - args with & and \"" 25echo "TESTING: 2.5 - args with & and \""
26symtest/faudit "arg1&tail" "arg2&tail" 26symtest/firejail ./args "arg1&tail" "arg2&tail"
27 27
28echo "TESTING: 2.6 - args with & and '" 28echo "TESTING: 2.6 - args with & and '"
29symtest/faudit 'arg1&tail' 'arg2&tail' 29symtest/firejail ./args 'arg1&tail' 'arg2&tail'
30 30
31rm -fr symtest 31rm -fr symtest