diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 032b44db8..e1dec82bc 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -302,7 +302,6 @@ sub run "\n" . "CFLAGS_TEST =" . " \\\n\t" . (($self->{bOptimize} && ($self->{bProfile} || $bPerformance)) ? '-O2' : '-O0') . - " \\\n\t-DDEBUG_MEM" . (!$self->{bDebugTestTrace} && $self->{bDebug} ? " \\\n\t-DDEBUG_TEST_TRACE" : '') . ($bCoverage ? " \\\n\t-fprofile-arcs -ftest-coverage" : '') . ($self->{oTest}->{&TEST_VM} eq VM_NONE ? '' : " \\\n\t-DTEST_CONTAINER_REQUIRED") . diff --git a/test/src/test.c b/test/src/test.c index c6c728247..51fe79ea1 100644 --- a/test/src/test.c +++ b/test/src/test.c @@ -5,6 +5,11 @@ This wrapper runs the C unit tests. ***********************************************************************************************************************************/ #include "build.auto.h" +// This must be before all includes except build.auto.h +#ifdef HRN_FEATURE_MEMCONTEXT + #define DEBUG_MEM +#endif + /*********************************************************************************************************************************** C files to be tested @@ -168,7 +173,11 @@ main(int argListSize, const char *argList[]) // Initialize statistics #if defined(HRN_INTEST_STAT) || defined(HRN_FEATURE_STAT) - statInit(); + MEM_CONTEXT_TEMP_BEGIN() + { + statInit(); + } + MEM_CONTEXT_TEMP_END(); #endif // Set neutral umask for testing @@ -212,8 +221,18 @@ main(int argListSize, const char *argList[]) TRY_BEGIN() { #endif - // Run the tests - testRun(); + +#ifdef HRN_FEATURE_MEMCONTEXT + MEM_CONTEXT_TEMP_BEGIN() + { +#endif + // Run the tests + testRun(); +#ifdef HRN_FEATURE_MEMCONTEXT + } + MEM_CONTEXT_TEMP_END(); +#endif + #ifdef HRN_FEATURE_ERROR } CATCH_ANY()