1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Remove test.pl --smart, --dev, and --dev-test options.

--smart is now the default mode. Since --dev is now just an alias for --no-optimize, remove it. --dev-test has been a noop for a while, so this seems like a good time to remove it.

Also make the C auto-generator skip writing files that have not changed to avoid updating the timestamp.
This commit is contained in:
David Steele
2021-07-20 12:01:10 -04:00
parent 1522cb4ed2
commit 9ee9b1fad6
5 changed files with 90 additions and 143 deletions

View File

@ -209,8 +209,6 @@ Examples of test runs are provided in the following sections. There are several
- `--run` - a number identifying the run within a test if testing a single run rather than the entire test - `--run` - a number identifying the run within a test if testing a single run rather than the entire test
- `--dev` - sets several flags that are appropriate for development but should be omitted when performing final testing prior to submitting a Pull Request to the project. Most importantly, it reuses object files from the previous test run to speed testing.
- `--vm-out` - displays the test output (helpful for monitoring the progress) - `--vm-out` - displays the test output (helpful for monitoring the progress)
- `--vm` - identifies the pre-built container when using Docker, otherwise the setting should be `none` - `--vm` - identifies the pre-built container when using Docker, otherwise the setting should be `none`
@ -231,25 +229,30 @@ pgbackrest/test/test.pl --vm=none --dry-run
--- output --- --- output ---
P00 INFO: test begin on x86_64 - log level info P00 INFO: test begin on aarch64 - log level info
P00 INFO: configure build
P00 INFO: builds required: bin P00 INFO: builds required: bin
--> P00 INFO: 70 tests selected --> P00 INFO: 72 tests selected
P00 INFO: P1-T01/70 - vm=none, module=common, test=error P00 INFO: P1-T01/72 - vm=none, module=common, test=error
[filtered 67 lines of output] [filtered 69 lines of output]
P00 INFO: P1-T69/70 - vm=none, module=performance, test=type P00 INFO: P1-T71/72 - vm=none, module=performance, test=type
P00 INFO: P1-T70/70 - vm=none, module=performance, test=storage P00 INFO: P1-T72/72 - vm=none, module=performance, test=storage
--> P00 INFO: DRY RUN COMPLETED SUCCESSFULLY --> P00 INFO: DRY RUN COMPLETED SUCCESSFULLY
``` ```
pgbackrest-dev => Run a test pgbackrest-dev => Run a test
``` ```
pgbackrest/test/test.pl --vm=none --dev --vm-out --module=common --test=wait pgbackrest/test/test.pl --vm=none --vm-out --module=common --test=wait
--- output --- --- output ---
P00 INFO: test begin on x86_64 - log level info P00 INFO: test begin on aarch64 - log level info
P00 INFO: check code autogenerate P00 INFO: autogenerate configure
P00 INFO: autogenerated version in configure.ac script: no changes
P00 INFO: autogenerated configure script: no changes
P00 INFO: autogenerate code
P00 INFO: autogenerated C code: no changes
P00 INFO: cleanup old data P00 INFO: cleanup old data
P00 INFO: builds required: none P00 INFO: builds required: none
P00 INFO: 1 test selected P00 INFO: 1 test selected
@ -296,12 +299,16 @@ An entire module can be run by using only the `--module` option.
pgbackrest-dev => Run a module pgbackrest-dev => Run a module
``` ```
pgbackrest/test/test.pl --vm=none --dev --module=postgres pgbackrest/test/test.pl --vm=none --module=postgres
--- output --- --- output ---
P00 INFO: test begin on x86_64 - log level info P00 INFO: test begin on aarch64 - log level info
P00 INFO: check code autogenerate P00 INFO: autogenerate configure
P00 INFO: autogenerated version in configure.ac script: no changes
P00 INFO: autogenerated configure script: no changes
P00 INFO: autogenerate code
P00 INFO: autogenerated C code: no changes
P00 INFO: cleanup old data P00 INFO: cleanup old data
P00 INFO: builds required: none P00 INFO: builds required: none
P00 INFO: 2 tests selected P00 INFO: 2 tests selected
@ -323,8 +330,8 @@ pgbackrest/test/test.pl --vm-build --vm=u20
--- output --- --- output ---
P00 INFO: test begin on x86_64 - log level info P00 INFO: test begin on aarch64 - log level info
P00 INFO: Using cached pgbackrest/test:u20-base-20210717A image (738bc9b702a18d1fcb5ba33dae74c74e01e67527) ... P00 INFO: Using cached pgbackrest/test:u20-base-20210718A image (d6c377617ac2c112b80a3c1f090345d54769ae1b) ...
P00 INFO: Building pgbackrest/test:u20-test image ... P00 INFO: Building pgbackrest/test:u20-test image ...
P00 INFO: Build Complete P00 INFO: Build Complete
``` ```
@ -332,18 +339,22 @@ pgbackrest/test/test.pl --vm-build --vm=u20
pgbackrest-dev => Run a Specific Test Run pgbackrest-dev => Run a Specific Test Run
``` ```
pgbackrest/test/test.pl --vm=u20 --dev --module=mock --test=archive --run=2 pgbackrest/test/test.pl --vm=u20 --module=mock --test=archive --run=2
--- output --- --- output ---
P00 INFO: test begin on x86_64 - log level info P00 INFO: test begin on aarch64 - log level info
P00 INFO: check code autogenerate P00 INFO: autogenerate configure
P00 INFO: autogenerated version in configure.ac script: no changes
P00 INFO: autogenerated configure script: no changes
P00 INFO: autogenerate code
P00 INFO: autogenerated C code: no changes
P00 INFO: cleanup old data and containers P00 INFO: cleanup old data and containers
P00 INFO: builds required: bin, bin host P00 INFO: builds required: bin, bin host
P00 INFO: bin dependencies have changed for u20, rebuilding...
P00 INFO: build bin for u20 (/home/docker/test/bin/u20) P00 INFO: build bin for u20 (/home/docker/test/bin/u20)
P00 INFO: bin dependencies have changed for none, rebuilding... P00 INFO: bin dependencies have changed, rebuilding
P00 INFO: build bin for none (/home/docker/test/bin/none) P00 INFO: build bin for none (/home/docker/test/bin/none)
P00 INFO: bin dependencies have changed, rebuilding
P00 INFO: 1 test selected P00 INFO: 1 test selected
P00 INFO: P1-T1/1 - vm=u20, module=mock, test=archive, run=2 P00 INFO: P1-T1/1 - vm=u20, module=mock, test=archive, run=2
@ -498,7 +509,7 @@ TEST_ERROR(cmdCheck(), ConfigError, "primary database not found\nHINT: check ind
Unit tests are run for all files that are listed in `define.yaml` and a coverage report generated for each file listed under the tag `coverage:`. Note that some files are listed in multiple `coverage:` sections for a module; in this case, each test for the file being modified should be specified for the module in which the file exists (e.g. `--module=storage --test=posix --test=gcs`, etc.) or, alternatively, simply run the module without the `--test` option. It is recommended that a `--vm` be specified since running the same test for multiple vms is unnecessary for coverage. The following example would run the test set from the **define.yaml** section detailed above. Unit tests are run for all files that are listed in `define.yaml` and a coverage report generated for each file listed under the tag `coverage:`. Note that some files are listed in multiple `coverage:` sections for a module; in this case, each test for the file being modified should be specified for the module in which the file exists (e.g. `--module=storage --test=posix --test=gcs`, etc.) or, alternatively, simply run the module without the `--test` option. It is recommended that a `--vm` be specified since running the same test for multiple vms is unnecessary for coverage. The following example would run the test set from the **define.yaml** section detailed above.
``` ```
pgbackrest/test/test.pl --vm-out --dev --module=command --test=check --vm=u20 pgbackrest/test/test.pl --vm-out --module=command --test=check --vm=u20
``` ```
> **NOTE:** Not all systems perform at the same speed, so if a test is timing out, try rerunning with another vm. > **NOTE:** Not all systems perform at the same speed, so if a test is timing out, try rerunning with another vm.
@ -510,7 +521,7 @@ If 100 percent code coverage has not been achieved, an error message will be dis
Sometimes it is useful to look at files that were generated during the test. The default for running any test is that, at the start/end of the test, the test harness will clean up all files and directories created. To override this behavior, a single test run must be specified and the option `--no-cleanup` provided. Again, continuing with the check command, from **define.yaml** above, there are four tests. Below, test one will be run and nothing will be cleaned up so that the files and directories in `test/test-0` can be inspected. Sometimes it is useful to look at files that were generated during the test. The default for running any test is that, at the start/end of the test, the test harness will clean up all files and directories created. To override this behavior, a single test run must be specified and the option `--no-cleanup` provided. Again, continuing with the check command, from **define.yaml** above, there are four tests. Below, test one will be run and nothing will be cleaned up so that the files and directories in `test/test-0` can be inspected.
``` ```
pgbackrest/test/test.pl --vm-out --dev --module=command --test=check --run=1 --no-cleanup pgbackrest/test/test.pl --vm-out --module=command --test=check --run=1 --no-cleanup
``` ```
## Adding an Option ## Adding an Option

View File

@ -317,7 +317,6 @@ myObjToLog(const MyObj *this)
<list-item><setting>--module</setting> - identifies the module in which the test is located</list-item> <list-item><setting>--module</setting> - identifies the module in which the test is located</list-item>
<list-item><setting>--test</setting> - the actual test set to be run</list-item> <list-item><setting>--test</setting> - the actual test set to be run</list-item>
<list-item><setting>--run</setting> - a number identifying the run within a test if testing a single run rather than the entire test</list-item> <list-item><setting>--run</setting> - a number identifying the run within a test if testing a single run rather than the entire test</list-item>
<list-item><setting>--dev</setting> - sets several flags that are appropriate for development but should be omitted when performing final testing prior to submitting a Pull Request to the project. Most importantly, it reuses object files from the previous test run to speed testing.</list-item>
<list-item><setting>--vm-out</setting> - displays the test output (helpful for monitoring the progress)</list-item> <list-item><setting>--vm-out</setting> - displays the test output (helpful for monitoring the progress)</list-item>
<list-item><setting>--vm</setting> - identifies the pre-built container when using Docker, otherwise the setting should be <code>none</code></list-item> <list-item><setting>--vm</setting> - identifies the pre-built container when using Docker, otherwise the setting should be <code>none</code></list-item>
</list> </list>
@ -348,7 +347,7 @@ pgbackrest/doc/doc.pl --help
<title>Run a test</title> <title>Run a test</title>
<execute output="y"> <execute output="y">
<exe-cmd>pgbackrest/test/test.pl --vm=none --dev --vm-out --module=common --test=wait</exe-cmd> <exe-cmd>pgbackrest/test/test.pl --vm=none --vm-out --module=common --test=wait</exe-cmd>
<exe-cmd-extra>{[test-cmd-extra]}</exe-cmd-extra> <exe-cmd-extra>{[test-cmd-extra]}</exe-cmd-extra>
</execute> </execute>
</execute-list> </execute-list>
@ -359,7 +358,7 @@ pgbackrest/doc/doc.pl --help
<title>Run a module</title> <title>Run a module</title>
<execute output="y"> <execute output="y">
<exe-cmd>pgbackrest/test/test.pl --vm=none --dev --module=postgres</exe-cmd> <exe-cmd>pgbackrest/test/test.pl --vm=none --module=postgres</exe-cmd>
<exe-cmd-extra>{[test-cmd-extra]}</exe-cmd-extra> <exe-cmd-extra>{[test-cmd-extra]}</exe-cmd-extra>
</execute> </execute>
</execute-list> </execute-list>
@ -385,7 +384,7 @@ pgbackrest/doc/doc.pl --help
<title>Run a Specific Test Run</title> <title>Run a Specific Test Run</title>
<execute output="y"> <execute output="y">
<exe-cmd>pgbackrest/test/test.pl {[dash]}-vm=u20 {[dash]}-dev {[dash]}-module=mock {[dash]}-test=archive {[dash]}-run=2</exe-cmd> <exe-cmd>pgbackrest/test/test.pl {[dash]}-vm=u20 {[dash]}-module=mock {[dash]}-test=archive {[dash]}-run=2</exe-cmd>
<exe-cmd-extra>{[test-cmd-extra]}</exe-cmd-extra> <exe-cmd-extra>{[test-cmd-extra]}</exe-cmd-extra>
</execute> </execute>
</execute-list> </execute-list>
@ -563,7 +562,7 @@ TEST_ERROR(cmdCheck(), ConfigError, "primary database not found\nHINT: check ind
<p>Unit tests are run for all files that are listed in <file>define.yaml</file> and a coverage report generated for each file listed under the tag <code>coverage:</code>. Note that some files are listed in multiple <code>coverage:</code> sections for a module; in this case, each test for the file being modified should be specified for the module in which the file exists (e.g. <code>--module=storage --test=posix --test=gcs</code>, etc.) or, alternatively, simply run the module without the <code>--test</code> option. It is recommended that a <code>--vm</code> be specified since running the same test for multiple vms is unnecessary for coverage. The following example would run the test set from the <b>define.yaml</b> section detailed above.</p> <p>Unit tests are run for all files that are listed in <file>define.yaml</file> and a coverage report generated for each file listed under the tag <code>coverage:</code>. Note that some files are listed in multiple <code>coverage:</code> sections for a module; in this case, each test for the file being modified should be specified for the module in which the file exists (e.g. <code>--module=storage --test=posix --test=gcs</code>, etc.) or, alternatively, simply run the module without the <code>--test</code> option. It is recommended that a <code>--vm</code> be specified since running the same test for multiple vms is unnecessary for coverage. The following example would run the test set from the <b>define.yaml</b> section detailed above.</p>
<code-block> <code-block>
pgbackrest/test/test.pl --vm-out --dev --module=command --test=check --vm=u20 pgbackrest/test/test.pl --vm-out --module=command --test=check --vm=u20
</code-block> </code-block>
<admonition type="note">Not all systems perform at the same speed, so if a test is timing out, try rerunning with another vm.</admonition> <admonition type="note">Not all systems perform at the same speed, so if a test is timing out, try rerunning with another vm.</admonition>
@ -577,7 +576,7 @@ pgbackrest/test/test.pl --vm-out --dev --module=command --test=check --vm=u20
<p>Sometimes it is useful to look at files that were generated during the test. The default for running any test is that, at the start/end of the test, the test harness will clean up all files and directories created. To override this behavior, a single test run must be specified and the option <code>--no-cleanup</code> provided. Again, continuing with the check command, from <b>define.yaml</b> above, there are four tests. Below, test one will be run and nothing will be cleaned up so that the files and directories in <path>test/test-0</path> can be inspected.</p> <p>Sometimes it is useful to look at files that were generated during the test. The default for running any test is that, at the start/end of the test, the test harness will clean up all files and directories created. To override this behavior, a single test run must be specified and the option <code>--no-cleanup</code> provided. Again, continuing with the check command, from <b>define.yaml</b> above, there are four tests. Below, test one will be run and nothing will be cleaned up so that the files and directories in <path>test/test-0</path> can be inspected.</p>
<code-block> <code-block>
pgbackrest/test/test.pl --vm-out --dev --module=command --test=check --run=1 --no-cleanup pgbackrest/test/test.pl --vm-out --module=command --test=check --run=1 --no-cleanup
</code-block> </code-block>
</section> </section>
</section> </section>

View File

@ -40,4 +40,14 @@ bldHeader(const char *const module, const char *const description)
description, module); description, module);
} }
// Put the file if it is different than the existing file
__attribute__((always_inline)) static inline void
bldPut(const Storage *const storage, const char *const file, const Buffer *const contentNew)
{
const Buffer *const contentOld = storageGetP(storageNewReadP(storage, STR(file), .ignoreMissing = true));
if (contentOld == NULL || !bufEq(contentOld, contentNew))
storagePutP(storageNewWriteP(storage, STR(file), .noSyncPath = true), contentNew);
}
#endif #endif

View File

@ -285,7 +285,7 @@ bldCfgRender(const Storage *const storageRepo, const BldCfg bldCfg)
"\n" "\n"
"#endif\n"); "#endif\n");
storagePutP(storageNewWriteP(storageRepo, STRDEF("src/config/config.auto.h"), .noSyncPath = true), BUFSTR(config)); bldPut(storageRepo, "src/config/config.auto.h", BUFSTR(config));
// Build C // Build C
// ----------------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------------
@ -326,5 +326,5 @@ bldCfgRender(const Storage *const storageRepo, const BldCfg bldCfg)
config, config,
")\n"); ")\n");
storagePutP(storageNewWriteP(storageRepo, STRDEF("src/config/config.auto.c"), .noSyncPath = true), BUFSTR(config)); bldPut(storageRepo, "src/config/config.auto.c", BUFSTR(config));
} }

View File

@ -88,9 +88,6 @@ test.pl [options]
--no-gen do not run code generation --no-gen do not run code generation
--gen-check check that auto-generated files are correct (used in CI to detect changes) --gen-check check that auto-generated files are correct (used in CI to detect changes)
--code-count generate code counts --code-count generate code counts
--smart perform bin/package builds only when source timestamps have changed
--dev --smart --no-optimize
--dev-test does nothing -- kept for backward compatibility
--expect --vm=co7 --pg-version=9.6 --log-force --expect --vm=co7 --pg-version=9.6 --log-force
--no-valgrind don't run valgrind on C unit tests (saves time) --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 don't run coverage on C unit tests (saves time)
@ -171,9 +168,6 @@ my $bGenOnly = false;
my $bGenCheck = false; my $bGenCheck = false;
my $bNoGen = false; my $bNoGen = false;
my $bCodeCount = false; my $bCodeCount = false;
my $bSmart = false;
my $bDev = false;
my $bDevTest = false;
my $bBackTrace = false; my $bBackTrace = false;
my $bProfile = false; my $bProfile = false;
my $bExpect = false; my $bExpect = false;
@ -226,9 +220,6 @@ GetOptions ('q|quiet' => \$bQuiet,
'gen-check' => \$bGenCheck, 'gen-check' => \$bGenCheck,
'no-gen' => \$bNoGen, 'no-gen' => \$bNoGen,
'code-count' => \$bCodeCount, 'code-count' => \$bCodeCount,
'smart' => \$bSmart,
'dev' => \$bDev,
'dev-test' => \$bDevTest,
'backtrace' => \$bBackTrace, 'backtrace' => \$bBackTrace,
'profile' => \$bProfile, 'profile' => \$bProfile,
'expect' => \$bExpect, 'expect' => \$bExpect,
@ -286,20 +277,6 @@ eval
$bCOnly = true; $bCOnly = true;
} }
################################################################################################################################
# Update options for --dev and --dev-fast and --dev-test
################################################################################################################################
if ($bDev && $bDevTest)
{
confess "cannot combine --dev and --dev-test";
}
if ($bDev)
{
$bSmart = true;
$bNoOptimize = true;
}
################################################################################################################################ ################################################################################################################################
# Update options for --profile # Update options for --profile
################################################################################################################################ ################################################################################################################################
@ -590,52 +567,19 @@ eval
} }
} }
# Make a copy of the repo to track which files have been changed. Eventually all builds will be done from this directory. # Make a copy of the repo to track which files have been changed
#--------------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------------
my $strRepoCachePath = "${strTestPath}/repo"; my $strRepoCachePath = "${strTestPath}/repo";
my $strRepoCacheManifest = 'repo.manifest';
# Create the repo path -- this should hopefully prevent obvious rsync errors below # Create the repo path -- this should hopefully prevent obvious rsync errors below
$oStorageTest->pathCreate("${strTestPath}/repo", {strMode => '0770', bIgnoreExists => true, bCreateParent => true}); $oStorageTest->pathCreate($strRepoCachePath, {strMode => '0770', bIgnoreExists => true, bCreateParent => true});
# Check if there are any files existing already. If none, that means a full copy is happening and we shouldn't report # Copy the repo
# modified files executeTest(
my @stryExistingList = $oStorageTest->list($strRepoCachePath, {bIgnoreMissing => true}); "git -C ${strBackRestBase} ls-files -c --others --exclude-standard | rsync -rtW --delete --exclude=test/result" .
# This option is not supported on MacOS. The eventual plan is to remove the need for it.
# First check if there is an old manifest that has not been cleared. This indicates that an error happened before all new (trim(`uname`) ne 'Darwin' ? ' --ignore-missing-args' : '') .
# files could be processed, which means they should be processed again. " ${strBackRestBase}/ ${strRepoCachePath}");
my @stryModifiedList;
my $rstrModifiedList = $oStorageTest->get(
$oStorageTest->openRead("${strRepoCachePath}/${strRepoCacheManifest}", {bIgnoreMissing => true}));
if (defined($rstrModifiedList))
{
@stryModifiedList = split("\n", trim($$rstrModifiedList));
}
push(
@stryModifiedList,
split(
"\n",
trim(
executeTest(
"git -C ${strBackRestBase} ls-files -c --others --exclude-standard |" .
" rsync -rtW --out-format=\"\%n\" --delete" .
# This option is not supported on MacOS. The eventual plan is to remove the need for it.
(trim(`uname`) ne 'Darwin' ? ' --ignore-missing-args' : '') .
" --exclude=test/result --exclude=repo.manifest" .
" ${strBackRestBase}/ --files-from=- ${strRepoCachePath}" .
" | grep -E -v '/\$' | cat"))));
if (@stryModifiedList > 0)
{
$oStorageTest->put("${strRepoCachePath}/${strRepoCacheManifest}", join("\n", @stryModifiedList));
if (@stryExistingList > 0)
{
&log(INFO, "modified since last run: " . join(', ', @stryModifiedList));
}
}
# Generate code counts # Generate code counts
#--------------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------------
@ -670,7 +614,7 @@ eval
executeTest( executeTest(
"chmod 700 -R ${strTestPath}/test-* 2>&1 || true && rm -rf ${strTestPath}/temp ${strTestPath}/test-*" . "chmod 700 -R ${strTestPath}/test-* 2>&1 || true && rm -rf ${strTestPath}/temp ${strTestPath}/test-*" .
" ${strTestPath}/data-*" . ($bDev ? '' : " ${strTestPath}/gcov-*")); " ${strTestPath}/data-*");
$oStorageTest->pathCreate("${strTestPath}/temp", {strMode => '0770', bIgnoreExists => true, bCreateParent => true}); $oStorageTest->pathCreate("${strTestPath}/temp", {strMode => '0770', bIgnoreExists => true, bCreateParent => true});
# Remove old lcov dirs -- do it this way so the dirs stay open in finder/explorer, etc. # Remove old lcov dirs -- do it this way so the dirs stay open in finder/explorer, etc.
@ -771,8 +715,8 @@ eval
foreach my $strBuildVM (@stryBuildVm) foreach my $strBuildVM (@stryBuildVm)
{ {
my $strBuildPath = "${strBinPath}/${strBuildVM}"; my $strBuildPath = "${strBinPath}/${strBuildVM}";
my $bRebuild = !$bSmart; my $bRebuild = false;
$rhBinBuild->{$strBuildVM} = true; $rhBinBuild->{$strBuildVM} = false;
# Build configure/compile options and see if they have changed from the previous build # Build configure/compile options and see if they have changed from the previous build
my $strCFlags = my $strCFlags =
@ -785,59 +729,46 @@ eval
my $strBuildFlagFile = "${strBinPath}/${strBuildVM}/build.flags"; my $strBuildFlagFile = "${strBinPath}/${strBuildVM}/build.flags";
my $bBuildOptionsDiffer = buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags); my $bBuildOptionsDiffer = buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
$bBuildOptionsDiffer |= grep(/^src\/configure|src\/Makefile.in|src\/build\.auto\.h\.in$/, @stryModifiedList);
# Rebuild if the modification time of the bin file is less than the last changes in source paths &log(INFO, " build bin for ${strBuildVM} (${strBuildPath})");
my $strBinSmart = "${strBuildPath}/pgbackrest";
if ($bBuildOptionsDiffer || if ($strBuildVM ne VM_NONE)
($bSmart &&
(!$oStorageBackRest->exists($strBinSmart) ||
$oStorageBackRest->info($strBinSmart)->mtime < $lTimestampLast)))
{ {
&log( executeTest(
INFO, " bin dependencies have changed for ${strBuildVM}, " . ($bBuildOptionsDiffer ? 're' : '') . "docker run -itd -h test-build --name=test-build" .
'building...'); " -v ${strBackRestBase}:${strBackRestBase} -v ${strTestPath}:${strTestPath} " .
containerRepo() . ":${strBuildVM}-test",
$bRebuild = true; {bSuppressStdErr => true});
} }
if ($bRebuild) if ($bBuildOptionsDiffer ||
!-e "${strBuildPath}/Makefile" ||
stat("${strBackRestBase}/src/Makefile.in")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
stat("${strBackRestBase}/src/configure")->mtime > stat("${strBuildPath}/Makefile")->mtime ||
stat("${strBackRestBase}/src/build.auto.h.in")->mtime > stat("${strBuildPath}/Makefile")->mtime)
{ {
&log(INFO, " build bin for ${strBuildVM} (${strBuildPath})"); &log(INFO, ' bin dependencies have changed, rebuilding');
if ($strBuildVM ne VM_NONE) # Remove old path if it exists and save the build flags
{ executeTest("rm -rf ${strBuildPath}");
executeTest( buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
"docker run -itd -h test-build --name=test-build" .
" -v ${strBackRestBase}:${strBackRestBase} -v ${strTestPath}:${strTestPath} " .
containerRepo() . ":${strBuildVM}-test",
{bSuppressStdErr => true});
}
if (!$bSmart || $bBuildOptionsDiffer || !$oStorageBackRest->exists("${strBuildPath}/Makefile"))
{
# Remove old path if it exists and save the build flags
executeTest("rm -rf ${strBuildPath}");
buildPutDiffers($oStorageBackRest, $strBuildFlagFile, $strBuildFlags);
executeTest(
($strBuildVM ne VM_NONE ? 'docker exec -i -u ' . TEST_USER . ' test-build ' : '') .
"bash -c 'cd ${strBuildPath} && ${strBackRestBase}/src/configure -q${strConfigOptions}'",
{bShowOutputAsync => $bLogDetail});
}
executeTest( executeTest(
($strBuildVM ne VM_NONE ? 'docker exec -i -u ' . TEST_USER . ' test-build ' : '') . ($strBuildVM ne VM_NONE ? 'docker exec -i -u ' . TEST_USER . ' test-build ' : '') .
"${strMakeCmd} -s -j ${iBuildMax}" . ($bLogDetail ? '' : ' --silent') . "bash -c 'cd ${strBuildPath} && ${strBackRestBase}/src/configure -q${strConfigOptions}'",
" --directory ${strBuildPath} CFLAGS_EXTRA='${strCFlags}'" .
($strLdFlags ne '' ? " LDFLAGS_EXTRA='${strLdFlags}'" : ''),
{bShowOutputAsync => $bLogDetail}); {bShowOutputAsync => $bLogDetail});
}
if ($strBuildVM ne VM_NONE) executeTest(
{ ($strBuildVM ne VM_NONE ? 'docker exec -i -u ' . TEST_USER . ' test-build ' : '') .
executeTest("docker rm -f test-build"); "${strMakeCmd} -s -j ${iBuildMax}" . ($bLogDetail ? '' : ' --silent') .
} " --directory ${strBuildPath} CFLAGS_EXTRA='${strCFlags}'" .
($strLdFlags ne '' ? " LDFLAGS_EXTRA='${strLdFlags}'" : ''),
{bShowOutputAsync => $bLogDetail});
if ($strBuildVM ne VM_NONE)
{
executeTest("docker rm -f test-build");
} }
} }
} }
@ -1034,10 +965,6 @@ eval
exit 0 if $bBuildOnly; exit 0 if $bBuildOnly;
} }
# Remove repo.manifest now that all processing that depends on modified files has been completed
#---------------------------------------------------------------------------------------------------------------------------
$oStorageTest->remove("${strRepoCachePath}/${strRepoCacheManifest}");
# Perform static source code analysis # Perform static source code analysis
#--------------------------------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------------------------------
if (!$bDryRun) if (!$bDryRun)