aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/trace.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/utils/trace.exp')
-rwxr-xr-xtest/utils/trace.exp115
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
6set timeout 30
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --trace mkdir ttt\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "mkdir:mkdir ttt"
18}
19sleep 1
20
21send -- "firejail --trace rmdir ttt\r"
22expect {
23 timeout {puts "TESTING ERROR 2\n";exit}
24 "Child process initialized"
25}
26expect {
27 timeout {puts "TESTING ERROR 3\n";exit}
28 "rmdir:rmdir ttt"
29}
30sleep 1
31
32send -- "firejail --trace touch ttt\r"
33expect {
34 timeout {puts "TESTING ERROR 4\n";exit}
35 "Child process initialized"
36}
37expect {
38 timeout {puts "TESTING ERROR 5\n";exit}
39 "touch:open ttt" {puts "OK\n";}
40 "touch:open64 ttt" {puts "OK\n";}
41}
42sleep 1
43
44send -- "firejail --trace rm ttt\r"
45expect {
46 timeout {puts "TESTING ERROR 6\n";exit}
47 "Child process initialized"
48}
49expect {
50 timeout {puts "TESTING ERROR 7\n";exit}
51 "rm:unlinkat ttt"
52}
53sleep 1
54
55send -- "firejail --trace wget -q debian.org\r"
56expect {
57 timeout {puts "TESTING ERROR 8.1\n";exit}
58 "Child process initialized"
59}
60expect {
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}
65expect {
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}
70expect {
71 timeout {puts "TESTING ERROR 8.4\n";exit}
72 "wget:fopen /etc/hosts"
73}
74expect {
75 timeout {puts "TESTING ERROR 8.5\n";exit}
76 "wget:connect"
77}
78expect {
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}
84sleep 1
85
86send -- "firejail --trace rm index.html\r"
87expect {
88 timeout {puts "TESTING ERROR 9\n";exit}
89 "Child process initialized"
90}
91expect {
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}
96sleep 1
97
98send -- "firejail --trace\r"
99expect {
100 timeout {puts "TESTING ERROR 11\n";exit}
101 "Child process initialized"
102}
103expect {
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}
108expect {
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}
113after 100
114
115puts "\nall done\n"