summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtests/longrun.sh12
-rwxr-xr-xtests/manytcp.sh1
-rw-r--r--tests/tcpflood.c25
3 files changed, 29 insertions, 9 deletions
diff --git a/tests/longrun.sh b/tests/longrun.sh
index 09bddc58..407e9fa9 100755
--- a/tests/longrun.sh
+++ b/tests/longrun.sh
@@ -2,10 +2,18 @@
# It is not yet used in the automated testbench, but I keep this file so that
# I can use it whenever there is need to. As such, it currently does not have
# parameters but is expected to be edited as needed. -- rgerhards, 2010-03-10
+#
+# use: ./longrun.sh testname.sh
+#
+# where testname.sh is the test to be run
+# to change other params, you need to edit the settings here below:
MAXRUNS=10
DISPLAYALIVE=100
LOGFILE=runlog
+echo "logfile is $LOGFILE"
+echo "executing test $1"
+
date > $LOGFILE
for (( i=0; $i < 10000; i++ ))
@@ -13,9 +21,9 @@ for (( i=0; $i < 10000; i++ ))
if [ $(( i % DISPLAYALIVE )) -eq 0 ]; then
echo "$i iterations done"
fi
- ./gzipwr_large_dynfile.sh >> $LOGFILE
+ $1 >> $LOGFILE
if [ "$?" -ne "0" ]; then
- echo "Test failed in iteration $i!"
+ echo "Test failed in iteration $i, review $LOGFILE for details!"
exit 1
fi
done
diff --git a/tests/manytcp.sh b/tests/manytcp.sh
index dbf1d961..01f3e43b 100755
--- a/tests/manytcp.sh
+++ b/tests/manytcp.sh
@@ -4,5 +4,6 @@ source $srcdir/diag.sh startup manytcp.conf
# the config file specifies exactly 1100 connections
source $srcdir/diag.sh tcpflood -c1000 -m40000
source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
source $srcdir/diag.sh seq-check 0 39999
source $srcdir/diag.sh exit
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index 0d819d1d..d4955447 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -71,6 +71,7 @@ static int numMsgsToSend; /* number of messages to send */
static int numConnections = 1; /* number of connections to create */
static int *sockArray; /* array of sockets to use */
static int msgNum = 0; /* initial message number to start with */
+static int bShowProgress = 1; /* show progress messages */
/* open a single tcp connection
@@ -130,11 +131,13 @@ int openConnections(void)
char msgBuf[128];
size_t lenMsg;
- write(1, " open connections", sizeof(" open connections")-1);
+ if(bShowProgress)
+ write(1, " open connections", sizeof(" open connections")-1);
sockArray = calloc(numConnections, sizeof(int));
for(i = 0 ; i < numConnections ; ++i) {
if(i % 10 == 0) {
- printf("\r%5.5d", i);
+ if(bShowProgress)
+ printf("\r%5.5d", i);
//lenMsg = sprintf(msgBuf, "\r%5.5d", i);
//write(1, msgBuf, lenMsg);
}
@@ -163,11 +166,14 @@ void closeConnections(void)
char msgBuf[128];
size_t lenMsg;
- write(1, " close connections", sizeof(" close connections")-1);
+ if(bShowProgress)
+ write(1, " close connections", sizeof(" close connections")-1);
for(i = 0 ; i < numConnections ; ++i) {
if(i % 10 == 0) {
- lenMsg = sprintf(msgBuf, "\r%5.5d", i);
- write(1, msgBuf, lenMsg);
+ if(bShowProgress) {
+ lenMsg = sprintf(msgBuf, "\r%5.5d", i);
+ write(1, msgBuf, lenMsg);
+ }
}
close(sockArray[i]);
}
@@ -197,7 +203,8 @@ int sendMessages(void)
char extraData[MAX_EXTRADATA_LEN + 1];
printf("Sending %d messages.\n", numMsgsToSend);
- printf("\r%8.8d messages sent", 0);
+ if(bShowProgress)
+ printf("\r%8.8d messages sent", 0);
for(i = 0 ; i < numMsgsToSend ; ++i) {
if(i < numConnections)
socknum = i;
@@ -231,7 +238,8 @@ int sendMessages(void)
return(1);
}
if(i % 100 == 0) {
- printf("\r%8.8d", i);
+ if(bShowProgress)
+ printf("\r%8.8d", i);
}
++msgNum;
}
@@ -315,6 +323,9 @@ int main(int argc, char *argv[])
sigaction(SIGPIPE, &sigAct, NULL);
setvbuf(stdout, buf, _IONBF, 48);
+
+ if(!isatty(1))
+ bShowProgress = 0;
while((opt = getopt(argc, argv, "f:t:p:c:m:i:P:d:n:r")) != -1) {
switch (opt) {