diff options
Diffstat (limited to 'test/utils/trace.exp')
-rwxr-xr-x | test/utils/trace.exp | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/test/utils/trace.exp b/test/utils/trace.exp new file mode 100755 index 000000000..78a04b273 --- /dev/null +++ b/test/utils/trace.exp | |||
@@ -0,0 +1,115 @@ | |||
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 | set timeout 30 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --trace mkdir ttt\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1\n";exit} | ||
17 | "mkdir:mkdir ttt" | ||
18 | } | ||
19 | sleep 1 | ||
20 | |||
21 | send -- "firejail --trace rmdir ttt\r" | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 2\n";exit} | ||
24 | "Child process initialized" | ||
25 | } | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 3\n";exit} | ||
28 | "rmdir:rmdir ttt" | ||
29 | } | ||
30 | sleep 1 | ||
31 | |||
32 | send -- "firejail --trace touch ttt\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 4\n";exit} | ||
35 | "Child process initialized" | ||
36 | } | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 5\n";exit} | ||
39 | "touch:open ttt" {puts "OK\n";} | ||
40 | "touch:open64 ttt" {puts "OK\n";} | ||
41 | } | ||
42 | sleep 1 | ||
43 | |||
44 | send -- "firejail --trace rm ttt\r" | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 6\n";exit} | ||
47 | "Child process initialized" | ||
48 | } | ||
49 | expect { | ||
50 | timeout {puts "TESTING ERROR 7\n";exit} | ||
51 | "rm:unlinkat ttt" | ||
52 | } | ||
53 | sleep 1 | ||
54 | |||
55 | send -- "firejail --trace wget -q debian.org\r" | ||
56 | expect { | ||
57 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
58 | "Child process initialized" | ||
59 | } | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
62 | "bash:open /dev/tty" {puts "OK\n";} | ||
63 | "bash:open64 /dev/tty" {puts "OK\n";} | ||
64 | } | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
67 | "wget:fopen64 /etc/wgetrc" {puts "OK\n";} | ||
68 | "wget:fopen /etc/wgetrc" {puts "OK\n";} | ||
69 | } | ||
70 | expect { | ||
71 | timeout {puts "TESTING ERROR 8.4\n";exit} | ||
72 | "wget:fopen /etc/hosts" | ||
73 | } | ||
74 | expect { | ||
75 | timeout {puts "TESTING ERROR 8.5\n";exit} | ||
76 | "wget:connect" | ||
77 | } | ||
78 | expect { | ||
79 | timeout {puts "TESTING ERROR 8.6\n";exit} | ||
80 | "wget:fopen64 index.html" {puts "OK\n";} | ||
81 | "wget:fopen index.html" {puts "OK\n";} | ||
82 | "Parent is shutting down" {puts "OK\n";} | ||
83 | } | ||
84 | sleep 1 | ||
85 | |||
86 | send -- "firejail --trace rm index.html\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 9\n";exit} | ||
89 | "Child process initialized" | ||
90 | } | ||
91 | expect { | ||
92 | timeout {puts "TESTING ERROR 10\n";exit} | ||
93 | "rm:unlinkat index.html" {puts "OK\n";} | ||
94 | "Parent is shutting down" {puts "OK\n";} | ||
95 | } | ||
96 | sleep 1 | ||
97 | |||
98 | send -- "firejail --trace\r" | ||
99 | expect { | ||
100 | timeout {puts "TESTING ERROR 11\n";exit} | ||
101 | "Child process initialized" | ||
102 | } | ||
103 | expect { | ||
104 | timeout {puts "TESTING ERROR 12\n";exit} | ||
105 | "bash:open /dev/tty" {puts "64bit\n"} | ||
106 | "bash:open64 /dev/tty" {puts "32bit\n"} | ||
107 | } | ||
108 | expect { | ||
109 | timeout {puts "TESTING ERROR 13\n";exit} | ||
110 | "bash:access /etc/terminfo/" {puts "debian\n"} | ||
111 | "bash:access /usr/share/terminfo/" {puts "arch\n"} | ||
112 | } | ||
113 | after 100 | ||
114 | |||
115 | puts "\nall done\n" | ||