diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-03 12:34:20 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-05-03 12:34:20 +0300 |
commit | 32fc535d7d9e7cea238d8769867372943c9602c1 (patch) | |
tree | 29e8413dcf1cc984bddfdab966b4d714dc636ff0 | |
parent | f7d8a2c9a447e3071f0ed66e68ae636f1ac4a3dd (diff) |
Add support for toolchain name/version in task request manifest
-rw-r--r-- | libbbot/manifest.cxx | 33 | ||||
-rw-r--r-- | libbbot/manifest.hxx | 4 | ||||
-rw-r--r-- | tests/manifest/task-request.test | 38 |
3 files changed, 74 insertions, 1 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx index 89412d7..c52f3e3 100644 --- a/libbbot/manifest.cxx +++ b/libbbot/manifest.cxx @@ -243,6 +243,31 @@ namespace bbot agent = move (v); } + else if (n == "toolchain-name") + { + if (!toolchain_name.empty ()) + bad_name ("task request toolchain name redefinition"); + + if (v.empty ()) + bad_value ("empty task request toolchain name"); + + toolchain_name = move (v); + } + else if (n == "toolchain-version") + { + if (!toolchain_version.empty ()) + bad_name ("task request toolchain version redefinition"); + + try + { + toolchain_version = standard_version (v); + } + catch (const invalid_argument& e) + { + bad_value (string ("invalid task request toolchain version: ") + + e.what ()); + } + } else if (n == "fingerprint") { if (fingerprint) @@ -262,6 +287,12 @@ namespace bbot if (agent.empty ()) bad_value ("no task request agent specified"); + if (toolchain_name.empty ()) + bad_value ("no task request toolchain name specified"); + + if (toolchain_version.empty ()) + bad_value ("no task request toolchain version specified"); + // Parse machine header manifests. // for (nv = p.next (); !nv.empty (); nv = p.next ()) @@ -279,6 +310,8 @@ namespace bbot // s.next ("", "1"); // Start of manifest. s.next ("agent", agent); + s.next ("toolchain-name", toolchain_name); + s.next ("toolchain-version", toolchain_version.string ()); if (fingerprint) s.next ("fingerprint", *fingerprint); diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx index 025efc7..a42eeea 100644 --- a/libbbot/manifest.hxx +++ b/libbbot/manifest.hxx @@ -68,9 +68,13 @@ namespace bbot machine_header_manifests machines; task_request_manifest (std::string a, + std::string n, + butl::standard_version v, butl::optional<std::string> f, machine_header_manifests m) : agent (std::move (a)), + toolchain_name (std::move (n)), + toolchain_version (std::move (v)), fingerprint (std::move (f)), machines (std::move (m)) {} diff --git a/tests/manifest/task-request.test b/tests/manifest/task-request.test index 157b2ea..e3b0cd7 100644 --- a/tests/manifest/task-request.test +++ b/tests/manifest/task-request.test @@ -14,6 +14,8 @@ test.options += -tq $* <<EOF >>EOF : 1 agent: upsa + toolchain-name: queue + toolchain-version: 0.5.0 fingerprint: 1105fb394ee870adb154b7abfbbae5755df7dcef6c81db34e8d1b68d2653734e : id: a2b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 @@ -26,6 +28,8 @@ test.options += -tq $* <<EOF >>EOF : 1 agent: upsa + toolchain-name: queue + toolchain-version: 0.5.0 : id: a2b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 name: windows_10-msvc_14 @@ -44,6 +48,22 @@ test.options += -tq agent: upsa EOI + : toolchain-name + : + $* <<EOI 2>'stdin:3:1: error: task request toolchain name redefinition' == 1 + : 1 + toolchain-name: queue + toolchain-name: queue + EOI + + : toolchain-version + : + $* <<EOI 2>'stdin:3:1: error: task request toolchain version redefinition' == 1 + : 1 + toolchain-version: 0.5.0 + toolchain-version: 0.5.0 + EOI + : fingerprint : $* <<EOI 2>'stdin:3:1: error: task request fingerprint redefinition' == 1 @@ -62,8 +82,22 @@ test.options += -tq : 1 agent: EOI + + : toolchain-name + : + $* <<EOI 2>'stdin:2:16: error: empty task request toolchain name' == 1 + : 1 + toolchain-name: + EOI } +: invalid-toolchain-version +: +$* <<EOI 2>'stdin:2:19: error: invalid task request toolchain version: invalid major version' == 1 +: 1 +toolchain-version: +EOI + : invalid-fingerprint : $* <<EOI 2>'stdin:2:14: error: invalid task request fingerprint' == 1 @@ -84,8 +118,10 @@ EOI : no-machines : -$* <<EOI 2>'stdin:4:1: error: no task request machines specified' == 1 +$* <<EOI 2>'stdin:6:1: error: no task request machines specified' == 1 : 1 agent: upsa +toolchain-name: queue +toolchain-version: 0.5.0 fingerprint: 1105fb394ee870adb154b7abfbbae5755df7dcef6c81db34e8d1b68d2653734e EOI |