diff options
author | Michael Biebl <biebl@debian.org> | 2014-08-18 17:48:20 +0200 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2014-08-18 17:48:20 +0200 |
commit | 1dfcd909d90f6fad4a612b6fd998d7473a9da399 (patch) | |
tree | b9fb75cfd347088f1850b48e298c5db564304ece /tests/chkseq.c | |
parent | daeb0d03d4a65fa118ad25b34958fb9cacbbd6f4 (diff) | |
download | rsyslog-upstream/8.4.0.tar.gz |
Imported Upstream version 8.4.0upstream/8.4.0
Diffstat (limited to 'tests/chkseq.c')
-rw-r--r-- | tests/chkseq.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/chkseq.c b/tests/chkseq.c index bd8597e..596d8dc 100644 --- a/tests/chkseq.c +++ b/tests/chkseq.c @@ -7,10 +7,14 @@ * -s<starting number> -e<ending number> * default for s is 0. -e should be given (else it is also 0) * -d may be specified, in which case duplicate messages are permitted. + * -m number of messages permitted to be missing without triggering a + * failure. This is necessary for some failover tests, where it is + * impossible to totally guard against messagt loss. By default, NO + * message is permitted to be lost. * * Part of the testbench for rsyslog. * - * Copyright 2009 Rainer Gerhards and Adiscon GmbH. + * Copyright 2009-2014 Rainer Gerhards and Adiscon GmbH. * * This file is part of rsyslog. * @@ -47,6 +51,7 @@ int main(int argc, char *argv[]) int dupsPermitted = 0; int start = 0, end = 0; int opt; + int lostok = 0; /* how many messages are OK to be lost? */ int nDups = 0; int reachedEOF; int edLen; /* length of extra data */ @@ -54,7 +59,7 @@ int main(int argc, char *argv[]) static char ioBuf[sizeof(edBuf)+1024]; char *file = NULL; - while((opt = getopt(argc, argv, "e:f:ds:vE")) != EOF) { + while((opt = getopt(argc, argv, "e:f:ds:vm:E")) != EOF) { switch((char)opt) { case 'f': file = optarg; @@ -71,6 +76,9 @@ int main(int argc, char *argv[]) case 'v': ++verbose; break; + case 'm': + lostok = atoi(optarg); + break; case 'E': bHaveExtraData = 1; break; @@ -125,6 +133,11 @@ int main(int argc, char *argv[]) printf("scanf error in index i=%d\n", i); exit(1); } + while(val > i && lostok > 0) { + --lostok; + printf("message %d missing (ok due to -m [now %d])\n", i, lostok); + ++i; + } if(val != i) { if(val == i - 1 && dupsPermitted) { --i; |