summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-05-25 14:22:50 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-05-25 14:22:50 +0200
commitc7e8282b9eb9d6452f7678c3f7c1e06337a3bb0a (patch)
tree367dd15b293a18e9944aae02e547551674293930 /tests
parent5fd2bcce232352f3abbe235c788b9a8fa7bac043 (diff)
parentb9549380270fa68e27e8ee3f049c7d34156a85ff (diff)
downloadrsyslog-c7e8282b9eb9d6452f7678c3f7c1e06337a3bb0a.tar.gz
rsyslog-c7e8282b9eb9d6452f7678c3f7c1e06337a3bb0a.tar.xz
rsyslog-c7e8282b9eb9d6452f7678c3f7c1e06337a3bb0a.zip
Merge branch 'master' into ultra-reliable
Diffstat (limited to 'tests')
-rw-r--r--tests/DiagTalker.java43
-rw-r--r--tests/Makefile.am6
-rwxr-xr-xtests/diskqueue.sh4
-rwxr-xr-xtests/imtcp-multiport.sh6
-rw-r--r--tests/testsuites/imtcp-multiport.conf3
-rwxr-xr-xtests/waitqueueempty.sh3
6 files changed, 60 insertions, 5 deletions
diff --git a/tests/DiagTalker.java b/tests/DiagTalker.java
new file mode 100644
index 00000000..e33a5867
--- /dev/null
+++ b/tests/DiagTalker.java
@@ -0,0 +1,43 @@
+//package com.rsyslog.diag;
+import java.io.*;
+import java.net.*;
+
+public class DiagTalker {
+ public static void main(String[] args) throws IOException {
+
+ Socket diagSocket = null;
+ PrintWriter out = null;
+ BufferedReader in = null;
+ final String host = "127.0.0.1";
+ final int port = 13500;
+
+ try {
+ diagSocket = new Socket(host, port);
+ out = new PrintWriter(diagSocket.getOutputStream(), true);
+ in = new BufferedReader(new InputStreamReader(
+ diagSocket.getInputStream()));
+ } catch (UnknownHostException e) {
+ System.err.println("can not resolve " + host + "!");
+ System.exit(1);
+ } catch (IOException e) {
+ System.err.println("Couldn't get I/O for "
+ + "the connection to: " + host + ".");
+ System.exit(1);
+ }
+
+ BufferedReader stdIn = new BufferedReader(
+ new InputStreamReader(System.in));
+ String userInput;
+
+ while ((userInput = stdIn.readLine()) != null) {
+ out.println(userInput);
+ System.out.println("imdiag returns: " + in.readLine());
+ }
+
+ out.close();
+ in.close();
+ stdIn.close();
+ diagSocket.close();
+ }
+}
+
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 556886e3..d581aeb2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -6,9 +6,12 @@ if ENABLE_OMSTDOUT
TESTS += omod-if-array.sh parsertest.sh inputname.sh fieldtest.sh
endif
TESTS_ENVIRONMENT = RSYSLOG_MODDIR='$(abs_top_builddir)'/runtime/.libs/
-DISTCLEANFILES=rsyslog.pid
+DISTCLEANFILES=rsyslog.pid '$(abs_top_builddir)'/DiagTalker.class
test_files = testbench.h runtime-dummy.c
+check_JAVA = DiagTalker.java
+#dist_java_JAVA = DiagTalker.java
+
EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
cfg1.cfgtest \
cfg1.testin \
@@ -61,6 +64,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/1.inputname_imtcp_12516 \
omod-if-array.sh \
waitqueueempty.sh \
+ DiagTalker.java \
cfg.sh
ourtail_SOURCES = ourtail.c
diff --git a/tests/diskqueue.sh b/tests/diskqueue.sh
index 8441cbf2..20767a90 100755
--- a/tests/diskqueue.sh
+++ b/tests/diskqueue.sh
@@ -4,6 +4,10 @@
# memory to disk mode for DA queues.
# added 2009-04-17 by Rgerhards
# This file is part of the rsyslog project, released under GPLv3
+# uncomment for debugging support:
+#set -o xtrace
+#export RSYSLOG_DEBUG="debug nostdout"
+#export RSYSLOG_DEBUGLOG="tmp"
echo testing queue disk-only mode
rm -rf test-spool
mkdir test-spool
diff --git a/tests/imtcp-multiport.sh b/tests/imtcp-multiport.sh
index aa1f15e8..17480dae 100755
--- a/tests/imtcp-multiport.sh
+++ b/tests/imtcp-multiport.sh
@@ -17,7 +17,7 @@ if [ "$?" -ne "0" ]; then
echo "error during tcpflood! see rsyslog.out.log.save for what was written"
cp rsyslog.out.log rsyslog.out.log.save
fi
-sleep 2 # we need this so that rsyslogd can receive all outstanding messages
+$srcdir/waitqueueempty.sh # wait until rsyslogd is done processing messages
kill `cat rsyslog.pid`
rm -f work
sort < rsyslog.out.log > work
@@ -42,7 +42,7 @@ if [ "$?" -ne "0" ]; then
echo "error during tcpflood! see rsyslog.out.log.save for what was written"
cp rsyslog.out.log rsyslog.out.log.save
fi
-sleep 2 # we need this so that rsyslogd can receive all outstanding messages
+$srcdir/waitqueueempty.sh # wait until rsyslogd is done processing messages
kill `cat rsyslog.pid`
rm -f work
sort < rsyslog.out.log > work
@@ -67,7 +67,7 @@ if [ "$?" -ne "0" ]; then
echo "error during tcpflood! see rsyslog.out.log.save for what was written"
cp rsyslog.out.log rsyslog.out.log.save
fi
-sleep 2 # we need this so that rsyslogd can receive all outstanding messages
+$srcdir/waitqueueempty.sh # wait until rsyslogd is done processing messages
kill `cat rsyslog.pid`
rm -f work
sort < rsyslog.out.log > work
diff --git a/tests/testsuites/imtcp-multiport.conf b/tests/testsuites/imtcp-multiport.conf
index 00b63cb2..ec059fe4 100644
--- a/tests/testsuites/imtcp-multiport.conf
+++ b/tests/testsuites/imtcp-multiport.conf
@@ -6,6 +6,9 @@ $InputTCPServerRun 13514
$InputTCPServerRun 13515
$InputTCPServerRun 13516
+$ModLoad ../plugins/imdiag/.libs/imdiag
+$IMDiagServerRun 13500
+
$ErrorMessagesToStderr off
$template outfmt,"%msg:F,58:2%\n"
diff --git a/tests/waitqueueempty.sh b/tests/waitqueueempty.sh
index 2c047588..4825853a 100755
--- a/tests/waitqueueempty.sh
+++ b/tests/waitqueueempty.sh
@@ -1,4 +1,5 @@
# wait until main message queue is empty. This is currently done in
# a separate shell script so that we can change the implementation
# at some later point. -- rgerhards, 2009-05-25
-echo WaitMainQueueEmpty | nc 127.0.0.1 13500
+#echo WaitMainQueueEmpty | nc 127.0.0.1 13500
+echo WaitMainQueueEmpty | java -classpath $abs_top_builddir DiagTalker