From e215795bd6f11daf6101eeba4f5c519dafa0eb62 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 22 Jun 2020 11:33:30 +0300 Subject: Adapt to merging of package external tests, examples, and benchmarks into typed tests --- bbot/worker/worker.cxx | 71 ++++++++++++++++---------------------------- tests/integration/testscript | 8 +++++ 2 files changed, 34 insertions(+), 45 deletions(-) diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index 8d8f65c..e436fa1 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -921,8 +921,7 @@ build (size_t argc, const char* argv[]) path mf (pkg_config / pkg_dir / "manifest"); package_manifest pm (parse_manifest (mf, "package")); - // Run the package external tests if any of the tests, examples, or - // benchmarks manifest values are specified. But first filter these values + // Run the package external tests, if specified. But first filter them // against the test-exclude task manifest values using the package names. // // Note that a proper implementation should also make sure that the @@ -936,30 +935,20 @@ build (size_t argc, const char* argv[]) // // Filter the external test dependencies in place. // - auto filter = [&tm] (small_vector& deps) - { - const small_vector& 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 ()); + pm.tests.erase ( + remove_if (pm.tests.begin (), pm.tests.end (), + [&tm] (const test_dependency& td) + { + return find_if (tm.test_exclusions.begin (), + tm.test_exclusions.end (), + [&td] (const package& te) + { + return te.name == td.name; + }) != tm.test_exclusions.end (); + }), + pm.tests.end ()); + + bool external_tests (!pm.tests.empty ()); // Configure, update, and test packages in the bpkg configuration in the // current working directory. Optionally set the environment variables for @@ -970,14 +959,13 @@ build (size_t argc, const char* argv[]) // 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& deps, - operation_result& r, + auto test = [&pm, &trace, &wre, &step_args, &config_args, &env_args] + (operation_result& r, const small_vector& envvars = {}) { - for (const dependency& d: deps) + for (const test_dependency& td: pm.tests) { - const string& pkg (d.name.string ()); + const string& pkg (td.name.string ()); // Configure. // @@ -996,7 +984,7 @@ build (size_t argc, const char* argv[]) step_args (env_args, step_id::bpkg_configure_build), step_args (config_args, step_id::bpkg_configure_build), "--", - d.string ()); + td.string ()); if (!r.status) return false; @@ -1074,13 +1062,8 @@ build (size_t argc, const char* argv[]) // Run external tests. // - if (external_tests) - { - if (!test (pm.tests, r) || - !test (pm.examples, r) || - !test (pm.benchmarks, r)) - break; - } + if (external_tests && !test (r)) + break; rm.status |= r.status; } @@ -1103,9 +1086,9 @@ build (size_t argc, const char* argv[]) // configure, build, and test them out of the source tree against the // installed package. // - // 3. If any of the tests, examples, or benchmarks packages are specified, - // then configure, build, and test them in a separate bpkg - // configuration against the installed package. + // 3. If any of the test packages are specified, then configure, build, + // and test them in a separate bpkg configuration against the installed + // package. // // 4. Uninstall the package. // @@ -1333,9 +1316,7 @@ build (size_t argc, const char* argv[]) // Build/test. // - if (!test (pm.tests, r, envvars) || - !test (pm.examples, r, envvars) || - !test (pm.benchmarks, r, envvars)) + if (!test (r, envvars)) break; } diff --git a/tests/integration/testscript b/tests/integration/testscript index b99e37a..0d4eabf 100644 --- a/tests/integration/testscript +++ b/tests/integration/testscript @@ -88,6 +88,14 @@ rep_type = pkg rfp = yes #\ +#\ +pkg = cli +ver = 1.2.0-b.6.20200619094719.2d23842ebf91 +rep_url = https://stage.build2.org/1 +rep_type = pkg +rfp = yes +#\ + # Note that we also need to make sure that the installed package libraries are # properly imported when configuring and running tests, and that the installed # executables are runnable. -- cgit v1.1