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
}
static char
*readAndFindError(const char * confName)
*readAndFindError(const char * confName, const char * errmsg)
{
int err;
......@@ -185,10 +185,11 @@ static char
TEST_catchStderrStart();
err = CONF_ReadFile(confName, CONF_Add);
TEST_catchStderrEnd();
VMASSERT(err != 0, "No error code during reading config \"%s\": %i", confName, err);
err = TEST_stderrEquals("Error in trackrdrd_010.conf line 16 (Invalid argument): "\
"'unknown.module = /my/path/module.so'\n");
VMASSERT(err == 0, "stderr output other than expected: %i", err);
VMASSERT(err == -1, "Wrong error code during reading config \"%s\": %i", confName, err);
err = TEST_stderrEquals(errmsg);
VMASSERT(err == 0, "stderr output during parsing config \"%s\" other than expected. " \
"Expected:\n%s",
confName, errmsg);
return NULL;
}
......@@ -197,7 +198,10 @@ static const char
*test_CONF_ReadFile(void)
{
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;
}
......
......@@ -85,7 +85,8 @@ TEST_compareFiles(const char * fname1, const char * fname2)
fclose ( fp1 );
fclose ( fp2 );
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;
} else {
return 0;
......@@ -122,7 +123,8 @@ TEST_compareFileWithString(const char * fname, const char * text)
} while ((ch1 != EOF) && (ch2 != '\0') && (ch1 == ch2));
fclose ( fp1 );
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;
} else {
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