[Box Backup-dev] COMMIT r714 - box/chris/general/lib/common
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sat Aug 5 21:25:37 BST 2006
Author: chris
Date: 2006-08-05 20:25:33 +0000 (Sat, 05 Aug 2006)
New Revision: 714
Modified:
box/chris/general/lib/common/Test.h
Log:
* Test.h
- Report failing file and line when memory leaks are detected by
TestRemoteProcessMemLeaks()
Modified: box/chris/general/lib/common/Test.h
===================================================================
--- box/chris/general/lib/common/Test.h 2006-08-05 20:24:34 UTC (rev 713)
+++ box/chris/general/lib/common/Test.h 2006-08-05 20:25:33 UTC (rev 714)
@@ -235,12 +235,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);
}
@@ -249,8 +258,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)
More information about the Boxbackup-dev
mailing list