From 2bf008af08cda8bd1b4c712172dd8790f0f8343e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 19 Oct 2009 13:59:42 +0200 Subject: added new testcase; fixed bug in testdriver --- tests/nettester.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/nettester.c') diff --git a/tests/nettester.c b/tests/nettester.c index 2838b919..47e75243 100644 --- a/tests/nettester.c +++ b/tests/nettester.c @@ -326,10 +326,13 @@ processTestFile(int fd, char *pszFileName) ret = 1; } + /* clean up after the try */ + free(testdata); + testdata = NULL; + free(expected); + expected = NULL; } - free(testdata); - free(expected); fclose(fp); return(ret); } -- cgit v1.2.3 From 07264a78e00766cf15ab379baaeec3cea372a33e Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 20 Oct 2009 09:05:48 +0200 Subject: 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). --- tests/nettester.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/nettester.c') 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; -- cgit v1.2.3 From e04e1b50025f5fa9c26abd946190dce8f797d08f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 22 Oct 2009 11:33:38 +0200 Subject: enhanced test environment (including testbench) support for enhancing probability of memory addressing failure by using non-NULL default value for malloced memory (optional, only if requested by configure option). This helps to track down some otherwise undetected issues within the testbench and is expected to be very useful in the future. --- tests/nettester.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/nettester.c') diff --git a/tests/nettester.c b/tests/nettester.c index 3ab96e62..7f1a6b1f 100644 --- a/tests/nettester.c +++ b/tests/nettester.c @@ -320,7 +320,7 @@ processTestFile(int fd, char *pszFileName) /* pull response from server and then check if it meets our expectation */ readLine(fd, buf); if(strlen(buf) == 0) { - printf("something went wrong - read a zero-length string from rsyslogd"); + printf("something went wrong - read a zero-length string from rsyslogd\n"); exit(1); } if(strcmp(expected, buf)) { -- cgit v1.2.3