diff options
-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 |