summaryrefslogtreecommitdiffstats
path: root/test/fnetfilter/template.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/fnetfilter/template.exp')
-rwxr-xr-xtest/fnetfilter/template.exp82
1 files changed, 82 insertions, 0 deletions
diff --git a/test/fnetfilter/template.exp b/test/fnetfilter/template.exp
new file mode 100755
index 000000000..eb57313bd
--- /dev/null
+++ b/test/fnetfilter/template.exp
@@ -0,0 +1,82 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2017 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "rm outfile\r"
11after 100
12
13send -- "fnetfilter test2.net,icmp-type,destination-unreachable,time-exceeded,echo-request,3478,3479 outfile\r"
14after 100
15
16send -- "cat outfile\r"
17expect {
18 timeout {puts "TESTING ERROR 1\n";exit}
19 "*filter"
20}
21expect {
22 timeout {puts "TESTING ERROR 2\n";exit}
23 "INPUT -m state --state RELATED,ESTABLISHED"
24}
25expect {
26 timeout {puts "TESTING ERROR 3\n";exit}
27 "icmp-type echo-reply"
28}
29expect {
30 timeout {puts "TESTING ERROR 4\n";exit}
31 "icmp-type destination-unreachable"
32}
33expect {
34 timeout {puts "TESTING ERROR 5\n";exit}
35 "icmp-type time-exceeded"
36}
37expect {
38 timeout {puts "TESTING ERROR 6\n";exit}
39 "icmp-type echo-request"
40}
41expect {
42 timeout {puts "TESTING ERROR 7\n";exit}
43 "dport 3478"
44}
45expect {
46 timeout {puts "TESTING ERROR 8\n";exit}
47 "dport 3479"
48}
49expect {
50 timeout {puts "TESTING ERROR 8\n";exit}
51 "dport 3478"
52}
53expect {
54 timeout {puts "TESTING ERROR 10\n";exit}
55 "dport 3479"
56}
57after 100
58
59send -- "fnetfilter test2.net,icmp-type,destination-unreachable,time-exceeded,echo-request outfile\r"
60expect {
61 timeout {puts "TESTING ERROR 11\n";exit}
62 "ARG5 on line 14 was not defined"
63}
64after 100
65
66send -- "fnetfilter test2.net,icmp-type,destination-unreachable,time-exceeded,echo-request\r"
67expect {
68 timeout {puts "TESTING ERROR 12\n";exit}
69 "invalid destination file in netfilter command"
70}
71after 100
72
73send -- "fnetfilter test3.net,44 outfile\r"
74expect {
75 timeout {puts "TESTING ERROR 13\n";exit}
76 "invalid template argument on line 1"
77}
78after 100
79send -- "rm outfile\r"
80after 100
81
82puts "\nall done\n"