diff options
author | Chris Wilson <chris+github@qwirx.com> | 2007-03-10 16:23:12 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2007-03-10 16:23:12 +0000 |
commit | a80c159997a4ec2eb79ec06f9363d73c3189ee95 (patch) | |
tree | fea24bdbed137b040a3a6a97217a6a431491589c | |
parent | 7ee217c02aa7265f3253781b1a4eece198fb6e3d (diff) |
Report file and line of memory leak test failures (refs #3, merges [714])
-rw-r--r-- | lib/common/Test.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/common/Test.h b/lib/common/Test.h index 6a517b1a..3b7b28e4 100644 --- a/lib/common/Test.h +++ b/lib/common/Test.h @@ -303,12 +303,21 @@ inline int LaunchServer(const char *pCommandLine, const char *pidFile) return pid; } -inline void TestRemoteProcessMemLeaks(const char *filename) +#define TestRemoteProcessMemLeaks(filename) \ + TestRemoteProcessMemLeaksFunc(filename, __FILE__, __LINE__) + +inline void TestRemoteProcessMemLeaksFunc(const char *filename, + const char* file, int line) { #ifdef BOX_MEMORY_LEAK_TESTING // Does the file exist? if(!TestFileExists(filename)) { + if (failures == 0) + { + first_fail_file = file; + first_fail_line = line; + } ++failures; printf("FAILURE: MemLeak report not available (file %s)\n", filename); } @@ -317,8 +326,14 @@ inline void TestRemoteProcessMemLeaks(const char *filename) // Is it empty? if(TestGetFileSize(filename) > 0) { + if (failures == 0) + { + first_fail_file = file; + first_fail_line = line; + } ++failures; - printf("FAILURE: Memory leaks found in other process (file %s)\n==========\n", filename); + printf("FAILURE: Memory leaks found in other process " + "(file %s)\n==========\n", filename); FILE *f = fopen(filename, "r"); char line[512]; while(::fgets(line, sizeof(line), f) != 0) |