aboutsummaryrefslogtreecommitdiffstats
path: root/test/fcopy
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-16 11:10:32 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-16 11:10:32 -0500
commitedcd62d7523365165e23695d7daabc94f1e9f48d (patch)
tree25649c9b73acd260fbafa30ee66cd6f7ceae8f1c /test/fcopy
parentMerge pull request #912 from curiosity-seeker/master (diff)
downloadfirejail-edcd62d7523365165e23695d7daabc94f1e9f48d.tar.gz
firejail-edcd62d7523365165e23695d7daabc94f1e9f48d.tar.zst
firejail-edcd62d7523365165e23695d7daabc94f1e9f48d.zip
fcopy part 1
Diffstat (limited to 'test/fcopy')
-rwxr-xr-xtest/fcopy/cmdline.exp56
-rwxr-xr-xtest/fcopy/dircopy.exp86
-rwxr-xr-xtest/fcopy/fcopy.sh23
-rwxr-xr-xtest/fcopy/filecopy.exp54
-rwxr-xr-xtest/fcopy/linkcopy.exp86
-rw-r--r--test/fcopy/src/a/b/file411
-rw-r--r--test/fcopy/src/a/file30
l---------test/fcopy/src/dircopy.exp1
-rwxr-xr-xtest/fcopy/src/file10
-rw-r--r--test/fcopy/src/file20
10 files changed, 317 insertions, 0 deletions
diff --git a/test/fcopy/cmdline.exp b/test/fcopy/cmdline.exp
new file mode 100755
index 000000000..95e221321
--- /dev/null
+++ b/test/fcopy/cmdline.exp
@@ -0,0 +1,56 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "/usr/lib/firejail/fcopy\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "files missing"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Usage:"
18}
19after 100
20
21send -- "/usr/lib/firejail/fcopy foo\r"
22expect {
23 timeout {puts "TESTING ERROR 2\n";exit}
24 "files missing"
25}
26expect {
27 timeout {puts "TESTING ERROR 3\n";exit}
28 "Usage:"
29}
30after 100
31
32send -- "/usr/lib/firejail/fcopy f%oo1 foo2\r"
33expect {
34 timeout {puts "TESTING ERROR 4\n";exit}
35 "invalid file name"
36}
37after 100
38
39send -- "/usr/lib/firejail/fcopy foo1 f,oo2\r"
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 "invalid file name"
43}
44after 100
45
46send -- "/usr/lib/firejail/fcopy foo1 foo2\r"
47expect {
48 timeout {puts "TESTING ERROR 6\n";exit}
49 "cannot find destination directory"
50}
51after 100
52
53
54
55
56puts "\nall done\n"
diff --git a/test/fcopy/dircopy.exp b/test/fcopy/dircopy.exp
new file mode 100755
index 000000000..b87f24a59
--- /dev/null
+++ b/test/fcopy/dircopy.exp
@@ -0,0 +1,86 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 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 -- "/usr/lib/firejail/fcopy src dest\r"
17after 100
18
19send -- "find dest\r"
20expect {
21 timeout {puts "TESTING ERROR 0\n";exit}
22 "dest/"
23}
24expect {
25 timeout {puts "TESTING ERROR 1\n";exit}
26 "dest/a"
27}
28expect {
29 timeout {puts "TESTING ERROR 2\n";exit}
30 "dest/a/b"
31}
32expect {
33 timeout {puts "TESTING ERROR 3\n";exit}
34 "dest/a/b/file4"
35}
36expect {
37 timeout {puts "TESTING ERROR 4\n";exit}
38 "dest/a/file3"
39}
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 "dest/dircopy.exp"
43}
44expect {
45 timeout {puts "TESTING ERROR 6\n";exit}
46 "dest/file2"
47}
48expect {
49 timeout {puts "TESTING ERROR 7\n";exit}
50 "dest/file1"
51}
52after 100
53
54
55send -- "ls -al dest\r"
56expect {
57 timeout {puts "TESTING ERROR 8\n";exit}
58 "drwx--x--x"
59}
60expect {
61 timeout {puts "TESTING ERROR 9\n";exit}
62 "rwxrwxrwx"
63}
64expect {
65 timeout {puts "TESTING ERROR 10\n";exit}
66 "rw-r--r--"
67}
68after 100
69
70send -- "diff -q src/a/b/file4 dest/a/b/file4; echo done\r"
71expect {
72 timeout {puts "TESTING ERROR 11\n";exit}
73 "differ" {puts "TESTING ERROR 12\n";exit}
74 "done"
75}
76
77send -- "file dest/dircopy.exp\r"
78expect {
79 timeout {puts "TESTING ERROR 13\n";exit}
80 "symbolic link"
81}
82
83send -- "rm -fr dest/*\r"
84after 100
85
86puts "\nall done\n"
diff --git a/test/fcopy/fcopy.sh b/test/fcopy/fcopy.sh
new file mode 100755
index 000000000..9961d6317
--- /dev/null
+++ b/test/fcopy/fcopy.sh
@@ -0,0 +1,23 @@
1#!/bin/bash
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
5
6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8
9rm -fr dest/*
10
11echo "TESTING: fcopy cmdline (test/fcopy/cmdline.exp)"
12./cmdline.exp
13
14echo "TESTING: fcopy directory (test/fcopy/dircopy.exp)"
15./dircopy.exp
16
17echo "TESTING: fcopy file (test/fcopy/filecopy.exp)"
18./filecopy.exp
19
20echo "TESTING: fcopy link (test/fcopy/linkcopy.exp)"
21./linkcopy.exp
22
23rm -fr dest/*
diff --git a/test/fcopy/filecopy.exp b/test/fcopy/filecopy.exp
new file mode 100755
index 000000000..9927e18fe
--- /dev/null
+++ b/test/fcopy/filecopy.exp
@@ -0,0 +1,54 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 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 -- "/usr/lib/firejail/fcopy src/dircopy.exp dest\r"
17after 100
18
19send -- "find dest\r"
20expect {
21 timeout {puts "TESTING ERROR 0\n";exit}
22 "dest/"
23}
24expect {
25 timeout {puts "TESTING ERROR 1\n";exit}
26 "dest/dircopy.exp"
27}
28after 100
29
30
31send -- "ls -al dest\r"
32expect {
33 timeout {puts "TESTING ERROR 2\n";exit}
34 "lrwxrwxrwx"
35}
36after 100
37
38send -- "diff -q dircopy.exp dest/dircopy.exp; echo done\r"
39expect {
40 timeout {puts "TESTING ERROR 3\n";exit}
41 "differ" {puts "TESTING ERROR 4\n";exit}
42 "done"
43}
44
45send -- "file dest/dircopy.exp\r"
46expect {
47 timeout {puts "TESTING ERROR 5\n";exit}
48 "symbolic link"
49}
50
51send -- "rm -fr dest/*\r"
52after 100
53
54puts "\nall done\n"
diff --git a/test/fcopy/linkcopy.exp b/test/fcopy/linkcopy.exp
new file mode 100755
index 000000000..b87f24a59
--- /dev/null
+++ b/test/fcopy/linkcopy.exp
@@ -0,0 +1,86 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 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 -- "/usr/lib/firejail/fcopy src dest\r"
17after 100
18
19send -- "find dest\r"
20expect {
21 timeout {puts "TESTING ERROR 0\n";exit}
22 "dest/"
23}
24expect {
25 timeout {puts "TESTING ERROR 1\n";exit}
26 "dest/a"
27}
28expect {
29 timeout {puts "TESTING ERROR 2\n";exit}
30 "dest/a/b"
31}
32expect {
33 timeout {puts "TESTING ERROR 3\n";exit}
34 "dest/a/b/file4"
35}
36expect {
37 timeout {puts "TESTING ERROR 4\n";exit}
38 "dest/a/file3"
39}
40expect {
41 timeout {puts "TESTING ERROR 5\n";exit}
42 "dest/dircopy.exp"
43}
44expect {
45 timeout {puts "TESTING ERROR 6\n";exit}
46 "dest/file2"
47}
48expect {
49 timeout {puts "TESTING ERROR 7\n";exit}
50 "dest/file1"
51}
52after 100
53
54
55send -- "ls -al dest\r"
56expect {
57 timeout {puts "TESTING ERROR 8\n";exit}
58 "drwx--x--x"
59}
60expect {
61 timeout {puts "TESTING ERROR 9\n";exit}
62 "rwxrwxrwx"
63}
64expect {
65 timeout {puts "TESTING ERROR 10\n";exit}
66 "rw-r--r--"
67}
68after 100
69
70send -- "diff -q src/a/b/file4 dest/a/b/file4; echo done\r"
71expect {
72 timeout {puts "TESTING ERROR 11\n";exit}
73 "differ" {puts "TESTING ERROR 12\n";exit}
74 "done"
75}
76
77send -- "file dest/dircopy.exp\r"
78expect {
79 timeout {puts "TESTING ERROR 13\n";exit}
80 "symbolic link"
81}
82
83send -- "rm -fr dest/*\r"
84after 100
85
86puts "\nall done\n"
diff --git a/test/fcopy/src/a/b/file4 b/test/fcopy/src/a/b/file4
new file mode 100644
index 000000000..ac318d7ab
--- /dev/null
+++ b/test/fcopy/src/a/b/file4
@@ -0,0 +1,11 @@
1
2
3Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam interdum at massa non aliquam. Maecenas molestie id orci volutpat porta. Praesent aliquam nunc quis mi tristique, ac feugiat enim rutrum. Nulla vitae metus sodales, pellentesque risus sit amet, volutpat nisl. Curabitur accumsan arcu congue lacus porta laoreet. Nulla facilisi. Integer nec augue id magna gravida tincidunt id vitae lorem. Curabitur facilisis, tellus vel pellentesque pretium, odio dolor efficitur lorem, et tincidunt dui enim cursus lacus. Cras a orci ac magna semper dapibus nec et velit. Nullam aliquam sollicitudin auctor.
4
5Mauris ac quam vel purus volutpat semper eget a ante. Curabitur arcu nisl, dapibus ac lectus ac, porttitor fermentum metus. Aliquam et sem aliquam magna interdum ultricies at eu orci. Aenean tortor augue, volutpat nec magna nec, rutrum bibendum justo. Vivamus ex quam, auctor ut pellentesque mattis, aliquet a eros. Etiam ac lacus ac ante ullamcorper sollicitudin a quis orci. Suspendisse quis justo ac mauris cursus finibus quis at elit. Vestibulum elementum finibus diam, eget convallis purus aliquet et. Fusce fermentum ornare urna, non ornare nisl tincidunt consectetur. Donec et lacus vitae ex eleifend porttitor id ut odio. Quisque luctus eget lorem et sollicitudin.
6
7Aliquam libero elit, finibus a nisl a, commodo viverra turpis. Nam pulvinar in est sit amet fermentum. Praesent scelerisque tempus lectus, ac porta elit sodales rutrum. Duis faucibus faucibus urna eget accumsan. Vivamus in turpis ut massa rhoncus pretium nec et lorem. Aenean at tellus eget metus porta ornare. Aliquam erat volutpat. Donec hendrerit a massa vel malesuada. Integer varius sapien et orci viverra pretium. In at velit aliquet, vulputate nisi lobortis, aliquam augue.
8
9Ut aliquam turpis ut lorem aliquam, in faucibus elit pulvinar. Vivamus viverra tortor ornare, lacinia leo sit amet, auctor arcu. Sed erat leo, pellentesque vel nibh a, malesuada vehicula purus. Vivamus est dolor, aliquet quis facilisis fermentum, varius in dolor. Nunc quis libero feugiat, imperdiet est vitae, mollis risus. Vestibulum elementum mattis lorem vitae gravida. Nullam id tellus interdum, aliquam erat eu, laoreet nunc. Aliquam ut felis vel mauris maximus pellentesque.
10
11Vestibulum tempus mauris eget ex interdum, vitae vehicula tortor sollicitudin. Pellentesque et dolor cursus dui vulputate laoreet. Morbi eu bibendum quam, at ultrices elit. Vestibulum dictum enim sit amet ultricies imperdiet. Praesent congue magna ac mauris mattis, a iaculis ante aliquet. Vivamus at egestas ex. Suspendisse orci dolor, pharetra at aliquam a, faucibus facilisis leo. Quisque semper lorem eget elit commodo pretium. Aenean posuere augue quis arcu finibus, sit amet fringilla risus congue. Pellentesque rutrum nunc leo, aliquam lobortis lacus molestie nec. Donec convallis congue diam, ullamcorper vestibulum dui varius nec. Praesent pellentesque nisi risus. In aliquam molestie malesuada. Nulla facilisis a risus eu tristique. Morbi molestie et arcu quis efficitur. Curabitur cursus vestibulum luctus.
diff --git a/test/fcopy/src/a/file3 b/test/fcopy/src/a/file3
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fcopy/src/a/file3
diff --git a/test/fcopy/src/dircopy.exp b/test/fcopy/src/dircopy.exp
new file mode 120000
index 000000000..2acf88f7b
--- /dev/null
+++ b/test/fcopy/src/dircopy.exp
@@ -0,0 +1 @@
../dircopy.exp \ No newline at end of file
diff --git a/test/fcopy/src/file1 b/test/fcopy/src/file1
new file mode 100755
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fcopy/src/file1
diff --git a/test/fcopy/src/file2 b/test/fcopy/src/file2
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/test/fcopy/src/file2