Commit 59734e30 authored by Geoff Simmons's avatar Geoff Simmons

style fascism:

* source file line width always <= 80 chars
* continuation lines only where necessary
parent 76cb8540
...@@ -147,7 +147,8 @@ static char ...@@ -147,7 +147,8 @@ static char
err = CONF_ReadDefault(); err = CONF_ReadDefault();
VMASSERT(err == 0, "Error code during reading default config: %i", err); VMASSERT(err == 0, "Error code during reading default config: %i", err);
err = CONF_ReadFile(confName, CONF_Add); err = CONF_ReadFile(confName, CONF_Add);
VMASSERT(err == 0, "Error code during reading config \"%s\": %i", confName, err); VMASSERT(err == 0,
"Error code during reading config \"%s\": %i", confName, err);
// verbose("Config is:\n%s", getConfigContent()); // verbose("Config is:\n%s", getConfigContent());
strcpy(confNameNew, confName); strcpy(confNameNew, confName);
...@@ -185,11 +186,13 @@ static char ...@@ -185,11 +186,13 @@ static char
TEST_catchStderrStart(); TEST_catchStderrStart();
err = CONF_ReadFile(confName, CONF_Add); err = CONF_ReadFile(confName, CONF_Add);
TEST_catchStderrEnd(); TEST_catchStderrEnd();
VMASSERT(err == -1, "Wrong 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(errmsg); err = TEST_stderrEquals(errmsg);
VMASSERT(err == 0, "stderr output during parsing config \"%s\" other than expected. " \ VMASSERT(err == 0,
"Expected:\n%s", "stderr output during parsing config \"%s\" other than expected. "
confName, errmsg); "Expected:\n%s",
confName, errmsg);
return NULL; return NULL;
} }
...@@ -199,9 +202,11 @@ static const char ...@@ -199,9 +202,11 @@ static const char
{ {
printf("... testing CONF_ReadFile\n"); printf("... testing CONF_ReadFile\n");
returnIfNotNull(readAndFindError("trackrdrd_010.conf", \ returnIfNotNull(
"Error in trackrdrd_010.conf line 16 (Invalid argument): " \ readAndFindError("trackrdrd_010.conf",
"'unknown.module = /my/path/module.so'\n")); "Error in trackrdrd_010.conf line 16 "
"(Invalid argument): "
"'unknown.module = /my/path/module.so'\n"));
return NULL; return NULL;
} }
......
...@@ -141,8 +141,9 @@ TEST_catchStdoutStart() ...@@ -141,8 +141,9 @@ TEST_catchStdoutStart()
fflush(stdout); fflush(stdout);
fgetpos(stdout, &stdoutPos); fgetpos(stdout, &stdoutPos);
stdoutBak = dup(fileno(stdout)); stdoutBak = dup(fileno(stdout));
stdoutNew = open(FILE_NAME_STDOUT, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | \ stdoutNew = open(FILE_NAME_STDOUT,
S_IROTH | S_IWOTH); O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
| S_IROTH | S_IWOTH);
dup2(stdoutNew, fileno(stdout)); dup2(stdoutNew, fileno(stdout));
close(stdoutNew); close(stdoutNew);
...@@ -170,8 +171,9 @@ TEST_catchStderrStart() ...@@ -170,8 +171,9 @@ TEST_catchStderrStart()
fgetpos(stdout, &stderrPos); fgetpos(stdout, &stderrPos);
stderrBak = dup(fileno(stderr)); stderrBak = dup(fileno(stderr));
stderrNew = open(FILE_NAME_STDERR, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | \ stderrNew = open(FILE_NAME_STDERR,
S_IROTH | S_IWOTH); O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
| S_IROTH | S_IWOTH);
if (stderrNew < 0) { if (stderrNew < 0) {
perror(NULL); perror(NULL);
return(-1); return(-1);
......
...@@ -49,14 +49,17 @@ ...@@ -49,14 +49,17 @@
#define VERBOSE 1 #define VERBOSE 1
#undef VERBOSE #undef VERBOSE
#ifdef VERBOSE #ifdef VERBOSE
#define verbose(fmt, ...) \ #define verbose(fmt, ...) \
do { printf("%8s:%4d:%20s:>>> "fmt"\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__); } \ do { \
printf("%8s:%4d:%20s:>>> "fmt"\n", __FILE__, __LINE__, __FUNCTION__, \
##__VA_ARGS__); } \
while (0) while (0)
#else #else
#define verbose(fmt, ...) do{ } while ( 0 ) #define verbose(fmt, ...) do{ } while ( 0 )
#endif #endif
#define returnIfNotNull(test) do { const char *msg = test; if (msg) return msg; } while (0) #define returnIfNotNull(test) \
do { const char *msg = test; if (msg) return msg; } while (0)
/***** constants **************************************************************/ /***** constants **************************************************************/
...@@ -99,8 +102,8 @@ extern int TEST_catchStderrStart(void); ...@@ -99,8 +102,8 @@ extern int TEST_catchStderrStart(void);
extern int TEST_catchStderrEnd(void); extern int TEST_catchStderrEnd(void);
/** /**
* Test if files have same content. If the comparison is not successful some info * Test if files have same content. If the comparison is not successful
* is written to stderr. * some info is written to stderr.
* *
* @param fname1 first file. * @param fname1 first file.
* @param fname2 second file. * @param fname2 second file.
...@@ -120,22 +123,24 @@ extern int TEST_compareFiles(const char * fname1, const char * fname2); ...@@ -120,22 +123,24 @@ extern int TEST_compareFiles(const char * fname1, const char * fname2);
extern int TEST_compareFileWithString(const char * fname, const char * text); extern int TEST_compareFileWithString(const char * fname, const char * text);
/** /**
* Test if previously saved stdout equals given text. See TEST_catchStdoutStart() and * Test if previously saved stdout equals given text. See
* TEST_catchStdoutEnd(). * TEST_catchStdoutStart() and TEST_catchStdoutEnd().
* *
* @param text compare stdout with this text. * @param text compare stdout with this text.
* @return 0 on success, a value < 0 if we had problems reading the stdout file and a * @return 0 on success, a value < 0 if we had problems reading the stdout
* line number (starting with 1) if there was a difference in that line. * file and a line number (starting with 1) if there was a difference
* in that line.
*/ */
extern int TEST_stdoutEquals(const char * text); extern int TEST_stdoutEquals(const char * text);
/** /**
* Test if previously saved stderr equals given text. See TEST_catchStderrStart() and * Test if previously saved stderr equals given text. See
* TEST_catchStderrEnd(). * TEST_catchStderrStart() and TEST_catchStderrEnd().
* *
* @param text compare stderr with this text. * @param text compare stderr with this text.
* @return 0 on success, a value < 0 if we had problems reading the stderr file and a * @return 0 on success, a value < 0 if we had problems reading the stderr
* line number (starting with 1) if there was a difference in that line. * file and a line number (starting with 1) if there was a difference
* in that line.
*/ */
extern int TEST_stderrEquals(const char * text); extern int TEST_stderrEquals(const char * text);
......
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