diff options
-rw-r--r-- | bbot/worker/worker.cxx | 49 | ||||
-rw-r--r-- | doc/manual.cli | 32 | ||||
-rw-r--r-- | tests/integration/testscript | 2 |
3 files changed, 68 insertions, 15 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 ()); diff --git a/doc/manual.cli b/doc/manual.cli index 4191d6d..85ad89a 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -321,6 +321,7 @@ version: <package-version> repository-url: <repository-url> [repository-type]: pkg|git|dir [trust]: <repository-fp> +[test-exclude]: <package-name>/<package-version> machine: <machine-name> target: <target-triplet> @@ -385,6 +386,21 @@ some agents may only trust their internally-specified fingerprints to prevent the \"man in the middle\" attacks. +\h2#arch-task-test-exclude|\c{test-exclude}| + +\ +[test-exclude]: <package-name>/<package-version> +\ + +The separate test, example, or benchmark package to exclude from building +together with the primary package. This value may be specified multiple times. + +The controller adds this value for packages specified via the \c{tests}, +\c{examples}, and \c{benchmarks} primary package manifest values which should +be excluded from building due to their \c{builds}, \c{build-include}, and +\c{build-exclude} manifest values. + + \h2#arch-task-machine|\c{machine}| \ @@ -795,7 +811,8 @@ bpkg -v update <package-name> bpkg -v test <package-name> # for each package referred to by the tests, examples, or benchmarks -# package manifest values: +# package manifest values and not excluded by the test-exclude task +# manifest values: # { # bpkg.configure.build @@ -837,7 +854,8 @@ bpkg -v test <package-name> } # if any of the tests, examples, or benchmarks package manifest - # values are specified: + # values are specified and are not all excluded by the test-exclude + # task manifest values: # { # bpkg.test-installed.create @@ -853,7 +871,8 @@ bpkg -v test <package-name> bpkg -v fetch --trust <repository-fp> # for each package referred to by the tests, examples, or - # benchmarks package manifest values: + # benchmarks package manifest values and not excluded by the + # test-exclude task manifest values: # { # bpkg.configure.build @@ -1062,9 +1081,10 @@ that applies to the \c{bpkg.configure.create} step, then in addition to building and possibly running tests, the \c{bbot} worker will also test installing and uninstalling each package. Furthermore, if the package contains subprojects that support the test operation and/or refers to other packages -via the \c{tests}, \c{examples}, or \c{benchmarks} manifest values, then the -worker will additionally build such subprojects/packages against the -installation and run their tests. +via the \c{tests}, \c{examples}, or \c{benchmarks} manifest values which are +not excluded by the \c{test-exclude} task manifest values, then the worker +will additionally build such subprojects/packages against the installation and +run their tests. Two types of installations can be tested: \i{system} and \i{private}. A system installation uses a well-known location, such as \c{/usr} or \c{/usr/local}, diff --git a/tests/integration/testscript b/tests/integration/testscript index 7970f0c..b99e37a 100644 --- a/tests/integration/testscript +++ b/tests/integration/testscript @@ -74,7 +74,7 @@ rfp = yes #\ pkg = libbuild2-hello -ver = 0.1.0-a.0.20200303044811.aeb178751f6a +ver = 0.1.0-a.0.20200402131859.22b478618203 rep_url = "https://github.com/build2/libbuild2-hello.git#master" rep_type = git rfp = yes |