diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-22 18:37:56 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-22 18:37:56 +0200 |
commit | 50174408b02cd0e5553c5e92a73cc43fb1364db9 (patch) | |
tree | 95778349232645901107fef5fc8825aa6e1fa21a /tests/tcpflood.c | |
parent | e4b3f6d287d74b34d27b4e296c33cb3f1294a58c (diff) | |
download | rsyslog-50174408b02cd0e5553c5e92a73cc43fb1364db9.tar.gz rsyslog-50174408b02cd0e5553c5e92a73cc43fb1364db9.tar.xz rsyslog-50174408b02cd0e5553c5e92a73cc43fb1364db9.zip |
added test for DA queue mode (in main msg queue) - needs more work
The problem is that the rsyslog engine writes messages too quickly, so
that the queue never enters DA mode. We still have some look contemption.
One possible solution (hopefully) is to finally move the parser code out
of imtcp and onto the next thread. Need to address these issues first, then
come back to the test case.
Diffstat (limited to 'tests/tcpflood.c')
-rw-r--r-- | tests/tcpflood.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/tcpflood.c b/tests/tcpflood.c index 8dbc201b..2ca796ca 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -6,6 +6,7 @@ * argv[2] target port * argv[3] number of connections * argv[4] number of messages to send (connection is random) + * argv[5] initial message number (optional) * * Part of the testbench for rsyslog. * @@ -51,6 +52,7 @@ static int targetPort; static int numMsgsToSend; /* number of messages to send */ static int numConnections; /* number of connections to create */ static int *sockArray; /* array of sockets to use */ +static int msgNum = 0; /* initial message number to start with */ /* open a single tcp connection @@ -154,8 +156,6 @@ int sendMessages(void) int lenBuf; int lenSend; char buf[2048]; - char msgBuf[128]; - size_t lenMsg; srand(time(NULL)); /* seed is good enough for our needs */ @@ -168,19 +168,20 @@ int sendMessages(void) socknum = i - (numMsgsToSend - numConnections); else socknum = rand() % numConnections; - lenBuf = sprintf(buf, "<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:%8.8d:\n", i); + lenBuf = sprintf(buf, "<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:%8.8d:\n", msgNum); lenSend = send(sockArray[socknum], buf, lenBuf, 0); if(lenSend != lenBuf) { printf("\r%5.5d\n", i); fflush(stdout); perror("send test data"); - printf("send() failed at socket %d, index %d\n", socknum, i); + printf("send() failed at socket %d, index %d, msgNum %d\n", socknum, i, msgNum); fflush(stderr); return(1); } if(i % 100 == 0) { printf("\r%5.5d", i); } + ++msgNum; } printf("\r%5.5d messages sent\n", i); @@ -262,9 +263,9 @@ int main(int argc, char *argv[]) setvbuf(stdout, buf, _IONBF, 48); - if(argc != 5) { + if(argc != 5 && argc != 6) { printf("Invalid call of tcpflood\n"); - printf("Usage: tcpflood target-host target-port num-connections num-messages\n"); + printf("Usage: tcpflood target-host target-port num-connections num-messages [initial msgnum]\n"); exit(1); } @@ -272,6 +273,8 @@ int main(int argc, char *argv[]) targetPort = atoi(argv[2]); numConnections = atoi(argv[3]); numMsgsToSend = atoi(argv[4]); + if(argc == 6) + msgNum = atoi(argv[5]); if(openConnections() != 0) { printf("error opening connections\n"); |