Commit 76cb8540 authored by Michael Meyling's avatar Michael Meyling

[trackrdrd] test: test_util prints more infos in error case, test_config.readAndFindError changed

parent 0976092a
...@@ -177,7 +177,7 @@ static const char ...@@ -177,7 +177,7 @@ static const char
} }
static char static char
*readAndFindError(const char * confName) *readAndFindError(const char * confName, const char * errmsg)
{ {
int err; int err;
...@@ -185,10 +185,11 @@ static char ...@@ -185,10 +185,11 @@ static char
TEST_catchStderrStart(); TEST_catchStderrStart();
err = CONF_ReadFile(confName, CONF_Add); err = CONF_ReadFile(confName, CONF_Add);
TEST_catchStderrEnd(); TEST_catchStderrEnd();
VMASSERT(err != 0, "No error code during reading config \"%s\": %i", confName, err); VMASSERT(err == -1, "Wrong error code during reading config \"%s\": %i", confName, err);
err = TEST_stderrEquals("Error in trackrdrd_010.conf line 16 (Invalid argument): "\ err = TEST_stderrEquals(errmsg);
"'unknown.module = /my/path/module.so'\n"); VMASSERT(err == 0, "stderr output during parsing config \"%s\" other than expected. " \
VMASSERT(err == 0, "stderr output other than expected: %i", err); "Expected:\n%s",
confName, errmsg);
return NULL; return NULL;
} }
...@@ -197,7 +198,10 @@ static const char ...@@ -197,7 +198,10 @@ static const char
*test_CONF_ReadFile(void) *test_CONF_ReadFile(void)
{ {
printf("... testing CONF_ReadFile\n"); printf("... testing CONF_ReadFile\n");
returnIfNotNull(readAndFindError("trackrdrd_010.conf"));
returnIfNotNull(readAndFindError("trackrdrd_010.conf", \
"Error in trackrdrd_010.conf line 16 (Invalid argument): " \
"'unknown.module = /my/path/module.so'\n"));
return NULL; return NULL;
} }
......
...@@ -85,7 +85,8 @@ TEST_compareFiles(const char * fname1, const char * fname2) ...@@ -85,7 +85,8 @@ TEST_compareFiles(const char * fname1, const char * fname2)
fclose ( fp1 ); fclose ( fp1 );
fclose ( fp2 ); fclose ( fp2 );
if ( ch1 != ch2 ) { if ( ch1 != ch2 ) {
printf(" files differ at line: %i col: %i \n", line, col); printf(" comparing files %s : %s, ", fname1, fname2);
printf("files differ at line: %i col: %i \n", line, col);
return line; return line;
} else { } else {
return 0; return 0;
...@@ -122,7 +123,8 @@ TEST_compareFileWithString(const char * fname, const char * text) ...@@ -122,7 +123,8 @@ TEST_compareFileWithString(const char * fname, const char * text)
} while ((ch1 != EOF) && (ch2 != '\0') && (ch1 == ch2)); } while ((ch1 != EOF) && (ch2 != '\0') && (ch1 == ch2));
fclose ( fp1 ); fclose ( fp1 );
if ( ch1 != EOF || ch2 != '\0' ) { if ( ch1 != EOF || ch2 != '\0' ) {
printf(" file differs at line: %i col: %i \n", line, col); printf(" comparing file %s with text, ", fname);
printf("file differs at line: %i col: %i \n", line, col);
return line; return line;
} else { } else {
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment