summaryrefslogtreecommitdiffstats
path: root/tests/test.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test.tcl')
-rw-r--r--tests/test.tcl41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/test.tcl b/tests/test.tcl
new file mode 100644
index 00000000..7f1b7a6b
--- /dev/null
+++ b/tests/test.tcl
@@ -0,0 +1,41 @@
+# rsyslog parser tests
+package require Expect
+package require udp 1.0
+
+set rsyslogdPID [spawn "../tools/rsyslogd" "-c4" "-ftestruns/parser.conf" "-u2" "-n" "-iwork/rsyslog.pid" "-M../runtime/.libs"];
+#interact;
+#puts "pid: $rsyslogdPID";
+#sleep 1;
+#expect "\n";
+expect "}}"; # eat startup message
+set udpSock [udp_open];
+udp_conf $udpSock 127.0.0.1 514
+set files [glob *.parse1]
+puts "done init\n";
+
+
+foreach testcase $files {
+ puts "File $testcase";
+ set fp [open "$testcase" r];
+ fconfigure $fp -buffering line
+ #set data [read $fp];
+ #set data [split $data "\n"];
+ gets $fp input
+ puts "Line 1: $input\n";
+
+ puts $udpSock $input;
+ flush $udpSock;
+
+
+ set i 1
+ expect -re "{{.*}}";
+ set result $expect_out(buffer);
+
+ #puts "MSG $i: '$expect_out(buffer)'";
+ puts "MSG $i: '$result'\n";
+ set i [expr {$i + 1}];
+
+}
+
+exec kill $rsyslogdPID;
+close $udpSock;