aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-06-22 19:05:08 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-06-26 14:12:12 +0300
commit105524ed96f162b43c0735a65fea284d07356aa2 (patch)
treef083c65946faeb3654f9108112143ba46cee3656 /mod
parent8e54ae94ce44d57b49b35269f006fe2bf07ec13d (diff)
Adapt to merging of package external tests, examples, and benchmarks into typed tests
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-build-task.cxx53
-rw-r--r--mod/mod-package-version-details.cxx51
2 files changed, 60 insertions, 44 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index 741d3b4..04b2a36 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -228,40 +228,33 @@ handle (request& rq, response& rs)
// configuration.
//
small_vector<package, 1> tes;
- auto add_exclusions = [&tes, &cm, this]
- (const small_vector<build_dependency, 1>& tests)
+
+ for (const build_test_dependency& td: p->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 (td.package != nullptr)
{
- // 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<build_package> p (t.package.load ());
+ shared_ptr<build_package> p (td.package.load ());
- // Use the `all` class as a least restrictive default underlying
- // build class set. Note that we should only apply the explicit
- // build restrictions to the external test packages (think about
- // the `builds: all` and `builds: -windows` manifest values for
- // the primary and external test packages, respectively).
- //
- if (exclude (p->builds,
- p->constraints,
- *cm.config,
- nullptr /* reason */,
- true /* default_all_ucs */))
- tes.push_back (package {move (p->id.name), move (p->version)});
- }
+ // Use the `all` class as a least restrictive default underlying
+ // build class set. Note that we should only apply the explicit
+ // build restrictions to the external test packages (think about
+ // the `builds: all` and `builds: -windows` manifest values for
+ // the primary and external test packages, respectively).
+ //
+ if (exclude (p->builds,
+ p->constraints,
+ *cm.config,
+ nullptr /* reason */,
+ true /* default_all_ucs */))
+ 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),
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index bfc08b0..a7682ec 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -397,38 +397,61 @@ handle (request& rq, response& rs)
<< ~TABLE;
}
- auto print_dependencies = [&s, &print_dependency]
- (const small_vector<dependency, 1>& deps,
- const char* heading,
- const char* id)
+ // Print the test dependencies grouped by types as the separate blocks.
+ //
+ // Print test dependencies of the specific type.
+ //
+ auto print_tests = [&pkg, &s, &print_dependency] (test_dependency_type dt)
{
- if (!deps.empty ())
- {
- s << H3 << heading << ~H3
- << TABLE(CLASS="proplist", ID=id)
- << TBODY;
+ string id;
- for (const dependency& d: deps)
+ bool first (true);
+ for (const test_dependency& td: pkg->tests)
+ {
+ if (td.type == dt)
{
+ // Print the table header if this is a first test dependency.
+ //
+ if (first)
+ {
+ id = to_string (dt);
+
+ // Capitalize the heading.
+ //
+ string heading (id);
+ heading[0] = ucase (id[0]);
+
+ s << H3 << heading << ~H3
+ << TABLE(CLASS="proplist", ID=id)
+ << TBODY;
+
+ first = false;
+ }
+
s << TR(CLASS=id)
<< TD
<< SPAN(CLASS="value");
- print_dependency (d);
+ print_dependency (td);
s << ~SPAN
<< ~TD
<< ~TR;
}
+ }
+ // Print the table closing tags if it was printed.
+ //
+ if (!first)
+ {
s << ~TBODY
<< ~TABLE;
}
};
- print_dependencies (pkg->tests, "Tests", "tests");
- print_dependencies (pkg->examples, "Examples", "examples");
- print_dependencies (pkg->benchmarks, "Benchmarks", "benchmarks");
+ print_tests (test_dependency_type::tests);
+ print_tests (test_dependency_type::examples);
+ print_tests (test_dependency_type::benchmarks);
bool builds (build_db_ != nullptr && pkg->buildable);