1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-09-16 09:06:18 +02:00

Update unit tests to work with Alpine Linux and musl libc.

A few bugs have been reported over the years on Alpine with musl libc and generally it has been possible to figure them out without testing on that platform but a few newer ones cannot be reproduced elsewhere.

Also, testing with additional libc implementations helps portability so it makes sense to add support.

For the most part musl libc works as expected with a few caveats:

1) The FD_*() macros won't accept an int file descriptor without warning when -Wsign-conversion is enabled. I opened https://www.openwall.com/lists/musl/2025/05/23/4 to discuss this and I was referred to https://www.openwall.com/lists/musl/2024/07/16/1 which explains why this happens. It was not a very satisfying answer but clearly it is not going to be addressed so a meson probe was added to detect the issue and disable the warning.

2) Floating point numbers are rounded differently than in GNU/Mac libc when formatted with printf() and friends. This is fine for the core code but causes issues in the unit tests that expect log entries to match exactly. This was solved in ad7ba46b by adding our own rough and ready formatting routines.

3) Some error messages are different from GNU/Mac libc. This was solved with a new error macro that accepts multiple messages in b5fbb16c.

4) For some reason ninja on Alpine outputs "nothing to do" messages to stderr whereas they go to stdout on other distributions. Redirecting stderr to stdout is our standard fix for this issue so do that. A non-zero result code will let us know that something has gone wrong.

5) It appears that profiling is not supported on Alpine, which is pretty surprising. For now fix this by only unit testing the profiling code when coverage is enabled. This is not a great solution since we would rather test profiling on any system that supports it but for now this will do.
This commit is contained in:
David Steele
2025-06-05 17:33:18 -04:00
parent b5fbb16cce
commit 8aa2d88bac
14 changed files with 208 additions and 36 deletions

View File

@@ -49,6 +49,9 @@ jobs:
# All unit tests on the newest gcc available
- param: test --vm=f41 --param=c-only --param=no-valgrind --param=no-coverage --param=no-performance
# All unit tests on musl libc
- param: test --vm=a321 --param=c-only --param=no-coverage --param=no-performance
# RHEL documentation
- param: doc --vm=rh8

View File

@@ -204,6 +204,15 @@ if lib_zstd.found()
configuration.set('HAVE_LIBZST', true, description: 'Is libzstd present?')
endif
# Suppress -Wsign-conversion for C libraries (e.g. musl) that do no accept int without warning for FD_*() macros
if not cc.compiles(
'''#include <sys/select.h>
int main(int arg, char **argv) {int fd = 1; fd_set s; FD_ZERO(&s); FD_SET(fd, &s); FD_ISSET(fd, &s);}''',
args: ['-Wsign-conversion', '-Werror'])
message('Disabling -Wsign-conversion because int is not accepted without warning by FD_*() macros')
add_project_arguments(cc.get_supported_arguments('-Wno-sign-conversion'), language: 'c')
endif
# Check if the C compiler supports _Static_assert()
if cc.compiles('''int main(int arg, char **argv) {({ _Static_assert(1, "foo");});} ''')
configuration.set('HAVE_STATIC_ASSERT', true, description: 'Does the compiler provide _Static_assert()?')

View File

@@ -557,6 +557,9 @@ cvtTimeToZ(const char *const format, const time_t value, char *const buffer, con
FUNCTION_TEST_END();
ASSERT(buffer != NULL);
// Musl libc does not behave like other C libraries when formatting %s as output from gmtime_r() so forbid it entirely, see
// https://www.openwall.com/lists/musl/2025/06/02/3 for details.
ASSERT(!param.utc || strstr(format, "%s") == NULL);
struct tm timePart;

View File

@@ -12,6 +12,10 @@
# - docker login -u pgbackrest
# - DATE=YYYYMMDDX;VM=X;ARCH=X;BASE=pgbackrest/test:${VM?}-base-${ARCH?};docker tag ${BASE?} ${BASE?}-${DATE?} && docker push ${BASE?}-${DATE?}
# **********************************************************************************************************************************
20250605A:
x86_64:
a321: dab99d91eed1710c68dae28efa5cd0e27e0a7f60
20250509A:
ppc64le:
u22: b6461e07d86205488f861ad25e7a46442c2ee990

View File

@@ -150,7 +150,16 @@ sub groupCreate
my $strName = shift;
my $iId = shift;
return "groupadd -f -g${iId} ${strName}";
my $oVm = vmGet();
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL || $$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
return "groupadd -f -g${iId} ${strName}";
}
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
return "addgroup -g${iId} ${strName}";
}
}
sub userCreate
@@ -166,7 +175,7 @@ sub userCreate
{
return "adduser -g${strGroup} -u${iId} -N ${strName}";
}
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN || $$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
return "adduser --uid=${iId} --ingroup=${strGroup} --disabled-password --gecos \"\" ${strName}";
}
@@ -277,7 +286,7 @@ sub caSetup
{
$strCertFile = '/etc/pki/ca-trust/source/anchors';
}
elsif ($strOsBase eq VM_OS_BASE_DEBIAN)
elsif ($strOsBase eq VM_OS_BASE_DEBIAN || $strOsBase eq VM_OS_BASE_ALPINE)
{
$strCertFile = '/usr/local/share/ca-certificates';
}
@@ -301,7 +310,7 @@ sub caSetup
$strScript .=
" update-ca-trust extract";
}
elsif ($strOsBase eq VM_OS_BASE_DEBIAN)
elsif ($strOsBase eq VM_OS_BASE_DEBIAN || $strOsBase eq VM_OS_BASE_ALPINE)
{
$strScript .=
" update-ca-certificates";
@@ -327,10 +336,14 @@ sub entryPointSetup
{
$strScript .= 'rm -rf /run/nologin && /usr/sbin/sshd -D';
}
else
elsif ($oVm->{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
$strScript .= 'service ssh restart && bash';
}
elsif ($oVm->{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
$strScript .= '/usr/sbin/sshd -D';
}
return $strScript;
}
@@ -413,7 +426,7 @@ sub containerBuild
" libyaml-devel zlib-devel libxml2-devel lz4-devel lz4 bzip2-devel bzip2 perl-JSON-PP ccache meson \\\n" .
" libssh2-devel";
}
else
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
$strScript .=
" export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive && \\\n" .
@@ -430,6 +443,15 @@ sub containerBuild
$strScript .= " valgrind";
}
}
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
$strScript .=
" apk update && \\\n" .
" apk add --no-cache sudo openssh git rsync tzdata openssh ca-certificates openrc bash && \\\n" .
" rc-update add sshd && \\\n" .
" apk add --no-cache meson build-base libpq-dev openssl-dev libxml2-dev pkgconfig lz4-dev bzip2-dev\\\n" .
" openssh-keygen zlib-dev yaml-dev libssh2-dev perl perl-yaml-libyaml valgrind lz4";
}
# Add zst command-line tool and development libs when available
if (vmWithZst($strOS))
@@ -438,10 +460,14 @@ sub containerBuild
{
$strScript .= ' zstd libzstd-devel';
}
else
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
$strScript .= ' zstd libzstd-dev';
}
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
$strScript .= ' zstd zstd-dev';
}
}
#---------------------------------------------------------------------------------------------------------------------------
@@ -464,8 +490,11 @@ sub containerBuild
#---------------------------------------------------------------------------------------------------------------------------
if (!$bDeprecated)
{
$strScript .= sectionHeader() .
"# Install PostgreSQL packages\n";
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL || $$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
$strScript .= sectionHeader() .
"# Install PostgreSQL packages\n";
}
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_RHEL)
{
@@ -490,7 +519,7 @@ sub containerBuild
$strScript .= " yum -y install postgresql-devel";
}
else
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
# Install repo from apt.postgresql.org
if (vmPgRepo($strVm))
@@ -518,10 +547,14 @@ sub containerBuild
{
$strScript .= " yum -y install";
}
else
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
$strScript .= " apt-get install -y --no-install-recommends";
}
}
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
$strScript .= " apk add --no-cache";
}
# Construct list of databases to install
foreach my $strDbVersion (@{$oOS->{&VM_DB}})
@@ -539,7 +572,7 @@ sub containerBuild
$strScript .= " postgresql${strDbVersionNoDot}-devel";
}
}
else
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_DEBIAN)
{
# Disable PostgreSQL 18 on architectures that do not support it yet
next if ($strDbVersion eq '18' &&
@@ -547,6 +580,10 @@ sub containerBuild
$strScript .= " postgresql-${strDbVersion}";
}
elsif ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
$strScript .= " postgresql${strDbVersion}";
}
}
}
}
@@ -626,6 +663,14 @@ sub containerBuild
' mkdir -m 750 /home/' . TEST_USER . "/test && \\\n" .
' chown ' . TEST_USER . ':' . TEST_GROUP . ' /home/' . TEST_USER . "/test";
# On Alpine the test account must have a password for SSH logon
if ($$oVm{$strOS}{&VM_OS_BASE} eq VM_OS_BASE_ALPINE)
{
$strScript .=
" && \\\n" .
" passwd -d '" . TEST_USER . "' " . TEST_USER;
}
$strScript .= sectionHeader() .
"# Configure sudo\n";

View File

@@ -51,6 +51,8 @@ use constant VMDEF_WITH_ZST => 'with-zst
####################################################################################################################################
# Valid OS base List
####################################################################################################################################
use constant VM_OS_BASE_ALPINE => 'alpine';
push @EXPORT, qw(VM_OS_BASE_ALPINE);
use constant VM_OS_BASE_DEBIAN => 'debian';
push @EXPORT, qw(VM_OS_BASE_DEBIAN);
use constant VM_OS_BASE_RHEL => 'rhel';
@@ -75,6 +77,8 @@ use constant VM_ALL => 'all';
use constant VM_NONE => 'none';
push @EXPORT, qw(VM_NONE);
use constant VM_A321 => 'a321';
push @EXPORT, qw(VM_A321);
use constant VM_D11 => 'd11';
push @EXPORT, qw(VM_D11);
use constant VM_RH8 => 'rh8';
@@ -113,6 +117,28 @@ my $oyVm =
],
},
# Alpine 3.21
&VM_A321 =>
{
&VM_OS_BASE => VM_OS_BASE_ALPINE,
&VM_IMAGE => 'alpine:3.21',
&VM_ARCH => VM_ARCH_X86_64,
&VMDEF_PG_REPO => false,
&VMDEF_PGSQL_BIN => '/usr/lib/postgresql/{[version]}/bin',
&VMDEF_WITH_ZST => true,
&VM_DB =>
[
PG_VERSION_17,
],
&VM_DB_TEST =>
[
PG_VERSION_17,
],
},
# Debian 11
&VM_D11 =>
{

View File

@@ -388,7 +388,11 @@ testRun(void)
{
printf("%s\n", errorMessage());
assert(errorCode() == AssertError.code);
assert(strcmp(errorMessage(), "message 1: [5] Input/output error") == 0);
assert(
// glibc
strcmp(errorMessage(), "message 1: [5] Input/output error") == 0 ||
// musl libc
strcmp(errorMessage(), "message 1: [5] I/O error") == 0);
}
TRY_END();

View File

@@ -141,16 +141,31 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("exec exits with error");
TEST_ERROR(
TEST_ERROR_MULTI(
execOneP(STRDEF("cat missing.txt")), UnknownError,
"cat missing.txt terminated unexpectedly [1]: cat: missing.txt: No such file or directory");
// glibc
"cat missing.txt terminated unexpectedly [1]: cat: missing.txt: No such file or directory",
// musl libc
"cat missing.txt terminated unexpectedly [1]: cat: can't open 'missing.txt': No such file or directory");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("exec ignores error");
TEST_RESULT_STR_Z(
execOneP(STRDEF("cat missing.txt"), .resultExpect = 1), "cat: missing.txt: No such file or directory\n",
"ignore error");
TRY_BEGIN()
{
TEST_RESULT_STR_Z(
execOneP(STRDEF("cat missing.txt"), .resultExpect = 1), "cat: missing.txt: No such file or directory\n",
"ignore error");
}
CATCH_ANY()
{
hrnTestResultEnd();
TEST_RESULT_STR_Z(
execOneP(STRDEF("cat missing.txt"), .resultExpect = 1),
"cat: can't open 'missing.txt': No such file or directory\n", "ignore error");
}
TRY_END();
}
FUNCTION_HARNESS_RETURN_VOID();

View File

@@ -583,9 +583,12 @@ testRun(void)
{
// Wait for parent to bind port before attempting to bind
HRN_FORK_PARENT_NOTIFY_GET(0);
TEST_ERROR(
TEST_ERROR_MULTI(
sckServerNew(STRDEF("127.0.0.1"), testPort, 100), FileOpenError,
"unable to bind socket: [98] Address already in use");
// Not musl libc
"unable to bind socket: [98] Address already in use",
// Musl libc
"unable to bind socket: [98] Address in use");
TEST_RESULT_VOID(sckServerNew(STRDEF("127.0.0.1"), testPort, 5000), "bind succeeds with enough retries");
}
HRN_FORK_PARENT_END();
@@ -629,8 +632,12 @@ testRun(void)
TEST_ASSIGN(
client, tlsClientNewP(sckClientNew(STRDEF("99.99.99.99.99"), 7777, 0, 0), STRDEF("X"), 100, 0, true), "new client");
TEST_RESULT_STR_Z(ioClientName(client), "99.99.99.99.99:7777", " check name");
TEST_ERROR(
ioClientOpen(client), HostConnectError, "unable to get address for '99.99.99.99.99': [-2] Name or service not known");
TEST_ERROR_MULTI(
ioClientOpen(client), HostConnectError,
// Not musl libc
"unable to get address for '99.99.99.99.99': [-2] Name or service not known",
// Musl libc
"unable to get address for '99.99.99.99.99': [-2] Name does not resolve");
// Set TLS client timeout higher than socket timeout to ensure that TLS retries are covered
TEST_ASSIGN(

View File

@@ -20,14 +20,18 @@ testRun(void)
// Newer glibc
"Unmatched [, [^, [:, [., or [=",
// MacOS
"brackets ([ ]) not balanced");
"brackets ([ ]) not balanced",
// Musl libc
"Missing ']'");
TEST_ERROR_MULTI(
regExpErrorCheck(REG_BADBR), FormatError,
// glibc
"Invalid content of \\{\\}",
// MacOS
"invalid repetition count(s)");
"invalid repetition count(s)",
// Musl libc
"Invalid contents of {}");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("new regexp");

View File

@@ -181,13 +181,13 @@ testRun(void)
hrnTzSet("America/New_York");
TEST_ERROR(cvtTimeToZP("%s", 9999, buffer, 4), AssertError, "buffer overflow");
TEST_ERROR(
cvtTimeToZP("%s", 9999, buffer, sizeof(buffer), .utc = true), AssertError,
"assertion '!param.utc || strstr(format, \"%s\") == NULL' failed");
TEST_RESULT_UINT(cvtTimeToZP("%s", 1573222014, buffer, STACK_TRACE_PARAM_MAX), 10, "local epoch");
TEST_RESULT_Z(buffer, "1573222014", " check buffer");
TEST_RESULT_UINT(cvtTimeToZP("%s", 1573222014, buffer, STACK_TRACE_PARAM_MAX, .utc = true), 10, "utc epoch");
TEST_RESULT_Z(buffer, "1573240014", " check buffer");
TEST_RESULT_UINT(cvtTimeToZP("%Y%m%d-%H%M%S", 1715930051, buffer, STACK_TRACE_PARAM_MAX), 15, "local string");
TEST_RESULT_Z(buffer, "20240517-031411", " check buffer");

View File

@@ -340,9 +340,11 @@ testRun(void)
TEST_RESULT_VOID(protocolHelperClientFree(&protocolHelperClient), "free");
hrnLogReplaceAdd(" \\[10\\] No child process(es){0,1}", "process(es){0,1}", "processes", false);
TEST_RESULT_LOG(
"P00 WARN: unable to write to invalid: [9] Bad file descriptor\n"
"P00 WARN: unable to wait on child process: [10] No child processes");
"P00 WARN: unable to wait on child process: [10] No child [processes]");
}
// *****************************************************************************************************************************

View File

@@ -600,7 +600,13 @@ testRun(void)
TEST_RESULT_VOID(
cmdTest(
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3, STRDEF("invalid"),
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true, true, true, true),
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true,
#ifdef DEBUG_COVERAGE
true,
#else
false,
#endif
true, true),
"new build");
// Older versions of ninja may error on a rebuild so a retry may occur
@@ -655,12 +661,14 @@ testRun(void)
" sources: src_unit,\n"
" c_args: [\n"
" '-O2',\n"
#ifdef DEBUG_COVERAGE
" '-pg',\n"
" '-no-pie',\n"
" ],\n"
" link_args: [\n"
" '-pg',\n"
" '-no-pie',\n"
#endif
" ],\n"
" include_directories:\n"
" include_directories(\n"
@@ -712,9 +720,17 @@ testRun(void)
strReplace(testCDup, STRDEF("{[C_TEST_VM]}"), STRDEF("uXX"));
strReplace(testCDup, STRDEF("{[C_TEST_PG_VERSION]}"), STRDEF("invalid"));
strReplace(testCDup, STRDEF("{[C_TEST_LOG_EXPECT]}"), STRDEF("true"));
#ifdef DEBUG_COVERAGE
strReplace(testCDup, STRDEF("{[C_TEST_DEBUG_TEST_TRACE]}"), STRDEF("// Debug test trace not enabled"));
#else
strReplace(testCDup, STRDEF("{[C_TEST_DEBUG_TEST_TRACE]}"), STRDEF("#define DEBUG_TEST_TRACE"));
#endif
strReplace(testCDup, STRDEF("{[C_TEST_PATH_BUILD]}"), STRDEF(TEST_PATH "/test/unit-3/uXX/build"));
#ifdef DEBUG_COVERAGE
strReplace(testCDup, STRDEF("{[C_TEST_PROFILE]}"), STRDEF("true"));
#else
strReplace(testCDup, STRDEF("{[C_TEST_PROFILE]}"), STRDEF("false"));
#endif
strReplace(testCDup, STRDEF("{[C_TEST_PROJECT_EXE]}"), STRDEF(TEST_PATH "/test/build/uXX/src/pgbackrest"));
strReplace(testCDup, STRDEF("{[C_TEST_TZ]}"), STRDEF("// No timezone specified"));
@@ -747,7 +763,13 @@ testRun(void)
TEST_RESULT_VOID(
cmdTest(
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3, STRDEF("invalid"),
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true, true, true, true),
STRDEF("test/shim"), 0, 1, logLevelDebug, true, NULL, true,
#ifdef DEBUG_COVERAGE
true,
#else
false,
#endif
true, true),
"new build");
// -------------------------------------------------------------------------------------------------------------------------
@@ -770,7 +792,13 @@ testRun(void)
TEST_RESULT_VOID(
cmdTest(
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3, STRDEF("invalid"),
STRDEF("real/all"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, true, false, true),
STRDEF("real/all"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false,
#ifdef DEBUG_COVERAGE
true,
#else
false,
#endif
false, true),
"new build");
storageUnit = storagePosixNewP(STRDEF(TEST_PATH "/test/unit-3/none"));
@@ -816,6 +844,7 @@ testRun(void)
"executable(\n"
" 'test-unit',\n"
" sources: src_unit,\n"
#ifdef DEBUG_COVERAGE
" c_args: [\n"
" '-pg',\n"
" '-no-pie',\n"
@@ -824,6 +853,7 @@ testRun(void)
" '-pg',\n"
" '-no-pie',\n"
" ],\n"
#endif
" include_directories:\n"
" include_directories(\n"
" '.',\n"
@@ -877,9 +907,17 @@ testRun(void)
strReplace(testCDup, STRDEF("{[C_TEST_VM]}"), STRDEF("uXX"));
strReplace(testCDup, STRDEF("{[C_TEST_PG_VERSION]}"), STRDEF("invalid"));
strReplace(testCDup, STRDEF("{[C_TEST_LOG_EXPECT]}"), STRDEF("false"));
#ifdef DEBUG_COVERAGE
strReplace(testCDup, STRDEF("{[C_TEST_DEBUG_TEST_TRACE]}"), STRDEF("// Debug test trace not enabled"));
#else
strReplace(testCDup, STRDEF("{[C_TEST_DEBUG_TEST_TRACE]}"), STRDEF("#define DEBUG_TEST_TRACE"));
#endif
strReplace(testCDup, STRDEF("{[C_TEST_PATH_BUILD]}"), STRDEF(TEST_PATH "/test/unit-3/none/build"));
#ifdef DEBUG_COVERAGE
strReplace(testCDup, STRDEF("{[C_TEST_PROFILE]}"), STRDEF("true"));
#else
strReplace(testCDup, STRDEF("{[C_TEST_PROFILE]}"), STRDEF("false"));
#endif
strReplace(testCDup, STRDEF("{[C_TEST_PROJECT_EXE]}"), STRDEF(TEST_PATH "/test/build/uXX/src/pgbackrest"));
strReplace(testCDup, STRDEF("{[C_TEST_TZ]}"), STRDEF("hrnTzSet(\"America/New_York\");"));
@@ -923,7 +961,13 @@ testRun(void)
TEST_RESULT_VOID(
cmdTest(
STRDEF(TEST_PATH "/repo"), storagePathP(storageTest, STRDEF("test")), STRDEF("uXX"), 3, STRDEF("invalid"),
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false, true, false, false),
STRDEF("performance/type"), 0, 1, logLevelDebug, true, STRDEF("America/New_York"), false,
#ifdef DEBUG_COVERAGE
true,
#else
false,
#endif
false, false),
"new build");
TEST_RESULT_LOG(
@@ -979,12 +1023,14 @@ testRun(void)
" sources: src_unit,\n"
" c_args: [\n"
" '-O2',\n"
#ifdef DEBUG_COVERAGE
" '-pg',\n"
" '-no-pie',\n"
" ],\n"
" link_args: [\n"
" '-pg',\n"
" '-no-pie',\n"
#endif
" ],\n"
" include_directories:\n"
" include_directories(\n"
@@ -1037,7 +1083,11 @@ testRun(void)
strReplace(testCDup, STRDEF("{[C_TEST_LOG_EXPECT]}"), STRDEF("false"));
strReplace(testCDup, STRDEF("{[C_TEST_DEBUG_TEST_TRACE]}"), STRDEF("// Debug test trace not enabled"));
strReplace(testCDup, STRDEF("{[C_TEST_PATH_BUILD]}"), STRDEF(TEST_PATH "/test/unit-3/uXX/build"));
#ifdef DEBUG_COVERAGE
strReplace(testCDup, STRDEF("{[C_TEST_PROFILE]}"), STRDEF("true"));
#else
strReplace(testCDup, STRDEF("{[C_TEST_PROFILE]}"), STRDEF("false"));
#endif
strReplace(testCDup, STRDEF("{[C_TEST_PROJECT_EXE]}"), STRDEF(TEST_PATH "/test/build/uXX/src/pgbackrest"));
strReplace(testCDup, STRDEF("{[C_TEST_TZ]}"), STRDEF("hrnTzSet(\"America/New_York\");"));

View File

@@ -499,12 +499,12 @@ eval
# Setup build if it does not exist
my $strGenerateCommand =
"ninja -C ${strBuildPath} src/build-code" .
"ninja -C ${strBuildPath} src/build-code 2>&1" .
($bDryRun ? '' : " && \\\n${strBuildPath}/src/build-code config ${strBackRestBase}/src") .
($bDryRun ? '' : " && \\\n${strBuildPath}/src/build-code error ${strBackRestBase}/src") .
($bDryRun ? '' : " && \\\n${strBuildPath}/src/build-code postgres-version ${strBackRestBase}/src") .
" && \\\n${strBuildPath}/src/build-code postgres ${strBackRestBase}/src ${strRepoCachePath}" .
" && \\\nninja -C ${strBuildPath} test/src/test-pgbackrest";
" && \\\nninja -C ${strBuildPath} test/src/test-pgbackrest 2>&1";
if (!-e $strBuildNinja)
{
@@ -660,7 +660,7 @@ eval
# Setup build if it does not exist
my $strBuildCommand =
"ninja -C ${strBuildPath}" . ($bBinRequired ? ' src/pgbackrest' : '') .
($bUnitRequired ? ' test/src/test-pgbackrest' : '');
($bUnitRequired ? ' test/src/test-pgbackrest' : '') . ' 2>&1';
if (!-e $strBuildNinja)
{