summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-06 16:38:09 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-06 16:38:09 +0200
commite3040285dbf0854443bc2443e0de5ac59f6f839e (patch)
tree557eae59b899f2311a9a8ba80ea32e465fff3e9a /tests
parent7fdeac0bdcaad3525f203ae5dc1fa7636078e37f (diff)
downloadrsyslog-e3040285dbf0854443bc2443e0de5ac59f6f839e.tar.gz
rsyslog-e3040285dbf0854443bc2443e0de5ac59f6f839e.tar.xz
rsyslog-e3040285dbf0854443bc2443e0de5ac59f6f839e.zip
first shot at asynchronous stream writer with timeout capability
... seems to work on quick testing, but needs a far more testing and improvement. Good milestone commit.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/diag.sh2
-rwxr-xr-xtests/killrsyslog.sh2
-rw-r--r--tests/nettester.c5
-rw-r--r--tests/tcpflood.c19
-rwxr-xr-xtests/threadingmq.sh4
5 files changed, 21 insertions, 11 deletions
diff --git a/tests/diag.sh b/tests/diag.sh
index 2a9d0ee3..299c5d71 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -9,7 +9,7 @@
#valgrind="valgrind --tool=drd --log-fd=1"
#valgrind="valgrind --tool=helgrind --log-fd=1"
#set -o xtrace
-#export RSYSLOG_DEBUG="debug nostdout noprintmutexaction"
+#export RSYSLOG_DEBUG="debug nostdout printmutexaction"
#export RSYSLOG_DEBUGLOG="log"
case $1 in
'init') $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
diff --git a/tests/killrsyslog.sh b/tests/killrsyslog.sh
index b1be757b..c9b6e0ac 100755
--- a/tests/killrsyslog.sh
+++ b/tests/killrsyslog.sh
@@ -2,6 +2,6 @@
if [ -e "rsyslog.pid" ]
then
echo rsyslog.pid exists, trying to shut down rsyslogd process `cat rsyslog.pid`.
- kill `cat rsyslog.pid`
+ kill -9 `cat rsyslog.pid`
sleep 1
fi
diff --git a/tests/nettester.c b/tests/nettester.c
index dbfb4db3..73abc46e 100644
--- a/tests/nettester.c
+++ b/tests/nettester.c
@@ -128,12 +128,13 @@ tcpSend(char *buf, int lenBuf)
if(connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == 0) {
break;
} else {
- if(retries++ == 30) {
+ if(retries++ == 50) {
++iFailed;
fprintf(stderr, "connect() failed\n");
return(1);
} else {
- usleep(100);
+ fprintf(stderr, "connect() failed, retry %d\n", retries);
+ usleep(100000); /* ms = 1000 us! */
}
}
}
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index 2ca796ca..0439e33e 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -61,6 +61,7 @@ int openConn(int *fd)
{
int sock;
struct sockaddr_in addr;
+ int retries = 0;
if((sock=socket(AF_INET, SOCK_STREAM, 0))==-1) {
perror("socket()");
@@ -74,11 +75,19 @@ int openConn(int *fd)
fprintf(stderr, "inet_aton() failed\n");
return(1);
}
- if(connect(sock, (struct sockaddr*)&addr, sizeof(addr)) != 0) {
- perror("connect()");
- fprintf(stderr, "connect() failed\n");
- return(1);
- }
+ while(1) { /* loop broken inside */
+ if(connect(sock, (struct sockaddr*)&addr, sizeof(addr)) == 0) {
+ break;
+ } else {
+ if(retries++ == 50) {
+ perror("connect()");
+ fprintf(stderr, "connect() failed\n");
+ return(1);
+ } else {
+ usleep(100000); /* ms = 1000 us! */
+ }
+ }
+ }
*fd = sock;
return 0;
diff --git a/tests/threadingmq.sh b/tests/threadingmq.sh
index 5c29ec60..3680df5f 100755
--- a/tests/threadingmq.sh
+++ b/tests/threadingmq.sh
@@ -9,7 +9,7 @@
echo TEST: threadingmq.sh - main queue concurrency
source $srcdir/diag.sh init
source $srcdir/diag.sh startup threadingmq.conf
-source $srcdir/diag.sh tcpflood 127.0.0.1 13514 2 100000
+source $srcdir/diag.sh tcpflood 127.0.0.1 13514 2 10000000
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
-source $srcdir/diag.sh seq-check 0 99999
+source $srcdir/diag.sh seq-check 0 9999999
source $srcdir/diag.sh exit