diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-20 09:05:48 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-10-20 09:05:48 +0200 |
commit | 07264a78e00766cf15ab379baaeec3cea372a33e (patch) | |
tree | 0dc5c376124206a738b349b07e043ec45bc9a896 /tests | |
parent | 2deec9a12944129c9dce9ee237d04e0a1a8b082b (diff) | |
download | rsyslog-07264a78e00766cf15ab379baaeec3cea372a33e.tar.gz rsyslog-07264a78e00766cf15ab379baaeec3cea372a33e.tar.xz rsyslog-07264a78e00766cf15ab379baaeec3cea372a33e.zip |
added some tests for IPv4-Only configuration
We are "abusing" the parser tests to test the TCP/UDP reception
handling. Thus we do not run the other tests through to an IPv4
only config. It acutally is not that parser that matters but rather
the hope to find some init issues when running with only a single
listening socket (in IPv6, we usually both have an IPv4 AND an IPv6
listening socket, what - as practice has shown - may hide listener
setup errors).
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/diag.sh | 2 | ||||
-rw-r--r-- | tests/nettester.c | 11 | ||||
-rwxr-xr-x | tests/parsertest.sh | 8 |
3 files changed, 17 insertions, 4 deletions
diff --git a/tests/diag.sh b/tests/diag.sh index d8ba43b8..b6b39a4b 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -90,7 +90,7 @@ case $1 in ;; 'nettester') # perform nettester-based tests # use -v for verbose output! - ./nettester -t$2 -i$3 + ./nettester -t$2 -i$3 $4 if [ "$?" -ne "0" ]; then exit 1 fi diff --git a/tests/nettester.c b/tests/nettester.c index 47e75243..3ab96e62 100644 --- a/tests/nettester.c +++ b/tests/nettester.c @@ -62,6 +62,7 @@ static char *testSuite = NULL; /* name of current test suite */ static int iPort = 12514; /* port which shall be used for sending data */ static char* pszCustomConf = NULL; /* custom config file, use -c conf to specify */ static int verbose = 0; /* verbose output? -v option */ +static int IPv4Only = 0; /* use only IPv4 in rsyslogd call? */ /* these two are quick hacks... */ int iFailed = 0; @@ -221,7 +222,7 @@ int openPipe(char *configFile, pid_t *pid, int *pfd) int pipefd[2]; pid_t cpid; char *newargv[] = {"../tools/rsyslogd", "dummy", "-c4", "-u2", "-n", "-irsyslog.pid", - "-M../runtime/.libs:../.libs", NULL }; + "-M../runtime/.libs:../.libs", NULL, NULL}; char confFile[1024]; char *newenviron[] = { NULL }; /* debug aide... @@ -233,6 +234,9 @@ int openPipe(char *configFile, pid_t *pid, int *pfd) (pszCustomConf == NULL) ? configFile : pszCustomConf); newargv[1] = confFile; + if(IPv4Only) + newargv[(sizeof(newargv)/sizeof(char*)) - 2] = "-4"; + if (pipe(pipefd) == -1) { perror("pipe"); exit(EXIT_FAILURE); @@ -426,8 +430,11 @@ int main(int argc, char *argv[]) char buf[4096]; char testcases[4096]; - while((opt = getopt(argc, argv, "c:i:p:t:v")) != EOF) { + while((opt = getopt(argc, argv, "4c:i:p:t:v")) != EOF) { switch((char)opt) { + case '4': + IPv4Only = 1; + break; case 'c': pszCustomConf = optarg; break; diff --git a/tests/parsertest.sh b/tests/parsertest.sh index 6cfa59b1..470d9375 100755 --- a/tests/parsertest.sh +++ b/tests/parsertest.sh @@ -1,7 +1,13 @@ -echo TEST: parsertest.sh - various parser tests +echo TEST: \[parsertest.sh\]: various parser tests source $srcdir/diag.sh init source $srcdir/diag.sh nettester parse1 udp source $srcdir/diag.sh nettester parse1 tcp source $srcdir/diag.sh nettester parse2 udp source $srcdir/diag.sh nettester parse2 tcp + +echo \[parsertest.sh]: redoing tests in IPv4-only mode +source $srcdir/diag.sh nettester parse1 udp -4 +source $srcdir/diag.sh nettester parse1 tcp -4 +source $srcdir/diag.sh nettester parse2 udp -4 +source $srcdir/diag.sh nettester parse2 tcp -4 source $srcdir/diag.sh init |