diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ci/ci-load.testscript | 24 | ||||
-rw-r--r-- | tests/load/1/basics/packages.manifest | 4 | ||||
-rw-r--r-- | tests/load/1/math/libfoo-1.2.4+1.tar.gz | bin | 1437 -> 1515 bytes | |||
-rw-r--r-- | tests/load/1/math/libfoo-tests-1.2.4.tar.gz | bin | 333 -> 392 bytes | |||
-rw-r--r-- | tests/load/1/math/packages.manifest | 39 | ||||
-rw-r--r-- | tests/load/1/misc/packages.manifest | 21 | ||||
-rw-r--r-- | tests/load/1/stable/packages.manifest | 1 | ||||
-rw-r--r-- | tests/load/1/stable/signature.manifest | 20 | ||||
-rw-r--r-- | tests/load/1/staging/packages.manifest | 12 | ||||
-rw-r--r-- | tests/load/1/testing/packages.manifest | 8 | ||||
-rw-r--r-- | tests/load/driver.cxx | 51 | ||||
-rw-r--r-- | tests/manifest/buildfile | 6 | ||||
-rw-r--r-- | tests/manifest/driver.cxx | 59 | ||||
-rw-r--r-- | tests/manifest/review.testscript | 171 | ||||
-rw-r--r-- | tests/submit/submit-dir.testscript | 12 | ||||
-rw-r--r-- | tests/submit/submit-git.testscript | 6 | ||||
-rw-r--r-- | tests/submit/submit-pub.testscript | 6 |
17 files changed, 392 insertions, 48 deletions
diff --git a/tests/ci/ci-load.testscript b/tests/ci/ci-load.testscript index eb9ba7c..ff75493 100644 --- a/tests/ci/ci-load.testscript +++ b/tests/ci/ci-load.testscript @@ -105,11 +105,13 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% - bootstrap-build:\\ + bootstrap-build: + \\ project = libhello %.+ \\ - root-build:\\ + root-build: + \\ cxx.std = latest %.+ \\ @@ -124,11 +126,13 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% - bootstrap-build:\\ + bootstrap-build: + \\ project = hello %.+ \\ - root-build:\\ + root-build: + \\ cxx.std = latest %.+ \\ @@ -164,11 +168,13 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% - bootstrap-build:\\ + bootstrap-build: + \\ project = hello %.+ \\ - root-build:\\ + root-build: + \\ cxx.std = latest %.+ \\ @@ -205,11 +211,13 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% - bootstrap-build:\\ + bootstrap-build: + \\ project = libhello %.+ \\ - root-build:\\ + root-build: + \\ cxx.std = latest %.+ \\ diff --git a/tests/load/1/basics/packages.manifest b/tests/load/1/basics/packages.manifest index d422df5..95bfedb 100644 --- a/tests/load/1/basics/packages.manifest +++ b/tests/load/1/basics/packages.manifest @@ -7,5 +7,9 @@ summary: The Expat Library license: MIT url: http://www.example.com/expat/ email: expat-users@example.com +bootstrap-build: +\ +project = libexpat +\ location: libexpat-5.1.tar.gz sha256sum: 75ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 diff --git a/tests/load/1/math/libfoo-1.2.4+1.tar.gz b/tests/load/1/math/libfoo-1.2.4+1.tar.gz Binary files differindex 2dde730..db22a19 100644 --- a/tests/load/1/math/libfoo-1.2.4+1.tar.gz +++ b/tests/load/1/math/libfoo-1.2.4+1.tar.gz diff --git a/tests/load/1/math/libfoo-tests-1.2.4.tar.gz b/tests/load/1/math/libfoo-tests-1.2.4.tar.gz Binary files differindex 2efccd0..84a7913 100644 --- a/tests/load/1/math/libfoo-tests-1.2.4.tar.gz +++ b/tests/load/1/math/libfoo-tests-1.2.4.tar.gz diff --git a/tests/load/1/math/packages.manifest b/tests/load/1/math/packages.manifest index 8e66ddf..574370a 100644 --- a/tests/load/1/math/packages.manifest +++ b/tests/load/1/math/packages.manifest @@ -71,14 +71,28 @@ Useful for conversion of research code into production environments. [^mathlab]: MATLAB Capabilities: TODO \ description-type: text/markdown +package-description:\ +This project builds and defines the build2 package for the libfoo library. + +A modern C++ library with easy to use linear algebra and lot of optimization +tools. + +There are over 100 functions in total with an extensive test suite. The API is +similar to ~~mathlab~~ **MATLAB**.[^mathlab] + +Useful for conversion of research code into production environments. +[^mathlab]: MATLAB Capabilities: TODO +\ +package-description-type: text/markdown changes:\ -1.2.4+1 +**1.2.4+1** * applied patch for critical bug-219 * regenerated documentation -1.2.4 +**1.2.4** * test suite extended significantly \ +changes-type: text/markdown url: http://www.example.com/foo/; Project home page. doc-url: http://www.example.org/projects/libfoo/man.xhtml; Documentation page. src-url: http://scm.example.com/?p=odb/libodb.git\;a=tree; Source tree url. @@ -97,23 +111,24 @@ requires: ? ($windows); Only 64-bit. requires: x86_64 ? ; Only if on Windows. requires: * vc++ >= 12.0 ? (windows); Only if using VC++ on Windows. requires: host -tests: * libfoo-tests == 1.2.4 +tests: * libfoo-tests == 1.2.4 ? (!$defined(config.libfoo_tests.test))\ + config.libfoo_tests.test=libfoo examples: libfoo-examples benchmarks: libfoo-benchmarks > 0.0.1 builds: all -network-build-config: config.libfoo.network=true; Enable networking API. network-build-include: windows-vc_14d/x86_64-microsoft-win32-msvc14.0 network-build-exclude: ** +network-build-config: config.libfoo.network=true; Enable networking API. +cache-builds: default +cache-builds: -linux +cache-build-include: windows-vc_14d/x86_64-microsoft-win32-msvc14.0 +cache-build-exclude: ** cache-build-config:\ config.libfoo.cache=true config.libfoo.buffer=4096 ; Enable caching. \ -cache-builds: default -cache-builds: -linux -cache-build-include: windows-vc_14d/x86_64-microsoft-win32-msvc14.0 -cache-build-exclude: ** bootstrap-build:\ project = libfoo @@ -126,7 +141,7 @@ config [uint64] config.libfoo.buffer ?= 1024 \ location: libfoo-1.2.4+1.tar.gz -sha256sum: fe07978d72ab65c2ad72b0325aa56944cf093248d39edcb472a2fe5835defa3d +sha256sum: ffce9d3e3ca9899d3fd6da1f6b93c07cce2c3f6b7004948b59757dae420f801b : name: libfoo-benchmarks version: 1.2.4 @@ -161,8 +176,12 @@ bootstrap-build:\ project = libfoo-tests \ +root-build:\ +config [strings] config.libfoo_tests.test + +\ location: libfoo-tests-1.2.4.tar.gz -sha256sum: bff1e47ef4f9658072dd7f412e97f80179d4257323568c3fa77ce6adbf89ebd1 +sha256sum: 29a97b3356c42602dd81ee2766c242f8974b0a92d8560cb107dd464655d3d527 : name: libpq version: 0 diff --git a/tests/load/1/misc/packages.manifest b/tests/load/1/misc/packages.manifest index b019920..bab35c4 100644 --- a/tests/load/1/misc/packages.manifest +++ b/tests/load/1/misc/packages.manifest @@ -15,6 +15,11 @@ depends: libfoo depends: libmath >= 2.0.0 requires: linux | windows | macosx changes: some changes +changes-type: text/plain +bootstrap-build: +\ +project = libbar +\ location: libbar-2.4.0+3.tar.gz sha256sum: 70ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 : @@ -24,6 +29,10 @@ summary: Foo Library license: MIT url: http://www.example.com/foo/ email: foo-users@example.com +bootstrap-build: +\ +project = libfoo +\ location: libfoo-1.0.tar.gz sha256sum: e89c6d746f8b1ea3ec58d294946d2f683d133438d2ac8c88549ba24c19627e76 : @@ -33,6 +42,10 @@ summary: Foo license: MIT url: http://www.example.com/foo/ email: foo-users@example.com +bootstrap-build: +\ +project = libfoo +\ location: libfoo-0.1.tar.gz sha256sum: 72ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 : @@ -42,6 +55,10 @@ summary: Foo Library license: MIT url: http://www.example.com/foo/ email: foo-users@example.com +bootstrap-build: +\ +project = libfoo +\ location: libfoo-1.2.4+1.tar.gz sha256sum: 6692a487e0908598e36bdeb9c25ed1e4a35bb99587dbc475807d314fa0719ac6 : @@ -51,5 +68,9 @@ summary: Foo Library license: MIT url: http://www.example.com/foo/ email: foo-users@example.com +bootstrap-build: +\ +project = libfoo +\ location: libfoo-1.2.4+2.tar.gz sha256sum: 74ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 diff --git a/tests/load/1/stable/packages.manifest b/tests/load/1/stable/packages.manifest index 8d51838..f15ab90 100644 --- a/tests/load/1/stable/packages.manifest +++ b/tests/load/1/stable/packages.manifest @@ -75,6 +75,7 @@ description: Very good foo library. description-type: text/plain changes: some changes 1 changes: some changes 2 +changes-type: text/plain url: http://www.example.com/foo/ email: foo-users@example.com depends: libmisc >= 2.0.0 diff --git a/tests/load/1/stable/signature.manifest b/tests/load/1/stable/signature.manifest index 9d3b944..bb18e13 100644 --- a/tests/load/1/stable/signature.manifest +++ b/tests/load/1/stable/signature.manifest @@ -1,13 +1,13 @@ : 1 -sha256sum: 300aaa95b27809ca4bccf4b6eeb5f81701117457bd9e6018964004d4bbedbfb8 +sha256sum: defa57373e20beb8f22a391b1e97ec7f5e50469e050c2551e8522fab74f304e1 signature:\ -kBjhtZKRx9FJmJmm+Bh8gUmvK99kQCWmA9qlyLWLfOiapvtliGn65eCh1uCbrjKWGri8SHPD1ABZ -aYcfPE5Cg6L40FltFqYF5qliZo2V8Um3JPd56Bm1S8/yBTftojEBNS4RYBLcLLmd6Blmb9/igTAQ -OOTep/zb3IGZuFzbiLHbfhP7VA4m7PUxV7AlZwSY8IhxzGurQWfBIpGskqkGk57mO+rQy3sq6bWH -IzbgA4hvfkiXyXzcuDIlfcSQaIAfzClqybNaEFgkqKeoZgUkPLbZiYCGasyVCSmCE0gthgOZL7gJ -sJU3iyQMeawCKuQhCr2wz1xhJjLdT41eQ1b4YbtKKneVKOhZDRXosw86xk0Ghi7SeNmWVa2y0UIg -fLIU8um23Gh5Tf37C4pyWjSLVJ4TwAvUGPhxBxd1E2Khuvak/x/+vo983tEikI14InLkdt/KdVpd -lprE9YEACNFaSJ1cwI6aX8exL4a7kku3YG65Mgg+JD5E1HGAOIfCZ/4FJxBF5Mq6cXDT0fIcVR7b -ioAJVa9q+EdRrMXlovCCDvmFUvwggTTL1N1/8o0gZrgJW76BTZrNA+MJ2pkwlsJDrNi6JhqbcbOn -ldZG1n5IwCEt4SvL2LV5iR/iH7iWrIPnkqJJu8rGKWWywz+mmOsl/TBpQylKKXmYLAnWA31htC4= +f9b/Q+mBos6MwwFPIiIBqSEidqO+rMsktQ1ESWEkO48uHN+hjNCog0gp3Vf4QHj0p2KKU5Uz4exj +8h7R3RB0F4B10/lDyHw4XlvAyP1uE+YS76rEXHXuGBEnGvBK9818WkCJ5yfFJYg3AuGt2Cyd3QHF +Uxv+fDkI05KrZNGzLo9euDr6yhHOMTjwSntu/lt6ytfyzTFHcs0xOM03qEtszD5QrNdC32z7kmDE +8ISUlMUyqOjsz8h25F04NyiojccGTpfUTgqA2zXqMAwRn+fG9wU5Vwnau/oIcAO+nUruR4i1VrDd +D5q/gjbOpcBTt7bmbVInR5glbgdPZ7r7gpqfOVwybxeTrArj72jA/XmmYyZlaTTW1RXcJuRIWAcP +2Z61O+cwP9CqW8ktQDNGkgDxxXJR7aEG64G8q7uZeb6v1FaQCwo2JEe/Tv0JDp+DBVKwBm7ZDZi/ +TVtltbADgISCU8bTVz/r4Q0qwHeiQo2GV+Di4h7KvWS8H2Q7sjpyWrI3/UzujOp+zB/BP+6dNZTr +6Mf8CJ+9L5YY4lzX9jeVQLOuKOqLLZWD2VQiyaYZp79X5OtSHuNvCWcaWUa9Rpu/goLCPrk6QHD+ +wUTYcIdsEbX2jDN3YQwe53WklytPbMxy7taRF1obpGOpDDju3InD3IRXS7ch4G9XzqtsylzMIeE= \ diff --git a/tests/load/1/staging/packages.manifest b/tests/load/1/staging/packages.manifest index 97c252a..e42fe43 100644 --- a/tests/load/1/staging/packages.manifest +++ b/tests/load/1/staging/packages.manifest @@ -7,6 +7,10 @@ summary: The Expat Library license: MIT url: http://www.example.com/expat/ email: expat-users@example.com +bootstrap-build: +\ +project = libexpat +\ location: libexpat-5.1.tar.gz sha256sum: 75c0ba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 : @@ -16,6 +20,10 @@ summary: The Genx Library license: MIT url: http://www.example.com/genx/ email: genx-users@example.com +bootstrap-build: +\ +project = libgenx +\ location: libgenx-1.0.tar.gz sha256sum: 75c1ba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 : @@ -26,5 +34,9 @@ license: MIT url: http://www.example.com/misc/ email: misc-users@example.com depends: libexpat >= 5.0 +bootstrap-build: +\ +project = libmisc +\ location: libmisc-1.0.tar.gz sha256sum: 75c2ba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 diff --git a/tests/load/1/testing/packages.manifest b/tests/load/1/testing/packages.manifest index 2d458f0..2606d0e 100644 --- a/tests/load/1/testing/packages.manifest +++ b/tests/load/1/testing/packages.manifest @@ -8,6 +8,10 @@ license: MIT url: http://www.example.com/misc/ email: misc-users@example.com depends: libexpat >= 5.0 +bootstrap-build: +\ +project = libmisc +\ location: libmisc-2.4.0.tar.gz sha256sum: 75ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab94 : @@ -18,5 +22,9 @@ license: MIT url: http://www.example.com/misc/ email: misc-users@example.com depends: libexpat >= 5.0 +bootstrap-build: +\ +project = libmisc +\ location: libmisc-2.3.0+1.tar.gz sha256sum: 11ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab94 diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx index ae3d03d..0f2c8de 100644 --- a/tests/load/driver.cxx +++ b/tests/load/driver.cxx @@ -57,7 +57,7 @@ check_external (const package& p) !p.internal () && p.other_repositories.size () > 0 && p.priority == priority () && - p.changes.empty () && + !p.changes && p.license_alternatives.empty () && p.dependencies.empty () && p.requirements.empty () && @@ -384,7 +384,7 @@ test_pkg_repos (const cstrings& loader_args, assert (fpvxy->other_repositories.empty ()); assert (fpvxy->priority == priority::low); - assert (fpvxy->changes.empty ()); + assert (!fpvxy->changes); assert (fpvxy->license_alternatives.size () == 1); assert (fpvxy->license_alternatives[0].size () == 1); @@ -420,7 +420,7 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv1->other_repositories[1].load () == cr); assert (fpv1->priority == priority::low); - assert (fpv1->changes.empty ()); + assert (!fpv1->changes); assert (fpv1->license_alternatives.size () == 1); assert (fpv1->license_alternatives[0].size () == 1); @@ -454,7 +454,7 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv2->internal_repository.load () == sr); assert (fpv2->other_repositories.empty ()); assert (fpv2->priority == priority::low); - assert (fpv2->changes.empty ()); + assert (!fpv2->changes); assert (fpv2->license_alternatives.size () == 1); assert (fpv2->license_alternatives[0].size () == 1); @@ -500,7 +500,7 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv2a->internal_repository.load () == sr); assert (fpv2a->other_repositories.empty ()); assert (fpv2a->priority == priority::security); - assert (fpv2a->changes.empty ()); + assert (!fpv2a->changes); assert (fpv2a->license_alternatives.size () == 1); assert (fpv2a->license_alternatives[0].size () == 1); @@ -563,7 +563,7 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv3->other_repositories.empty ()); assert (fpv3->priority == priority::medium); - assert (fpv3->changes.empty ()); + assert (!fpv3->changes); assert (fpv3->license_alternatives.size () == 1); assert (fpv3->license_alternatives[0].size () == 1); @@ -591,7 +591,7 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv4->summary == "The Foo Library"); assert (fpv4->keywords == labels ({"c++", "foo"})); - assert (*fpv4->description == "Very good foo library."); + assert (fpv4->description->text == "Very good foo library."); assert (fpv4->url && fpv4->url->string () == "http://www.example.com/foo/"); assert (!fpv4->package_url); assert (fpv4->email && *fpv4->email == "foo-users@example.com"); @@ -600,7 +600,10 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv4->internal_repository.load () == sr); assert (fpv4->other_repositories.empty ()); assert (fpv4->priority == priority::low); - assert (fpv4->changes == "some changes 1\n\nsome changes 2"); + + assert (fpv4->changes && + fpv4->changes->text == "some changes 1\n\nsome changes 2" && + fpv4->changes->type == text_type::plain); assert (fpv4->license_alternatives.size () == 1); assert (fpv4->license_alternatives[0].comment == @@ -686,7 +689,7 @@ test_pkg_repos (const cstrings& loader_args, assert (xpv->internal_repository.load () == mr); assert (xpv->other_repositories.empty ()); assert (xpv->priority == priority::low); - assert (xpv->changes.empty ()); + assert (!xpv->changes); assert (xpv->license_alternatives.size () == 1); assert (xpv->license_alternatives[0].size () == 1); @@ -724,7 +727,19 @@ test_pkg_repos (const cstrings& loader_args, labels ({"math library", "math API", "libbaz fork"})); assert (fpv5->keywords == labels ({"c++", "foo", "math", "best"})); - assert (*fpv5->description == + assert (fpv5->description->text == + "A modern C++ library with easy to use linear algebra and lot " + "of optimization\ntools.\n\nThere are over 100 functions in " + "total with an extensive test suite. The API is\nsimilar to " + "~~mathlab~~ **MATLAB**.[^mathlab]\n\nUseful for conversion of " + "research code into production environments.\n" + "[^mathlab]: MATLAB Capabilities: TODO"); + + assert (fpv5->description->type == text_type::github_mark); + + assert (fpv5->package_description->text == + "This project builds and defines the build2 package for the " + "libfoo library.\n\n" "A modern C++ library with easy to use linear algebra and lot " "of optimization\ntools.\n\nThere are over 100 functions in " "total with an extensive test suite. The API is\nsimilar to " @@ -732,6 +747,8 @@ test_pkg_repos (const cstrings& loader_args, "research code into production environments.\n" "[^mathlab]: MATLAB Capabilities: TODO"); + assert (fpv5->package_description->type == text_type::github_mark); + assert (fpv5->url && fpv5->url->string () == "http://www.example.com/foo/"); assert (fpv5->doc_url && fpv5->doc_url->string () == @@ -756,14 +773,16 @@ test_pkg_repos (const cstrings& loader_args, assert (fpv5->priority.comment == "Critical bug fixes, performance improvement."); - const char ch[] = R"DLM(1.2.4+1 + const char ch[] = R"DLM(**1.2.4+1** * applied patch for critical bug-219 * regenerated documentation -1.2.4 +**1.2.4** * test suite extended significantly)DLM"; - assert (fpv5->changes == ch); + assert (fpv5->changes && + fpv5->changes->text == ch && + fpv5->changes->type == text_type::github_mark); assert (fpv5->license_alternatives.size () == 2); assert (fpv5->license_alternatives[0].comment == @@ -843,7 +862,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv5)); assert (fpv5->sha256sum && *fpv5->sha256sum == - "fe07978d72ab65c2ad72b0325aa56944cf093248d39edcb472a2fe5835defa3d"); + "ffce9d3e3ca9899d3fd6da1f6b93c07cce2c3f6b7004948b59757dae420f801b"); assert (fpv5->buildable); @@ -859,7 +878,7 @@ test_pkg_repos (const cstrings& loader_args, assert (epv->project == "mathLab"); assert (epv->summary == "The exponent"); assert (epv->keywords == labels ({"mathlab", "c++", "exponent"})); - assert (epv->description && *epv->description == + assert (epv->description && epv->description->text == "The exponent math function."); assert (epv->url && epv->url->string () == "http://exp.example.com"); assert (!epv->package_url); @@ -870,7 +889,7 @@ test_pkg_repos (const cstrings& loader_args, assert (epv->internal_repository.load () == mr); assert (epv->other_repositories.empty ()); assert (epv->priority == priority (priority::low)); - assert (epv->changes.empty ()); + assert (!epv->changes); assert (epv->license_alternatives.size () == 1); assert (epv->license_alternatives[0].size () == 1); diff --git a/tests/manifest/buildfile b/tests/manifest/buildfile new file mode 100644 index 0000000..e6f5a85 --- /dev/null +++ b/tests/manifest/buildfile @@ -0,0 +1,6 @@ +# file : tests/manifest/buildfile +# license : MIT; see accompanying LICENSE file + +import libs = lib{brep} + +exe{driver}: {hxx cxx}{*} $libs testscript{*} diff --git a/tests/manifest/driver.cxx b/tests/manifest/driver.cxx new file mode 100644 index 0000000..5c70ea5 --- /dev/null +++ b/tests/manifest/driver.cxx @@ -0,0 +1,59 @@ +// file : tests/manifest/driver.cxx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +#include <ios> // ios_base::failbit, ios_base::badbit +#include <iostream> + +#include <libbutl/utility.hxx> // operator<<(ostream,exception) +#include <libbutl/manifest-parser.hxx> +#include <libbutl/manifest-serializer.hxx> + +#include <libbrep/review-manifest.hxx> + +#undef NDEBUG +#include <cassert> + +using namespace std; +using namespace butl; +using namespace brep; + +// Usage: argv[0] (-r | -rl) +// +// Read and parse manifest from STDIN and serialize it to STDOUT. The +// following options specify the manifest type. +// +// -r parse review manifest +// -rl parse review manifest list +// +int +main (int argc, char* argv[]) +try +{ + assert (argc == 2); + string opt (argv[1]); + + cin.exceptions (ios_base::failbit | ios_base::badbit); + cout.exceptions (ios_base::failbit | ios_base::badbit); + + manifest_parser p (cin, "stdin"); + manifest_serializer s (cout, "stdout"); + + if (opt == "-r") + review_manifest (p).serialize (s); + else if (opt == "-rl") + review_manifests (p).serialize (s); + else + assert (false); + + return 0; +} +catch (const manifest_parsing& e) +{ + cerr << e << endl; + return 1; +} +catch (const manifest_serialization& e) +{ + cerr << e << endl; + return 1; +} diff --git a/tests/manifest/review.testscript b/tests/manifest/review.testscript new file mode 100644 index 0000000..e3daa66 --- /dev/null +++ b/tests/manifest/review.testscript @@ -0,0 +1,171 @@ +# file : tests/manifest/review.testscript +# license : MIT; see accompanying LICENSE file + +: single-manifest +: +{ + test.options += -r + + : valid + : + : Roundtrip the review manifest. + : + { + $* <<EOF >>EOF + : 1 + reviewed-by: John Doe <john@doe.com> + result-code: pass + result-build: fail + result-doc: unchanged + base-version: 1.0.2+3 + details-url: https://example.com/issues/1 + EOF + } + + : unknown-name + : + { + $* <<EOI 2>"stdin:2:1: error: unknown name 'unknown-name' in review manifest" != 0 + : 1 + unknown-name: John Doe <john@doe.com> + EOI + } + + : redefinition + : + { + : reviewed-by + : + { + $* <<EOI 2>"stdin:3:1: error: reviewer redefinition" != 0 + : 1 + reviewed-by: John Doe <john@doe.com> + reviewed-by: John Doe <john@doe.com> + EOI + } + + : result-code + : + { + $* <<EOI 2>"stdin:3:1: error: code review result redefinition" != 0 + : 1 + result-code: pass + result-code: fail + EOI + } + } + + : invalid + : + { + : reviewed-by-empty + : + { + $* <<EOI 2>"stdin:2:13: error: empty reviewer" != 0 + : 1 + reviewed-by: + EOI + } + + : result-code + : + { + $* <<EOI 2>"stdin:2:14: error: invalid review result 'fails'" != 0 + : 1 + result-code: fails + EOI + } + + : details-url + : + { + $* <<EOI 2>"stdin:2:13: error: empty URL" != 0 + : 1 + details-url: + EOI + } + } + + : mandatory + : + { + : reviewed-by + : + { + $* <<EOI 2>"stdin:2:1: error: no reviewer specified" != 0 + : 1 + EOI + } + + : no-result + : + { + $* <<EOI 2>"stdin:3:1: error: no result specified" != 0 + : 1 + reviewed-by: John Doe <john@doe.com> + EOI + } + + : no-base-version + : + { + $* <<EOI 2>"stdin:4:1: error: no base version specified" != 0 + : 1 + reviewed-by: John Doe <john@doe.com> + result-code: unchanged + EOI + } + + : no-details-url + : + { + $* <<EOI 2>"stdin:4:1: error: no details url specified" != 0 + : 1 + reviewed-by: John Doe <john@doe.com> + result-code: fail + EOI + } + } +} + +: multiple-manifests +: +{ + test.options += -rl + + : valid-manifest-list + : + : Roundtrip the review manifests list. + : + { + $* <<EOF >>EOF + : 1 + reviewed-by: John Doe <john@doe.com> + result-code: pass + : + reviewed-by: John Doe <john@doe.com> + result-build: pass + EOF + } + + : empty-manifest-list + : + : Roundtrip the empty manifests list. + : + { + $* <:'' >:'' + } + + : no-details-url + : + { + $* <<EOI 2>"stdin:7:1: error: no details url specified" != 0 + : 1 + reviewed-by: John Doe <john@doe.com> + result-build: pass + : + reviewed-by: John Doe <john@doe.com> + result-code: fail + EOI + } +} diff --git a/tests/submit/submit-dir.testscript b/tests/submit/submit-dir.testscript index 81dc494..3bc908f 100644 --- a/tests/submit/submit-dir.testscript +++ b/tests/submit/submit-dir.testscript @@ -77,7 +77,17 @@ $* >>"EOO" : 1 status: 400 - message: archive is not a valid package \(run bpkg pkg-verify for details\) + message: + \\ + package archive is not valid + + gzip: libhello-0.1.0.tar.gz: not in gzip format + tar: This does not look like a tar archive + tar: libhello-0.1.0/manifest: Not found in archive + tar: Exiting with failure status due to previous errors + info: libhello-0.1.0.tar.gz does not appear to be a bpkg package + info: run bpkg pkg-verify for details + \\ reference: $checksum EOO } diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript index ec87637..5197afc 100644 --- a/tests/submit/submit-git.testscript +++ b/tests/submit/submit-git.testscript @@ -21,7 +21,11 @@ clone_root_ref = [cmdline] cp --no-cleanup -r $root_ref ./ &ref.git/*** +mkdir --no-cleanup $root_ref +$g -C $root_ref init --bare &ref.git/*** -+$g clone $root_ref $root_ref_dir &ref/*** +# Convert specific warnings to infos as we expect them to appear. This, in +# particular, prevents bbot workers to set task result status to warning. +# ++git clone $root_ref $root_ref_dir &ref/*** 2>&1 | \ + sed -e 's/warning: (.*cloned an empty repository.*)/info: \1/' >&2 2>! +cat <<EOI >=$root_ref_dir/submit.config.bash sections[alpha]=1/alpha diff --git a/tests/submit/submit-pub.testscript b/tests/submit/submit-pub.testscript index 8c042a7..a846b82 100644 --- a/tests/submit/submit-pub.testscript +++ b/tests/submit/submit-pub.testscript @@ -182,7 +182,8 @@ clone_root_rep = [cmdline] cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock $* $~/brep-loader $~/pkg $~/$data_dir >>~"%EOO%" : 1 status: 400 - message:\\ + message: + \\ submitted archive is not a valid package %.+ \\ @@ -203,7 +204,8 @@ clone_root_rep = [cmdline] cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock $* $~/brep-loader $~/pkg $~/$data_dir >>~"%EOO%" : 1 status: 400 - message:\\ + message: + \\ unable to add package to repository %.+ \\ |