diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-02 22:22:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-05 12:19:51 +0300 |
commit | 6eecad33923ae7052086866756d7e4697fe7bbd3 (patch) | |
tree | fd7997a56806609617c1315001ff4ad669cfb6be | |
parent | e99fe489d98be215e13aba8e026c953555ef0029 (diff) |
Add support for test-exclude task manifest value
-rw-r--r-- | libbbot/manifest.cxx | 37 | ||||
-rw-r--r-- | libbbot/manifest.hxx | 17 | ||||
-rw-r--r-- | tests/manifest/task.testscript | 33 |
3 files changed, 84 insertions, 3 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx index df74225..c01a84b 100644 --- a/libbbot/manifest.cxx +++ b/libbbot/manifest.cxx @@ -521,6 +521,38 @@ namespace bbot trust.emplace_back (move (v)); } + else if (n == "test-exclude") + { + 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)); + } + catch (const invalid_argument& e) + { + bad_value (string ("invalid test exclusion package name: ") + + e.what ()); + } + + bpkg::version pv; + + try + { + pv = bpkg::version (string (v, p + 1)); + } + catch (const invalid_argument& e) + { + bad_value (string ("invalid test exclusion package version: ") + + e.what ()); + } + + test_exclusions.push_back (package {move (pn), move (pv)}); + } else if (n == "machine") { if (!machine.empty ()) @@ -637,9 +669,12 @@ namespace bbot // s.next ("repository-url", repository.string ()); - for (const auto& v: trust) + 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 ()); + s.next ("machine", machine); s.next ("target", target.string ()); diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx index bbe7055..daee743 100644 --- a/libbbot/manifest.hxx +++ b/libbbot/manifest.hxx @@ -9,6 +9,7 @@ #include <ostream> #include <libbutl/optional.mxx> +#include <libbutl/small-vector.mxx> #include <libbutl/target-triplet.mxx> #include <libbutl/standard-version.mxx> #include <libbutl/manifest-forward.hxx> @@ -34,7 +35,6 @@ namespace bbot : id (std::move (i)), name (std::move (n)), summary (std::move (s)) {} public: - machine_header_manifest () = default; // VC export. machine_header_manifest ( @@ -102,6 +102,12 @@ namespace bbot serialize (butl::manifest_serializer&) const; }; + struct package + { + bpkg::package_name name; + bpkg::version version; + }; + class LIBBBOT_EXPORT task_manifest { public: @@ -117,6 +123,11 @@ namespace bbot // strings trust; + // Separate tests, examples, and benchmarks packages that should be + // excluded from building together with the primary package. + // + butl::small_vector<package, 1> test_exclusions; + std::string machine; // Build machine to use for building the package. butl::target_triplet target; // Build target. @@ -145,6 +156,7 @@ namespace bbot bpkg::version vr, bpkg::repository_location rl, strings tr, + butl::small_vector<package, 1> te, std::string mn, butl::target_triplet tg, butl::optional<std::string> en, @@ -153,7 +165,8 @@ namespace bbot : name (std::move (nm)), version (std::move (vr)), repository (std::move (rl)), - trust (tr), + trust (std::move (tr)), + test_exclusions (std::move (te)), machine (std::move (mn)), target (std::move (tg)), environment (std::move (en)), diff --git a/tests/manifest/task.testscript b/tests/manifest/task.testscript index 8b27f04..65ecd29 100644 --- a/tests/manifest/task.testscript +++ b/tests/manifest/task.testscript @@ -17,6 +17,8 @@ test.options += -t 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 machine: windows_10-msvc_14 target: x86_64-microsoft-win32-msvc14.0 environment: lld @@ -222,6 +224,37 @@ 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 |