From f11d8c32c01ab1ac13268484b9e85732176a47d9 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 1 Apr 2020 21:50:16 +0300 Subject: Add support for test-exclude task manifest value --- mod/mod-build-task.cxx | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'mod') diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index edddb89..3eaa0d3 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -220,14 +220,44 @@ handle (request& rq, response& rs) lazy_shared_ptr r (p->internal_repository); - strings fp; + strings fps; if (r->certificate_fingerprint) - fp.emplace_back (move (*r->certificate_fingerprint)); + fps.emplace_back (move (*r->certificate_fingerprint)); + + // Exclude external test packages which exclude the task build + // configuration. + // + small_vector tes; + auto add_exclusions = [&tes, &cm, this] + (const small_vector& tests) + { + for (const build_dependency& t: tests) + { + // Don't exclude unresolved external tests. + // + // Note that this may result in the build task failure. However, + // silently excluding such tests could end up with missed software + // bugs which feels much worse. + // + if (t.package != nullptr) + { + shared_ptr p (t.package.load ()); + + if (exclude (p->builds, p->constraints, *cm.config)) + tes.push_back (package {move (p->id.name), move (p->version)}); + } + } + }; + + add_exclusions (p->tests); + add_exclusions (p->examples); + add_exclusions (p->benchmarks); task_manifest task (move (b->package_name), move (b->package_version), move (r->location), - move (fp), + move (fps), + move (tes), cm.machine->name, cm.config->target, cm.config->environment, @@ -595,7 +625,7 @@ handle (request& rq, response& rs) // // We iterate over buildable packages. // - assert (p->internal_repository != nullptr); + assert (p->internal ()); p->internal_repository.load (); @@ -677,8 +707,8 @@ handle (request& rq, response& rs) shared_ptr p ( build_db_->find (b->id.package)); - if (p != nullptr && - p->internal_repository != nullptr && + if (p != nullptr && + p->internal () && !exclude (p->builds, p->constraints, *cm.config)) { assert (b->status); -- cgit v1.1