[Box Backup-commit] COMMIT r1388 - box/chris/merge/lib/common
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 10 Mar 2007 16:23:14 +0000
Author: chris
Date: 2007-03-10 16:23:12 +0000 (Sat, 10 Mar 2007)
New Revision: 1388
Modified:
box/chris/merge/lib/common/Test.h
Log:
Report file and line of memory leak test failures (refs #3, merges [714])
Modified: box/chris/merge/lib/common/Test.h
===================================================================
--- box/chris/merge/lib/common/Test.h 2007-03-10 16:12:01 UTC (rev 1387)
+++ box/chris/merge/lib/common/Test.h 2007-03-10 16:23:12 UTC (rev 1388)
@@ -303,12 +303,21 @@
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 @@
// 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)