You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-03 00:26:59 +02:00
Only run test-level stack trace by default for unit-tested modules.
This amends 70c30dfb
which disabled test tracing in general.
Instead, only enable test tracing by default for modules that are being unit tested. This saves lots of time but still ensures that test tracing is working and helps with debugging in unit tests.
Also rename the option to --debug-test-trace for a clarity.
This commit is contained in:
@ -124,7 +124,7 @@
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<p>Disable test-level stack trace by default.</p>
|
||||
<p>Only run test-level stack trace by default for unit-tested modules.</p>
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
|
@ -291,7 +291,7 @@ Function Test Macros
|
||||
In debug builds these macros will update the stack trace with function names and parameters but not log. In production builds all
|
||||
test macros are compiled out.
|
||||
***********************************************************************************************************************************/
|
||||
#ifdef DEBUG_TRACE
|
||||
#ifdef DEBUG_TEST_TRACE
|
||||
#define FUNCTION_TEST_BEGIN() \
|
||||
if (stackTraceTest()) \
|
||||
{ \
|
||||
|
@ -176,7 +176,7 @@ infoArchiveIdHistoryMatch(
|
||||
strPtr(pgVersionToStr(pgVersion)), pgSystemId);
|
||||
}
|
||||
|
||||
FUNCTION_TEST_RETURN(archiveId);
|
||||
FUNCTION_LOG_RETURN(STRING, archiveId);
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -74,7 +74,7 @@ sub new
|
||||
$self->{bBackTrace},
|
||||
$self->{bProfile},
|
||||
$self->{bDebug},
|
||||
$self->{bDebugTrace},
|
||||
$self->{bDebugTestTrace},
|
||||
) =
|
||||
logDebugParam
|
||||
(
|
||||
@ -102,7 +102,7 @@ sub new
|
||||
{name => 'bBackTrace'},
|
||||
{name => 'bProfile'},
|
||||
{name => 'bDebug'},
|
||||
{name => 'bDebugTrace'},
|
||||
{name => 'bDebugTestTrace'},
|
||||
);
|
||||
|
||||
# Set try to 0
|
||||
@ -391,7 +391,7 @@ sub run
|
||||
($self->{oTest}->{&TEST_DEBUG_UNIT_SUPPRESS} ? '' : " -DDEBUG_UNIT") .
|
||||
(vmWithBackTrace($self->{oTest}->{&TEST_VM}) && $self->{bBackTrace} ? ' -DWITH_BACKTRACE' : '') .
|
||||
($self->{oTest}->{&TEST_CDEF} ? " $self->{oTest}->{&TEST_CDEF}" : '') .
|
||||
($self->{bDebug} ? '' : ' -DNDEBUG') . ($self->{bDebugTrace} ? ' -DDEBUG_TRACE' : '');
|
||||
($self->{bDebug} ? '' : ' -DNDEBUG') . ($self->{bDebugTestTrace} ? ' -DDEBUG_TEST_TRACE' : '');
|
||||
|
||||
# Flags used to buid harness files
|
||||
my $strHarnessFlags =
|
||||
@ -404,6 +404,7 @@ sub run
|
||||
my $strTestFlags =
|
||||
'-Werror -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wswitch-enum -Wconversion -Wformat=2' .
|
||||
' -Wformat-nonliteral -Wstrict-prototypes -Wpointer-arith -Wvla' .
|
||||
' -DDEBUG_TEST_TRACE' .
|
||||
($self->{oTest}->{&TEST_VM} eq VM_U16 || $self->{oTest}->{&TEST_VM} eq VM_U18 ?
|
||||
' -Wformat-signedness' : '') .
|
||||
($self->{oTest}->{&TEST_VM} eq VM_U18 ?
|
||||
|
10
test/test.pl
10
test/test.pl
@ -96,7 +96,7 @@ test.pl [options]
|
||||
--backtrace enable backtrace when available (adds stack trace line numbers -- very slow)
|
||||
--profile generate profile info
|
||||
--no-debug don't generate a debug build
|
||||
--debug-trace stack trace for low-level functions (slow, esp w/valgrind, may cause timeouts)
|
||||
--debug-test-trace test stack trace for low-level functions (slow, esp w/valgrind, may cause timeouts)
|
||||
|
||||
Configuration Options:
|
||||
--psql-bin path to the psql executables (e.g. /usr/lib/postgresql/9.3/bin/)
|
||||
@ -160,7 +160,7 @@ my $bExpect = false;
|
||||
my $bNoValgrind = false;
|
||||
my $bNoOptimize = false;
|
||||
my $bNoDebug = false;
|
||||
my $bDebugTrace = false;
|
||||
my $bDebugTestTrace = false;
|
||||
my $iRetry = 0;
|
||||
|
||||
GetOptions ('q|quiet' => \$bQuiet,
|
||||
@ -203,7 +203,7 @@ GetOptions ('q|quiet' => \$bQuiet,
|
||||
'no-valgrind' => \$bNoValgrind,
|
||||
'no-optimize' => \$bNoOptimize,
|
||||
'no-debug', => \$bNoDebug,
|
||||
'debug-trace', => \$bDebugTrace,
|
||||
'debug-test-trace', => \$bDebugTestTrace,
|
||||
'retry=s' => \$iRetry)
|
||||
or pod2usage(2);
|
||||
|
||||
@ -816,7 +816,7 @@ eval
|
||||
(vmWithBackTrace($strBuildVM) && $bNoLint && $bBackTrace ? ' -DWITH_BACKTRACE' : '');
|
||||
my $strLdExtra = vmWithBackTrace($strBuildVM) && $bNoLint && $bBackTrace ? '-lbacktrace' : '';
|
||||
my $strCDebug =
|
||||
(vmDebugIntegration($strBuildVM) ? '' : '-DNDEBUG') . ($bDebugTrace ? ' -DDEBUG_TRACE' : '');
|
||||
(vmDebugIntegration($strBuildVM) ? '' : '-DNDEBUG') . ($bDebugTestTrace ? ' -DDEBUG_TEST_TRACE' : '');
|
||||
|
||||
executeTest(
|
||||
'docker exec -i test-build' .
|
||||
@ -1231,7 +1231,7 @@ eval
|
||||
my $oJob = new pgBackRestTest::Common::JobTest(
|
||||
$oStorageTest, $strBackRestBase, $strTestPath, $strCoveragePath, $$oyTestRun[$iTestIdx], $bDryRun, $bVmOut,
|
||||
$iVmIdx, $iVmMax, $iTestIdx, $iTestMax, $strLogLevel, $strLogLevelTest, $bLogForce, $bShowOutputAsync, $bNoCleanup, $iRetry,
|
||||
!$bNoValgrind, !$bNoCoverage, !$bNoOptimize, $bBackTrace, $bProfile, !$bNoDebug, $bDebugTrace);
|
||||
!$bNoValgrind, !$bNoCoverage, !$bNoOptimize, $bBackTrace, $bProfile, !$bNoDebug, $bDebugTestTrace);
|
||||
$iTestIdx++;
|
||||
|
||||
if ($oJob->run())
|
||||
|
Reference in New Issue
Block a user