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