aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbbot/manifest.cxx57
-rw-r--r--libbbot/manifest.hxx19
-rw-r--r--tests/manifest/task-request.testscript2
-rw-r--r--tests/manifest/task.testscript112
4 files changed, 127 insertions, 63 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index 33b5046..5e00201 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -68,9 +68,9 @@ namespace bbot
// interactive_mode
//
string
- to_string (interactive_mode s)
+ to_string (interactive_mode m)
{
- switch (s)
+ switch (m)
{
case interactive_mode::false_: return "false";
case interactive_mode::true_: return "true";
@@ -329,7 +329,8 @@ namespace bbot
}
catch (const invalid_argument&)
{
- bad_value (string ("invalid task request interactive mode"));
+ bad_value (
+ string ("invalid task request interactive mode '" + v + "'"));
}
}
else if (n == "interactive-login")
@@ -597,37 +598,28 @@ namespace bbot
trust.emplace_back (move (v));
}
- else if (n == "test-exclude")
+ else if (n == "requires")
{
- size_t p (v.find ('/'));
- if (p == string::npos)
- bad_value ("invalid test exclusion package: '/' is expected");
-
- package_name pn;
-
try
{
- pn = package_name (string (v, 0, p));
+ requirements.push_back (requirement_alternatives (v));
}
catch (const invalid_argument& e)
{
- bad_value (string ("invalid test exclusion package name: ") +
- e.what ());
+ bad_value (e.what ());
}
-
- bpkg::version pv;
-
+ }
+ else if (n == "tests" || n == "examples" || n == "benchmarks")
+ {
try
{
- pv = bpkg::version (string (v, p + 1));
+ tests.push_back (test_dependency (move (v),
+ to_test_dependency_type (n)));
}
catch (const invalid_argument& e)
{
- bad_value (string ("invalid test exclusion package version: ") +
- e.what ());
+ bad_value (e.what ());
}
-
- test_exclusions.push_back (package {move (pn), move (pv)});
}
else if (n == "machine")
{
@@ -673,6 +665,18 @@ namespace bbot
if (config.empty ())
bad_value ("empty task configuration");
}
+ else if (n == "host")
+ {
+ if (host)
+ bad_name ("task host value redefinition");
+
+ if (v == "true")
+ host = true;
+ else if (v == "false")
+ host = false;
+ else
+ bad_value ("invalid task host value '" + v + "'");
+ }
else if (n == "warning-regex")
{
if (!warning_regex.empty ())
@@ -758,8 +762,11 @@ namespace bbot
for (const string& v: trust)
s.next ("trust", v);
- for (const package& te: test_exclusions)
- s.next ("test-exclude", te.name.string () + '/' + te.version.string ());
+ for (const requirement_alternatives& r: requirements)
+ s.next ("requires", r.string ());
+
+ for (const test_dependency& t: tests)
+ s.next (to_string (t.type), t.string ());
s.next ("machine", machine);
s.next ("target", target.string ());
@@ -788,6 +795,10 @@ namespace bbot
};
serialize_list ("config", config);
+
+ if (host)
+ s.next ("host", *host ? "true" : "false");
+
serialize_list ("warning-regex", warning_regex);
if (interactive)
diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx
index c3bb6ce..b6c4263 100644
--- a/libbbot/manifest.hxx
+++ b/libbbot/manifest.hxx
@@ -164,10 +164,11 @@ namespace bbot
//
strings trust;
- // Separate tests, examples, and benchmarks packages that should be
- // excluded from building together with the primary package.
+ // The subset of the build task-relevant package manifest values (see
+ // bpkg::package_manifest for their semantics).
//
- butl::small_vector<package, 1> test_exclusions;
+ std::vector<bpkg::requirement_alternatives> requirements;
+ butl::small_vector<bpkg::test_dependency, 1> tests;
std::string machine; // Build machine to use for building the package.
@@ -181,6 +182,10 @@ namespace bbot
//
strings config;
+ // If true, then this configuration is self-hosted.
+ //
+ butl::optional<bool> host;
+
// Regular expressions for detecting warnings in the operation result logs
// (in addition to the default list of expressions).
// Note: could be quoted.
@@ -199,22 +204,26 @@ namespace bbot
bpkg::version vr,
bpkg::repository_location rl,
strings tr,
- butl::small_vector<package, 1> te,
+ std::vector<bpkg::requirement_alternatives> ra,
+ butl::small_vector<bpkg::test_dependency, 1> ts,
std::string mn,
butl::target_triplet tg,
butl::optional<std::string> en,
strings cf,
+ butl::optional<bool> ht,
strings wr,
butl::optional<std::string> ir)
: name (std::move (nm)),
version (std::move (vr)),
repository (std::move (rl)),
trust (std::move (tr)),
- test_exclusions (std::move (te)),
+ requirements (std::move (ra)),
+ tests (std::move (ts)),
machine (std::move (mn)),
target (std::move (tg)),
environment (std::move (en)),
config (std::move (cf)),
+ host (std::move (ht)),
warning_regex (std::move (wr)),
interactive (std::move (ir)) {}
diff --git a/tests/manifest/task-request.testscript b/tests/manifest/task-request.testscript
index cee21fb..85801a9 100644
--- a/tests/manifest/task-request.testscript
+++ b/tests/manifest/task-request.testscript
@@ -155,7 +155,7 @@ EOI
{
: mode
:
- $* <<EOI 2>'stdin:2:19: error: invalid task request interactive mode' == 1
+ $* <<EOI 2>"stdin:2:19: error: invalid task request interactive mode 'on'" == 1
: 1
interactive-mode: on
EOI
diff --git a/tests/manifest/task.testscript b/tests/manifest/task.testscript
index b5ca66a..704ca20 100644
--- a/tests/manifest/task.testscript
+++ b/tests/manifest/task.testscript
@@ -12,13 +12,14 @@ test.options += -t
:
$* <<EOF >>EOF
: 1
- name: libfoo
+ name: foo
version: 1.0
repository-url: http://pkg.example.org/1/math
trust: AB:0D:3F:C1:B0:13:E4:0E:AD:4A:08:06:AE:F3:85:DB:E2:27:5F:83:11:47:A2:7\
8:64:3C:73:60:F8:66:3A:A4
- test-exclude: libfoo-tests/1.0
- test-exclude: libfoo-examples/1.0
+ requires: host
+ tests: foo-tests
+ examples: foo-examples
machine: windows_10-msvc_14
target: x86_64-microsoft-win32-msvc14.0
environment: lld
@@ -68,6 +69,37 @@ test.options += -t
target: x86_64-microsoft-win32-msvc14.0
EOO
+ : requires
+ :
+ {
+ $* <<EOF >>EOF
+ : 1
+ name: foo
+ version: 1.0
+ repository-url: http://pkg.example.org/1/math
+ requires: c++14
+ requires: host
+ machine: windows
+ target: x86_64-microsoft-win32-msvc14.0
+ EOF
+ }
+
+ : tests
+ :
+ {
+ $* <<EOF >>EOF
+ : 1
+ name: libfoo
+ version: 1.0
+ repository-url: http://pkg.example.org/1/math
+ tests: libfoo-tests
+ examples: libfoo-examples == 1.2.3
+ benchmarks: libfoo-benchmarks ~1.2.0
+ machine: windows
+ target: x86_64-microsoft-win32-msvc14.0
+ EOF
+ }
+
: config
:
{
@@ -96,6 +128,34 @@ test.options += -t
EOF
}
+ : host
+ :
+ {
+ : true
+ :
+ $* <<EOF >>EOF
+ : 1
+ name: libfoo
+ version: 1.0
+ repository-url: http://pkg.example.org/1/math
+ machine: windows
+ target: x86_64-microsoft-win32-msvc14.0
+ host: true
+ EOF
+
+ : false
+ :
+ $* <<EOF >>EOF
+ : 1
+ name: libfoo
+ version: 1.0
+ repository-url: http://pkg.example.org/1/math
+ machine: windows
+ target: x86_64-microsoft-win32-msvc14.0
+ host: false
+ EOF
+ }
+
: trust-yes
:
$* <<EOF >>EOF
@@ -161,6 +221,14 @@ test.options += -t
config: config.cc.loptions=/DEBUG
EOI
+ : host
+ :
+ $* <<EOI 2>'stdin:3:1: error: task host value redefinition' == 1
+ : 1
+ host: true
+ host: false
+ EOI
+
: warning-regex
:
$* <<EOI 2>'stdin:3:1: error: task warning regex redefinition' == 1
@@ -233,37 +301,6 @@ test.options += -t
EOE
}
- : test-exclude
- :
- {
- : invalid-name
- :
- $* <<EOI 2>>EOE == 1
- : 1
- test-exclude: 0ibfoo-tests/1.0
- EOI
- stdin:2:15: error: invalid test exclusion package name: illegal first character (must be alphabetic)
- EOE
-
- : no-version
- :
- $* <<EOI 2>>EOE == 1
- : 1
- test-exclude: libfoo-tests
- EOI
- stdin:2:15: error: invalid test exclusion package: '/' is expected
- EOE
-
- : invalid-version
- :
- $* <<EOI 2>>EOE == 1
- : 1
- test-exclude: libfoo-tests/+1
- EOI
- stdin:2:15: error: invalid test exclusion package version: unexpected end
- EOE
- }
-
: machine-empty
:
$* <<EOI 2>'stdin:2:9: error: empty task machine' == 1
@@ -309,6 +346,13 @@ test.options += -t
}
}
+ : host
+ :
+ $* <<EOI 2>"stdin:2:7: error: invalid task host value 'yes'" == 1
+ : 1
+ host: yes
+ EOI
+
: warning-regex
:
{