mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Add --no-back-trace option to test.pl.
Running valgrind and backtrace together has been causing tests to timeout in CI, mostly likely due to limited resources. This has not been a problem in normal development environments. Since it is still important to run backtraces for debugging, split the u22 test that was doing all this work to run coverage and backtrace together and valgrind-only as a separate test. As a bonus these tests run faster separately and since they run in parallel the total execution time is faster.
This commit is contained in:
parent
16c625353d
commit
a28f3d49c2
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@ -40,8 +40,11 @@ jobs:
|
||||
# All integration tests
|
||||
- param: test --vm=u22 --param=build-package --param=module=mock --param=module=real
|
||||
|
||||
# All unit tests with coverage and alternate timezone
|
||||
- param: test --vm=u22 --param=c-only --param=tz=America/New_York
|
||||
# All unit tests with coverage, backtrace and alternate timezone
|
||||
- param: test --vm=u22 --param=c-only --param=no-valgrind --param=tz=America/New_York
|
||||
|
||||
# All unit tests with valgrind (disable coverage and backtrace for performance)
|
||||
- param: test --vm=u22 --param=c-only --param=no-coverage --param=no-back-trace
|
||||
|
||||
# All unit tests on the newest gcc available
|
||||
- param: test --vm=f36 --param=c-only --param=no-valgrind --param=no-coverage --param=no-performance
|
||||
|
@ -65,6 +65,7 @@ sub new
|
||||
$self->{bShowOutputAsync},
|
||||
$self->{bNoCleanup},
|
||||
$self->{iRetry},
|
||||
$self->{bBackTraceUnit},
|
||||
$self->{bValgrindUnit},
|
||||
$self->{bCoverageUnit},
|
||||
$self->{bCoverageSummary},
|
||||
@ -97,6 +98,7 @@ sub new
|
||||
{name => 'bShowOutputAsync'},
|
||||
{name => 'bNoCleanup'},
|
||||
{name => 'iRetry'},
|
||||
{name => 'bBackTraceUnit'},
|
||||
{name => 'bValgrindUnit'},
|
||||
{name => 'bCoverageUnit'},
|
||||
{name => 'bCoverageSummary'},
|
||||
@ -261,7 +263,7 @@ sub run
|
||||
' --repo-path=' . $self->{strTestPath} . '/repo' . ' --test-path=' . $self->{strTestPath} .
|
||||
" --log-level=$self->{strLogLevel}" . ' --vm=' . $self->{oTest}->{&TEST_VM} .
|
||||
' --vm-id=' . $self->{iVmIdx} . ($self->{bProfile} ? ' --profile' : '') .
|
||||
($bCoverage ? '' : ' --no-coverage') . ' test ' .
|
||||
($self->{bBackTraceUnit} ? '' : ' --no-back-trace') . ($bCoverage ? '' : ' --no-coverage') . ' test ' .
|
||||
$self->{oTest}->{&TEST_MODULE} . '/' . $self->{oTest}->{&TEST_NAME} . " && \\\n" .
|
||||
# Allow stderr to be copied to stderr and stdout
|
||||
"exec 3>&1 && \\\n" .
|
||||
|
@ -32,6 +32,13 @@ optionGroup:
|
||||
option:
|
||||
# General options
|
||||
#---------------------------------------------------------------------------------------------------------------------------------
|
||||
back-trace:
|
||||
type: boolean
|
||||
default: true
|
||||
negate: true
|
||||
command:
|
||||
test: {}
|
||||
|
||||
buffer-size:
|
||||
type: size
|
||||
internal: true
|
||||
|
@ -21,6 +21,16 @@
|
||||
<option id="spool-path"><summary></summary><text><p></p></text></option>
|
||||
<option id="stanza"><summary></summary><text><p></p></text></option>
|
||||
|
||||
<option id="back-trace">
|
||||
<summary>Enable back trace.</summary>
|
||||
|
||||
<text>
|
||||
<p>Back tracing helps with debugging by showing more detail about were an error happened.</p>
|
||||
</text>
|
||||
|
||||
<example>false</example>
|
||||
</option>
|
||||
|
||||
<option id="buffer-size">
|
||||
<summary>Buffer size for I/O operations.</summary>
|
||||
|
||||
|
@ -31,7 +31,7 @@ TestBuild *
|
||||
testBldNew(
|
||||
const String *const pathRepo, const String *const pathTest, const String *const vm, const unsigned int vmId,
|
||||
const TestDefModule *const module, const unsigned int test, const uint64_t scale, const LogLevel logLevel, const bool logTime,
|
||||
const String *const timeZone, const bool coverage, const bool profile, const bool optimize)
|
||||
const String *const timeZone, const bool coverage, const bool profile, const bool optimize, const bool backTrace)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STRING, pathRepo);
|
||||
@ -47,6 +47,7 @@ testBldNew(
|
||||
FUNCTION_LOG_PARAM(BOOL, coverage);
|
||||
FUNCTION_LOG_PARAM(BOOL, profile);
|
||||
FUNCTION_LOG_PARAM(BOOL, optimize);
|
||||
FUNCTION_LOG_PARAM(BOOL, backTrace);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
ASSERT(pathRepo != NULL);
|
||||
@ -79,6 +80,7 @@ testBldNew(
|
||||
.coverage = coverage,
|
||||
.profile = profile,
|
||||
.optimize = optimize,
|
||||
.backTrace = backTrace,
|
||||
},
|
||||
};
|
||||
|
||||
@ -377,6 +379,13 @@ testBldUnit(TestBuild *const this)
|
||||
// Comment out subdirs that are not used for testing
|
||||
strReplace(mesonBuild, STRDEF("subdir('"), STRDEF("# subdir('"));
|
||||
|
||||
if (!testBldBackTrace(this))
|
||||
{
|
||||
strReplace(
|
||||
mesonBuild, STRDEF(" configuration.set('HAVE_LIBBACKTRACE'"),
|
||||
STRDEF("# configuration.set('HAVE_LIBBACKTRACE'"));
|
||||
}
|
||||
|
||||
// Write build.auto.in
|
||||
strCatZ(
|
||||
mesonBuild,
|
||||
@ -532,8 +541,18 @@ testBldUnit(TestBuild *const this)
|
||||
" '%s/src',\n"
|
||||
" '%s/test/src',\n"
|
||||
" ),\n"
|
||||
" dependencies: [\n"
|
||||
" lib_backtrace,\n"
|
||||
" dependencies: [\n",
|
||||
strZ(pathRepoRel), strZ(pathRepoRel));
|
||||
|
||||
if (testBldBackTrace(this))
|
||||
{
|
||||
strCatZ(
|
||||
mesonBuild,
|
||||
" lib_backtrace,\n");
|
||||
}
|
||||
|
||||
strCatZ(
|
||||
mesonBuild,
|
||||
" lib_bz2,\n"
|
||||
" lib_openssl,\n"
|
||||
" lib_lz4,\n"
|
||||
@ -543,8 +562,7 @@ testBldUnit(TestBuild *const this)
|
||||
" lib_z,\n"
|
||||
" lib_zstd,\n"
|
||||
" ],\n"
|
||||
")\n",
|
||||
strZ(pathRepoRel), strZ(pathRepoRel));
|
||||
")\n");
|
||||
|
||||
testBldWrite(storageUnit, storageUnitList, "meson.build", BUFSTR(mesonBuild));
|
||||
|
||||
|
@ -21,7 +21,7 @@ Constructors
|
||||
TestBuild *testBldNew(
|
||||
const String *pathRepo, const String *pathTest, const String *const vm, unsigned int vmId, const TestDefModule *module,
|
||||
unsigned int test, uint64_t scale, LogLevel logLevel, bool logTime, const String *timeZone, bool coverage, bool profile,
|
||||
bool optimize);
|
||||
bool optimize, bool backTrace);
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Getters/Setters
|
||||
@ -43,6 +43,7 @@ typedef struct TestBuildPub
|
||||
bool coverage; // Generate coverage?
|
||||
bool profile; // Generate profile report?
|
||||
bool optimize; // Optimize code?
|
||||
bool backTrace; // Run with back trace?
|
||||
TestDef tstDef; // Test definitions
|
||||
} TestBuildPub;
|
||||
|
||||
@ -152,6 +153,13 @@ testBldScale(const TestBuild *const this)
|
||||
return THIS_PUB(TestBuild)->scale;
|
||||
}
|
||||
|
||||
// Run with back trace?
|
||||
FN_INLINE_ALWAYS bool
|
||||
testBldBackTrace(const TestBuild *const this)
|
||||
{
|
||||
return THIS_PUB(TestBuild)->backTrace;
|
||||
}
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Functions
|
||||
***********************************************************************************************************************************/
|
||||
|
@ -75,7 +75,7 @@ void
|
||||
cmdTest(
|
||||
const String *const pathRepo, const String *const pathTest, const String *const vm, const unsigned int vmId,
|
||||
const String *moduleName, const unsigned int test, const uint64_t scale, const LogLevel logLevel, const bool logTime,
|
||||
const String *const timeZone, const bool coverage, const bool profile, const bool optimize)
|
||||
const String *const timeZone, const bool coverage, const bool profile, const bool optimize, const bool backTrace)
|
||||
{
|
||||
FUNCTION_LOG_BEGIN(logLevelDebug);
|
||||
FUNCTION_LOG_PARAM(STRING, pathRepo);
|
||||
@ -91,6 +91,7 @@ cmdTest(
|
||||
FUNCTION_LOG_PARAM(BOOL, coverage);
|
||||
FUNCTION_LOG_PARAM(BOOL, profile);
|
||||
FUNCTION_LOG_PARAM(BOOL, optimize);
|
||||
FUNCTION_LOG_PARAM(BOOL, backTrace);
|
||||
FUNCTION_LOG_END();
|
||||
|
||||
MEM_CONTEXT_TEMP_BEGIN()
|
||||
@ -118,7 +119,8 @@ cmdTest(
|
||||
{
|
||||
// Build unit
|
||||
TestBuild *const testBld = testBldNew(
|
||||
pathRepo, pathTest, vm, vmId, module, test, scale, logLevel, logTime, timeZone, coverage, profile, optimize);
|
||||
pathRepo, pathTest, vm, vmId, module, test, scale, logLevel, logTime, timeZone, coverage, profile, optimize,
|
||||
backTrace);
|
||||
testBldUnit(testBld);
|
||||
|
||||
// Meson setup
|
||||
|
@ -15,6 +15,6 @@ Functions
|
||||
void cmdTest(
|
||||
const String *pathRepo, const String *pathTest, const String *const vm, unsigned int vmId, const String *moduleName,
|
||||
unsigned int test, uint64_t scale, LogLevel logLevel, bool logTime, const String *timeZone, bool coverage, bool profile,
|
||||
bool optimize);
|
||||
bool optimize, bool backTrace);
|
||||
|
||||
#endif
|
||||
|
@ -76,7 +76,7 @@ main(int argListSize, const char *argList[])
|
||||
cfgOptionTest(cfgOptTest) ? cfgOptionUInt(cfgOptTest) : 0, cfgOptionUInt64(cfgOptScale),
|
||||
logLevelEnum(cfgOptionStrId(cfgOptLogLevelTest)), cfgOptionBool(cfgOptLogTimestamp),
|
||||
cfgOptionStrNull(cfgOptTz), cfgOptionBool(cfgOptCoverage), cfgOptionBool(cfgOptProfile),
|
||||
cfgOptionBool(cfgOptOptimize));
|
||||
cfgOptionBool(cfgOptOptimize), cfgOptionBool(cfgOptBackTrace));
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("none"), 3,
|
||||
STRDEF("common/stack-trace"), 0, 1, logLevelDebug, true, NULL, false, false, false),
|
||||
STRDEF("common/stack-trace"), 0, 1, logLevelDebug, true, NULL, false, false, false, true),
|
||||
"new build");
|
||||
|
||||
const Storage *storageUnit = storagePosixNewP(STRDEF(TEST_PATH "/test/unit-3/none"));
|
||||
@ -379,7 +379,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("none"), 3,
|
||||
STRDEF("common/error"), 5, 1, logLevelDebug, true, NULL, false, false, false),
|
||||
STRDEF("common/error"), 5, 1, logLevelDebug, true, NULL, false, false, false, true),
|
||||
"new build");
|
||||
|
||||
fileList = testStorageList(storageUnit);
|
||||
@ -568,7 +568,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3,
|
||||
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true, true, true),
|
||||
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true, true, true, true),
|
||||
"new build");
|
||||
|
||||
storageUnit = storagePosixNewP(STRDEF(TEST_PATH "/test/unit-3/uXX"));
|
||||
@ -706,12 +706,16 @@ testRun(void)
|
||||
TEST_RESULT_VOID(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3,
|
||||
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true, true, true),
|
||||
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true, true, true, true),
|
||||
"new build");
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("Test performance/type");
|
||||
|
||||
strReplace(
|
||||
mesonBuildRoot, STRDEF(" configuration.set('HAVE_LIBBACKTRACE'"),
|
||||
STRDEF("# configuration.set('HAVE_LIBBACKTRACE'"));
|
||||
|
||||
HRN_STORAGE_PUT_Z(
|
||||
storageTest, "repo/test/src/module/performance/typeTest.c",
|
||||
"static void\n"
|
||||
@ -731,7 +735,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3,
|
||||
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, true, false),
|
||||
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, true, false, false),
|
||||
"new build");
|
||||
|
||||
TEST_RESULT_LOG(
|
||||
@ -801,7 +805,6 @@ testRun(void)
|
||||
" '../../../repo/test/src',\n"
|
||||
" ),\n"
|
||||
" dependencies: [\n"
|
||||
" lib_backtrace,\n"
|
||||
" lib_bz2,\n"
|
||||
" lib_openssl,\n"
|
||||
" lib_lz4,\n"
|
||||
@ -866,7 +869,7 @@ testRun(void)
|
||||
TEST_RESULT_VOID(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3,
|
||||
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, false, false),
|
||||
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, false, false, false),
|
||||
"new build");
|
||||
|
||||
storageUnit = storagePosixNewP(STRDEF(TEST_PATH "/test/unit-3/uXX"));
|
||||
@ -900,7 +903,7 @@ testRun(void)
|
||||
TEST_ERROR(
|
||||
cmdTest(
|
||||
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3,
|
||||
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, false, false),
|
||||
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, false, false, false),
|
||||
FileOpenError,
|
||||
"build failed for unit performance/type: unable to open file '" TEST_PATH "/repo/meson.build' for read: [13] Permission"
|
||||
" denied");
|
||||
|
@ -80,6 +80,7 @@ test.pl [options]
|
||||
--min-gen only run required code generation
|
||||
--gen-check check that auto-generated files are correct (used in CI to detect changes)
|
||||
--code-count generate code counts
|
||||
--no-back-trace don't run backrace on C unit tests (may be slow with valgrind)
|
||||
--no-valgrind don't run valgrind on C unit tests (saves time)
|
||||
--no-coverage don't run coverage on C unit tests (saves time)
|
||||
--no-coverage-report run coverage but don't generate coverage report (saves time)
|
||||
@ -158,6 +159,7 @@ my $bGenCheck = false;
|
||||
my $bMinGen = false;
|
||||
my $bCodeCount = false;
|
||||
my $bProfile = false;
|
||||
my $bNoBackTrace = false;
|
||||
my $bNoValgrind = false;
|
||||
my $bNoOptimize = false;
|
||||
my $bNoDebug = false;
|
||||
@ -207,6 +209,7 @@ GetOptions ('q|quiet' => \$bQuiet,
|
||||
'min-gen' => \$bMinGen,
|
||||
'code-count' => \$bCodeCount,
|
||||
'profile' => \$bProfile,
|
||||
'no-back-trace' => \$bNoBackTrace,
|
||||
'no-valgrind' => \$bNoValgrind,
|
||||
'no-optimize' => \$bNoOptimize,
|
||||
'no-debug', => \$bNoDebug,
|
||||
@ -266,6 +269,7 @@ eval
|
||||
################################################################################################################################
|
||||
if ($bProfile)
|
||||
{
|
||||
$bNoBackTrace = true;
|
||||
$bNoValgrind = true;
|
||||
$bNoCoverage = true;
|
||||
}
|
||||
@ -1054,8 +1058,8 @@ eval
|
||||
my $oJob = new pgBackRestTest::Common::JobTest(
|
||||
$oStorageTest, $strBackRestBase, $strTestPath, $$oyTestRun[$iTestIdx], $bDryRun, $bVmOut, $iVmIdx, $iVmMax,
|
||||
$strMakeCmd, $iTestIdx, $iTestMax, $strLogLevel, $strLogLevelTest, $strLogLevelTestFile, !$bNoLogTimestamp,
|
||||
$bShowOutputAsync, $bNoCleanup, $iRetry, !$bNoValgrind, !$bNoCoverage, $bCoverageSummary, !$bNoOptimize,
|
||||
$bProfile, $iScale, $strTimeZone, !$bNoDebug, $bDebugTestTrace,
|
||||
$bShowOutputAsync, $bNoCleanup, $iRetry, !$bNoBackTrace, !$bNoValgrind, !$bNoCoverage, $bCoverageSummary,
|
||||
!$bNoOptimize, $bProfile, $iScale, $strTimeZone, !$bNoDebug, $bDebugTestTrace,
|
||||
$iBuildMax / $iVmMax < 1 ? 1 : int($iBuildMax / $iVmMax));
|
||||
$iTestIdx++;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user