aboutsummaryrefslogtreecommitdiff
path: root/bbot/worker/worker.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/worker/worker.cxx')
-rw-r--r--bbot/worker/worker.cxx49
1 files changed, 41 insertions, 8 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index 025fa04..8d8f65c 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -12,7 +12,7 @@
#include <cstring> // strchr()
#include <sstream>
#include <iostream>
-#include <algorithm> // find()
+#include <algorithm> // find(), find_if(), remove_if()
#include <libbutl/b.mxx>
#include <libbutl/pager.mxx>
@@ -922,13 +922,41 @@ build (size_t argc, const char* argv[])
package_manifest pm (parse_manifest<package_manifest> (mf, "package"));
// Run the package external tests if any of the tests, examples, or
- // benchmarks manifest values are specified.
+ // benchmarks manifest values are specified. But first filter these values
+ // against the test-exclude task manifest values using the package names.
//
- // Note that we assume that these packages belong to the dependent
- // package's repository or its complement repositories, recursively. Thus,
- // we test them in the configuration used to build the dependent package
- // (except for the build system module).
+ // Note that a proper implementation should also make sure that the
+ // excluded test package version matches the version that will supposedly
+ // be configured by bpkg and probably abort the build if that's not the
+ // case. Such a mismatch can happen due to some valid reasons (the
+ // repository was updated since the task was issued, etc) and should
+ // probably be followed with automatic rebuild (the flake monitor idea).
+ // Anyway, this all requires additional thinking, so let's keep it simple
+ // for now.
//
+ // Filter the external test dependencies in place.
+ //
+ auto filter = [&tm] (small_vector<dependency, 1>& deps)
+ {
+ const small_vector<package, 1>& tes (tm.test_exclusions);
+
+ deps.erase (
+ remove_if (deps.begin (), deps.end (),
+ [&tes] (const dependency& d)
+ {
+ return find_if (tes.begin (), tes.end (),
+ [&d] (const package& te)
+ {
+ return te.name == d.name;
+ }) != tes.end ();
+ }),
+ deps.end ());
+ };
+
+ filter (pm.tests);
+ filter (pm.examples);
+ filter (pm.benchmarks);
+
bool external_tests (!pm.tests.empty () ||
!pm.examples.empty () ||
!pm.benchmarks.empty ());
@@ -937,12 +965,17 @@ build (size_t argc, const char* argv[])
// current working directory. Optionally set the environment variables for
// bpkg processes. Return true if all operations for all packages succeed.
//
+ // Note that we assume that these packages belong to the dependent
+ // package's repository or its complement repositories, recursively. Thus,
+ // we test them in the configuration used to build the dependent package
+ // (except for the build system module).
+ //
auto test = [&trace, &wre, &step_args, &config_args, &env_args]
- (const small_vector<dependency, 1>& pkgs,
+ (const small_vector<dependency, 1>& deps,
operation_result& r,
const small_vector<string, 1>& envvars = {})
{
- for (const dependency& d: pkgs)
+ for (const dependency& d: deps)
{
const string& pkg (d.name.string ());