diff options
author | 2022-01-11 20:57:49 -0500 | |
---|---|---|
committer | 2022-01-11 20:57:49 -0500 | |
commit | f094521fe8d4eda1d5074aa14e2200f624adcdaf (patch) | |
tree | 793f262866412e93cdc64f8bee9d860898b1ab21 | |
parent | fix scan-build (diff) | |
download | firejail-f094521fe8d4eda1d5074aa14e2200f624adcdaf.tar.gz firejail-f094521fe8d4eda1d5074aa14e2200f624adcdaf.tar.zst firejail-f094521fe8d4eda1d5074aa14e2200f624adcdaf.zip |
fix fcopy testing
-rwxr-xr-x | test/fcopy/dircopy.exp | 14 | ||||
-rwxr-xr-x | test/fcopy/fcopy.sh | 7 | ||||
-rwxr-xr-x | test/fcopy/linkcopy.exp | 14 | ||||
-rwxr-xr-x | test/fcopy/src/dircopy.exp | 139 |
4 files changed, 29 insertions, 145 deletions
diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp index 0882561e5..a779f80cd 100755 --- a/test/fcopy/dircopy.exp +++ b/test/fcopy/dircopy.exp | |||
@@ -12,9 +12,21 @@ match_max 100000 | |||
12 | 12 | ||
13 | send -- "rm -fr dest/*\r" | 13 | send -- "rm -fr dest/*\r" |
14 | after 100 | 14 | after 100 |
15 | send -- "cd src\r" | ||
16 | after 100 | ||
17 | send -- "ln -s ../dircopy.exp dircopy.exp\r" | ||
18 | after 100 | ||
19 | send -- "cd ..\r" | ||
20 | after 100 | ||
15 | 21 | ||
16 | send -- "fcopy src dest\r" | 22 | send -- "fcopy src dest\r" |
17 | after 100 | 23 | after 100 |
24 | send -- "cd src\r" | ||
25 | after 100 | ||
26 | send -- "ln -s ../dircopy.exp dircopy.exp\r" | ||
27 | after 100 | ||
28 | send -- "cd ..\r" | ||
29 | after 100 | ||
18 | 30 | ||
19 | send -- "find dest\r" | 31 | send -- "find dest\r" |
20 | expect { | 32 | expect { |
@@ -135,5 +147,7 @@ expect { | |||
135 | 147 | ||
136 | send -- "rm -fr dest/*\r" | 148 | send -- "rm -fr dest/*\r" |
137 | after 100 | 149 | after 100 |
150 | send -- "rm -f src/dircopy.exp\r" | ||
151 | after 100 | ||
138 | 152 | ||
139 | puts "\nall done\n" | 153 | puts "\nall done\n" |
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh index cdfc424a3..fca599889 100755 --- a/test/fcopy/fcopy.sh +++ b/test/fcopy/fcopy.sh | |||
@@ -19,13 +19,14 @@ mkdir dest | |||
19 | echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)" | 19 | echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)" |
20 | ./cmdline.exp | 20 | ./cmdline.exp |
21 | 21 | ||
22 | echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)" | ||
23 | ./dircopy.exp | ||
24 | |||
25 | echo "TESTING: fcopy file (test/fcopy/filecopy.exp)" | 22 | echo "TESTING: fcopy file (test/fcopy/filecopy.exp)" |
26 | ./filecopy.exp | 23 | ./filecopy.exp |
27 | 24 | ||
28 | echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)" | 25 | echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)" |
29 | ./linkcopy.exp | 26 | ./linkcopy.exp |
30 | 27 | ||
28 | echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)" | ||
29 | ./dircopy.exp | ||
30 | |||
31 | rm -fr dest/* | 31 | rm -fr dest/* |
32 | rm -f src/dircopy.exp \ No newline at end of file | ||
diff --git a/test/fcopy/linkcopy.exp b/test/fcopy/linkcopy.exp index dd91ac26f..7c085e552 100755 --- a/test/fcopy/linkcopy.exp +++ b/test/fcopy/linkcopy.exp | |||
@@ -12,6 +12,12 @@ match_max 100000 | |||
12 | 12 | ||
13 | send -- "rm -fr dest/*\r" | 13 | send -- "rm -fr dest/*\r" |
14 | after 100 | 14 | after 100 |
15 | send -- "cd src\r" | ||
16 | after 100 | ||
17 | send -- "ln -s ../dircopy.exp dircopy.exp\r" | ||
18 | after 100 | ||
19 | send -- "cd ..\r" | ||
20 | after 100 | ||
15 | 21 | ||
16 | send -- "fcopy src/dircopy.exp dest\r" | 22 | send -- "fcopy src/dircopy.exp dest\r" |
17 | after 100 | 23 | after 100 |
@@ -19,7 +25,7 @@ after 100 | |||
19 | send -- "find dest\r" | 25 | send -- "find dest\r" |
20 | expect { | 26 | expect { |
21 | timeout {puts "TESTING ERROR 0\n";exit} | 27 | timeout {puts "TESTING ERROR 0\n";exit} |
22 | "dest/" | 28 | "dest" |
23 | } | 29 | } |
24 | expect { | 30 | expect { |
25 | timeout {puts "TESTING ERROR 1\n";exit} | 31 | timeout {puts "TESTING ERROR 1\n";exit} |
@@ -27,11 +33,11 @@ expect { | |||
27 | } | 33 | } |
28 | after 100 | 34 | after 100 |
29 | 35 | ||
30 | |||
31 | send -- "ls -al dest\r" | 36 | send -- "ls -al dest\r" |
32 | expect { | 37 | expect { |
33 | timeout {puts "TESTING ERROR 2\n";exit} | 38 | timeout {puts "TESTING ERROR 2\n";exit} |
34 | "lrwxrwxrwx" | 39 | "rwxr-xr-x" { puts "umask 0022\n" } |
40 | "rwxrwxr-x" { puts "umask 0002\n" } | ||
35 | } | 41 | } |
36 | after 100 | 42 | after 100 |
37 | send -- "stty -echo\r" | 43 | send -- "stty -echo\r" |
@@ -52,5 +58,7 @@ expect { | |||
52 | 58 | ||
53 | send -- "rm -fr dest/*\r" | 59 | send -- "rm -fr dest/*\r" |
54 | after 100 | 60 | after 100 |
61 | send -- "rm -f src/dircopy.exp\r" | ||
62 | after 100 | ||
55 | 63 | ||
56 | puts "\nall done\n" | 64 | puts "\nall done\n" |
diff --git a/test/fcopy/src/dircopy.exp b/test/fcopy/src/dircopy.exp deleted file mode 100755 index 0882561e5..000000000 --- a/test/fcopy/src/dircopy.exp +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
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 | |||
6 | # | ||
7 | # copy directory src to dest | ||
8 | # | ||
9 | set timeout 10 | ||
10 | spawn $env(SHELL) | ||
11 | match_max 100000 | ||
12 | |||
13 | send -- "rm -fr dest/*\r" | ||
14 | after 100 | ||
15 | |||
16 | send -- "fcopy src dest\r" | ||
17 | after 100 | ||
18 | |||
19 | send -- "find dest\r" | ||
20 | expect { | ||
21 | timeout {puts "TESTING ERROR 0\n";exit} | ||
22 | "dest/" | ||
23 | } | ||
24 | after 100 | ||
25 | |||
26 | send -- "find dest\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 0\n";exit} | ||
29 | "dest/" | ||
30 | } | ||
31 | after 100 | ||
32 | |||
33 | send -- "find dest\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 1\n";exit} | ||
36 | "dest/a" | ||
37 | } | ||
38 | after 100 | ||
39 | |||
40 | send -- "find dest\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 2\n";exit} | ||
43 | "dest/a/b" | ||
44 | } | ||
45 | after 100 | ||
46 | |||
47 | send -- "find dest\r" | ||
48 | expect { | ||
49 | timeout {puts "TESTING ERROR 3\n";exit} | ||
50 | "dest/a/b/file4" | ||
51 | } | ||
52 | after 100 | ||
53 | |||
54 | send -- "find dest\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 4\n";exit} | ||
57 | "dest/a/file3" | ||
58 | } | ||
59 | after 100 | ||
60 | |||
61 | send -- "find dest\r" | ||
62 | expect { | ||
63 | timeout {puts "TESTING ERROR 5\n";exit} | ||
64 | "dest/dircopy.exp" | ||
65 | } | ||
66 | after 100 | ||
67 | |||
68 | send -- "find dest\r" | ||
69 | expect { | ||
70 | timeout {puts "TESTING ERROR 6\n";exit} | ||
71 | "dest/file2" | ||
72 | } | ||
73 | after 100 | ||
74 | |||
75 | send -- "find dest\r" | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 7\n";exit} | ||
78 | "dest/file1" | ||
79 | } | ||
80 | after 100 | ||
81 | |||
82 | |||
83 | send -- "ls -al dest\r" | ||
84 | expect { | ||
85 | timeout {puts "TESTING ERROR 8\n";exit} | ||
86 | "drwxr-xr-x" { puts "umask 0022\n" } | ||
87 | "drwxrwxr-x" { puts "umask 0002\n" } | ||
88 | } | ||
89 | expect { | ||
90 | timeout {puts "TESTING ERROR 9\n";exit} | ||
91 | "a" | ||
92 | } | ||
93 | expect { | ||
94 | timeout {puts "TESTING ERROR 10\n";exit} | ||
95 | "lrwxrwxrwx" | ||
96 | } | ||
97 | expect { | ||
98 | timeout {puts "TESTING ERROR 11\n";exit} | ||
99 | "dircopy.exp" | ||
100 | } | ||
101 | expect { | ||
102 | timeout {puts "TESTING ERROR 12\n";exit} | ||
103 | "rwxr-xr-x" { puts "umask 0022\n" } | ||
104 | "rwxrwxr-x" { puts "umask 0002\n" } | ||
105 | } | ||
106 | expect { | ||
107 | timeout {puts "TESTING ERROR 13\n";exit} | ||
108 | "file1" | ||
109 | } | ||
110 | expect { | ||
111 | timeout {puts "TESTING ERROR 14\n";exit} | ||
112 | "rw-r--r--" { puts "umask 0022\n" } | ||
113 | "rw-rw-r--" { puts "umask 0002\n" } | ||
114 | } | ||
115 | expect { | ||
116 | timeout {puts "TESTING ERROR 15\n";exit} | ||
117 | "file2" | ||
118 | } | ||
119 | after 100 | ||
120 | |||
121 | send -- "stty -echo\r" | ||
122 | after 100 | ||
123 | send -- "diff -q src/a/b/file4 dest/a/b/file4; echo done\r" | ||
124 | expect { | ||
125 | timeout {puts "TESTING ERROR 16\n";exit} | ||
126 | "differ" {puts "TESTING ERROR 17\n";exit} | ||
127 | "done" | ||
128 | } | ||
129 | |||
130 | send -- "file dest/dircopy.exp\r" | ||
131 | expect { | ||
132 | timeout {puts "TESTING ERROR 18\n";exit} | ||
133 | "symbolic link" | ||
134 | } | ||
135 | |||
136 | send -- "rm -fr dest/*\r" | ||
137 | after 100 | ||
138 | |||
139 | puts "\nall done\n" | ||