diff options
Diffstat (limited to 'tests')
30 files changed, 519 insertions, 99 deletions
diff --git a/tests/ci/ci-load.testscript b/tests/ci/ci-load.testscript index 57fa9d1..eb9ba7c 100644 --- a/tests/ci/ci-load.testscript +++ b/tests/ci/ci-load.testscript @@ -105,6 +105,14 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% + bootstrap-build:\\ + project = libhello + %.+ + \\ + root-build:\\ + cxx.std = latest + %.+ + \\ location: libhello %fragment: .+% : @@ -116,6 +124,14 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% + bootstrap-build:\\ + project = hello + %.+ + \\ + root-build:\\ + cxx.std = latest + %.+ + \\ location: hello %fragment: .+% EOE @@ -148,6 +164,14 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% + bootstrap-build:\\ + project = hello + %.+ + \\ + root-build:\\ + cxx.std = latest + %.+ + \\ location: hello %fragment: .+% EOE @@ -181,6 +205,14 @@ email: user@example.org %depends: \\* build2 .+% %depends: \\* bpkg .+% + bootstrap-build:\\ + project = libhello + %.+ + \\ + root-build:\\ + cxx.std = latest + %.+ + \\ location: libhello %fragment: .+% EOE @@ -200,7 +232,11 @@ %. reference: $request_id EOO - %.*:.*%+ + %.+cache:cache% + : 1 + %.+ + : 1 + %.+ EOE } } diff --git a/tests/ci/data.testscript b/tests/ci/data.testscript index 74a1527..6f44c85 100644 --- a/tests/ci/data.testscript +++ b/tests/ci/data.testscript @@ -3,11 +3,11 @@ # Pre-created CI request data directory that will be copied by subsequent # tests and scope setup commands. The common approach will be that group -# scopes copy and modify the parent scope submission directory as required +# scopes copy and modify the parent scope request data directory as required # by the nested tests and scopes. Tests will also clone the parent scope -# submission data directory to optionally modify it, use and cleanup at the -# end. Note that configuration can not be shared between multiple submission -# handler processes. Also we need to make sure that submission data +# request data data directory to optionally modify it, use and cleanup at the +# end. Note that request data directory can not be shared between multiple +# submission handler processes. Also we need to make sure that request data # directories are not cloned while being used by submission handler scripts. # data_dir = $regex.replace($path_search('*/request.manifest', $src_base), \ @@ -34,10 +34,10 @@ root_data_dir = $~/$data_dir # The most commonly used submission data directory cloning command that copies # it from the parent scope working directory. # -clone_data = cp --no-cleanup -r ../$data_dir ./ -clone_data_clean = cp --no-cleanup -r ../$data_dir ./ &$data_dir/*** +clone_data = [cmdline] cp --no-cleanup -r ../$data_dir ./ +clone_data_clean = [cmdline] cp --no-cleanup -r ../$data_dir ./ &$data_dir/*** # Clones the original submission data directory. # -clone_root_data = cp --no-cleanup -r $root_data_dir ./ -clone_root_data_clean = cp --no-cleanup -r $root_data_dir ./ &$data_dir/*** +clone_root_data = [cmdline] cp --no-cleanup -r $root_data_dir ./ +clone_root_data_clean = [cmdline] cp --no-cleanup -r $root_data_dir ./ &$data_dir/*** diff --git a/tests/load/1/math/libexp-+2-1.2+1.tar.gz b/tests/load/1/math/libexp-+2-1.2+1.tar.gz Binary files differindex 5beeb84..b223d9f 100644 --- a/tests/load/1/math/libexp-+2-1.2+1.tar.gz +++ b/tests/load/1/math/libexp-+2-1.2+1.tar.gz diff --git a/tests/load/1/math/libfoo-+0-X.Y.tar.gz b/tests/load/1/math/libfoo-+0-X.Y.tar.gz Binary files differindex 6867d4f..95364bb 100644 --- a/tests/load/1/math/libfoo-+0-X.Y.tar.gz +++ b/tests/load/1/math/libfoo-+0-X.Y.tar.gz diff --git a/tests/load/1/math/libfoo-1.0.tar.gz b/tests/load/1/math/libfoo-1.0.tar.gz Binary files differindex 2d445ec..3f23ab9 100644 --- a/tests/load/1/math/libfoo-1.0.tar.gz +++ b/tests/load/1/math/libfoo-1.0.tar.gz 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 a52548c..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-benchmarks-1.2.4.tar.gz b/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz Binary files differindex 391eb6f..f1c9ba0 100644 --- a/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz +++ b/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz diff --git a/tests/load/1/math/libfoo-examples-1.2.4.tar.gz b/tests/load/1/math/libfoo-examples-1.2.4.tar.gz Binary files differindex eac5190..00164e6 100644 --- a/tests/load/1/math/libfoo-examples-1.2.4.tar.gz +++ b/tests/load/1/math/libfoo-examples-1.2.4.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 223e24d..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/libpq-0.tar.gz b/tests/load/1/math/libpq-0.tar.gz Binary files differindex b880520..d4beb18 100644 --- a/tests/load/1/math/libpq-0.tar.gz +++ b/tests/load/1/math/libpq-0.tar.gz diff --git a/tests/load/1/math/libstudxml-1.0.0+1.tar.gz b/tests/load/1/math/libstudxml-1.0.0+1.tar.gz Binary files differindex 41c9637..dcf0ee5 100644 --- a/tests/load/1/math/libstudxml-1.0.0+1.tar.gz +++ b/tests/load/1/math/libstudxml-1.0.0+1.tar.gz diff --git a/tests/load/1/math/packages.manifest b/tests/load/1/math/packages.manifest index 882aff6..574370a 100644 --- a/tests/load/1/math/packages.manifest +++ b/tests/load/1/math/packages.manifest @@ -19,15 +19,23 @@ builds: default legacy build-include: windows**d/x86_64** build-include: windows-vc_13** build-exclude: **; Only supported on Windows. +bootstrap-build:\ +project = libexp + +\ location: libexp-+2-1.2+1.tar.gz -sha256sum: 317c8c6f45d9dfdfdef3a823411920cecd51729c7c4f58f9a0b0bbd681c07bd6 +sha256sum: d90cfe583890cd0c05cdfc204e69dd3b986c2da49851f7a87fa0ca870788ff79 : name: libfoo version: +0-X.Y summary: The Foo Library license: MIT +bootstrap-build:\ +project = libfoo + +\ location: libfoo-+0-X.Y.tar.gz -sha256sum: c994fd49f051ab7fb25f3a4e68ca878e484c5d3c2cb132b37d41224b0621b618 +sha256sum: c25e5cae2f72664a3961c3ef88a82e67150c4bcc2a5e1fb4d250e621c5574187 : name: libfoo version: 1.0 @@ -37,8 +45,12 @@ build-email: foo-builds@example.com builds: default legacy; Stable configurations only. builds: -32; 64-bit targets only builds: &msvc_13_up; Not too old MSVC. +bootstrap-build:\ +project = libfoo + +\ location: libfoo-1.0.tar.gz -sha256sum: e89c6d746f8b1ea3ec58d294946d2f683d133438d2ac8c88549ba24c19627e76 +sha256sum: 7382152bac5b4ce10215a5ecd6c94c490d0efc007031d3b03f407d068b74e624 : name: libfoo version: 1.2.4+1 @@ -59,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. @@ -85,35 +111,77 @@ 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-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. +\ +bootstrap-build:\ +project = libfoo + +\ +root-build:\ +config [bool] config.libfoo.network ?= false + +config [bool] config.libfoo.cache ?= false +config [uint64] config.libfoo.buffer ?= 1024 + +\ location: libfoo-1.2.4+1.tar.gz -sha256sum: d23a7ff116ab7264c3d423af97e4830bdaa8c9101cd95b210b19a97bb8512b74 +sha256sum: ffce9d3e3ca9899d3fd6da1f6b93c07cce2c3f6b7004948b59757dae420f801b : name: libfoo-benchmarks version: 1.2.4 summary: The Foo Math Library benchmarks license: MIT builds: 64; Fails building for 32 bits. +bootstrap-build:\ +project = libfoo-benchmarks + +\ location: libfoo-benchmarks-1.2.4.tar.gz -sha256sum: ba664343db5b9bd574450175834b0dd39d038dcff7387477b6eff0d5783a8ac4 +sha256sum: 8392db99b1ea0c78fe2c73d8c0ae35f8a31d798c8ed26ebf09b4bf557b4e3ce0 : name: libfoo-examples version: 1.2.4 summary: The Foo Math Library examples license: MIT builds: 64; Fails building for 32 bits. +bootstrap-build:\ +project = libfoo-examples + +\ location: libfoo-examples-1.2.4.tar.gz -sha256sum: 1343d1826c3ae5446ad965bc9aa7b1586e4238c7736c344e63a4a6bae3d57a88 +sha256sum: de1bf595994a63361262727594de94edbd77fff8234066da74672e44eb4349f2 : name: libfoo-tests version: 1.2.4 summary: The Foo Math Library tests license: MIT builds: 64; Fails building for 32 bits. +bootstrap-build:\ +project = libfoo-tests + +\ +root-build:\ +config [strings] config.libfoo_tests.test + +\ location: libfoo-tests-1.2.4.tar.gz -sha256sum: c5c0520b4e612fa2f8948c42824f3e199926c2395bf2c2f898e83f9eb19261a4 +sha256sum: 29a97b3356c42602dd81ee2766c242f8974b0a92d8560cb107dd464655d3d527 : name: libpq version: 0 @@ -148,8 +216,12 @@ package-url: https://git.build2.org/cgit/packaging/postgresql/ email: pgsql-general@postgresql.org; Mailing list. package-email: packaging@build2.org; Mailing list. requires: build2 >= 0.4.0 +bootstrap-build:\ +project = libpq + +\ location: libpq-0.tar.gz -sha256sum: 367e72c8cc4aca1cdb99aacfefb0117ca333031775ff7435b0fa1f4988e33a31 +sha256sum: 2aee2bb1d58d51c657903bbab6253c5d4566b6f3f299ba118da24c7756caebfd : name: libstudxml version: 1.0.0+1 @@ -164,5 +236,9 @@ build-warning-email: studxml-warnings@example.com build-error-email: studxml-errors@example.com depends: libexpat >= 2.0.0 depends: libgenx +bootstrap-build:\ +project = libstudxml + +\ location: libstudxml-1.0.0+1.tar.gz -sha256sum: 1833906dd93ccc0cda832d6a1b3ef9ed7877bb9958b46d9b2666033d4a7919c9 +sha256sum: aa52d5b49ee1bad825cd6bca554f72636e8451f93c74f9a443bafce3c2bf82c0 diff --git a/tests/load/1/misc/packages.manifest b/tests/load/1/misc/packages.manifest index b019920..86620dd 100644 --- a/tests/load/1/misc/packages.manifest +++ b/tests/load/1/misc/packages.manifest @@ -15,6 +15,7 @@ depends: libfoo depends: libmath >= 2.0.0 requires: linux | windows | macosx changes: some changes +changes-type: text/plain location: libbar-2.4.0+3.tar.gz sha256sum: 70ccba3da34dd0296866027a26b6bacf08cacc80f54516d3b8d8eeccbe31ab93 : diff --git a/tests/load/1/stable/libfoo-1.0.tar.gz b/tests/load/1/stable/libfoo-1.0.tar.gz Binary files differindex 2d445ec..3f23ab9 100644 --- a/tests/load/1/stable/libfoo-1.0.tar.gz +++ b/tests/load/1/stable/libfoo-1.0.tar.gz diff --git a/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz b/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz Binary files differindex aa5665e..1dfff70 100644 --- a/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz +++ b/tests/load/1/stable/libfoo-1.2.2-alpha.1.tar.gz diff --git a/tests/load/1/stable/libfoo-1.2.2.tar.gz b/tests/load/1/stable/libfoo-1.2.2.tar.gz Binary files differindex 94aca23..22eb89b 100644 --- a/tests/load/1/stable/libfoo-1.2.2.tar.gz +++ b/tests/load/1/stable/libfoo-1.2.2.tar.gz diff --git a/tests/load/1/stable/libfoo-1.2.3+4.tar.gz b/tests/load/1/stable/libfoo-1.2.3+4.tar.gz Binary files differindex 254f355..76439b0 100644 --- a/tests/load/1/stable/libfoo-1.2.3+4.tar.gz +++ b/tests/load/1/stable/libfoo-1.2.3+4.tar.gz diff --git a/tests/load/1/stable/libfoo-1.2.4.tar.gz b/tests/load/1/stable/libfoo-1.2.4.tar.gz Binary files differindex dc64431..da70cd3 100644 --- a/tests/load/1/stable/libfoo-1.2.4.tar.gz +++ b/tests/load/1/stable/libfoo-1.2.4.tar.gz diff --git a/tests/load/1/stable/packages.manifest b/tests/load/1/stable/packages.manifest index 1c5dd58..f15ab90 100644 --- a/tests/load/1/stable/packages.manifest +++ b/tests/load/1/stable/packages.manifest @@ -9,8 +9,12 @@ build-email: foo-builds@example.com builds: default legacy; Stable configurations only. builds: -32; 64-bit targets only builds: &msvc_13_up; Not too old MSVC. +bootstrap-build:\ +project = libfoo + +\ location: libfoo-1.0.tar.gz -sha256sum: e89c6d746f8b1ea3ec58d294946d2f683d133438d2ac8c88549ba24c19627e76 +sha256sum: 7382152bac5b4ce10215a5ecd6c94c490d0efc007031d3b03f407d068b74e624 : name: libfoo version: 1.2.2-alpha.1 @@ -23,8 +27,12 @@ email: foo-users@example.com depends: libmisc [0.1 2.0-) | libmisc [2.0 5.0] depends: libgenx (0.2 3.0) depends: libexpat < 5.2 | libexpat (1 5.1] +bootstrap-build:\ +project = libfoo + +\ location: libfoo-1.2.2-alpha.1.tar.gz -sha256sum: f5d3e9e6e8f9621a638b1375d31f0eb50e6279d8066170b25da21e84198cfd82 +sha256sum: 71321f6616036380ac5c9c5dc81efa04b23577ef9dc18f1ce413587bb57677c9 : name: libfoo version: 1.2.2 @@ -35,8 +43,12 @@ url: http://www.example.com/foo/ email: foo-users@example.com depends: libbar <= 2.4.0 depends: libexp == +2-1.2 +bootstrap-build:\ +project = libfoo + +\ location: libfoo-1.2.2.tar.gz -sha256sum: 088068ea3d69542a153f829cf836013374763148fba0a43d8047974f58b5efd7 +sha256sum: 75d2a7d3eec62d63afd3d3a84d91bd02b05ecb16cd0907d5b0db1fc654e3753f : name: libfoo version: 1.2.3+4 @@ -47,8 +59,12 @@ keywords: c++ foo url: http://www.example.com/foo/ email: foo-users@example.com depends: libmisc >= 2.0.0 +bootstrap-build:\ +project = libfoo + +\ location: libfoo-1.2.3+4.tar.gz -sha256sum: f2ebecac6cac8addd7c623bc1becf055e76b13a0d2dd385832b92c38c58956d8 +sha256sum: 24c53899bd4dbfdde6a727e07724984bfb4ca7f20142291c40e30304f15434c3 : name: libfoo version: 1.2.4 @@ -59,8 +75,13 @@ 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 +bootstrap-build:\ +project = libfoo + +\ location: libfoo-1.2.4.tar.gz -sha256sum: aa1606323bfc59b70de642629dc5d8318cc5348e3646f90ed89406d975db1e1d +sha256sum: 98f80ca0cd1c053fd45ab37f72a6a31f1a0304747c636822df8d573420284642 diff --git a/tests/load/1/stable/signature.manifest b/tests/load/1/stable/signature.manifest index 8201745..bb18e13 100644 --- a/tests/load/1/stable/signature.manifest +++ b/tests/load/1/stable/signature.manifest @@ -1,13 +1,13 @@ : 1 -sha256sum: 2c710248e2654f57c0d572585195f2221a33a6fbe753a511874b2006db5c221a +sha256sum: defa57373e20beb8f22a391b1e97ec7f5e50469e050c2551e8522fab74f304e1 signature:\ -C8H2WkJR27bK35E0IAQxdLtR7vjYcQxvMxdPQSnk3GhpFQwRhpQ/dF0b81cC1a6ytd5/uPwM/L+x -Ki2GJvIuvvWurySofFGVd1iMYeOKMpHWbcYx+MvoDm2vxgUQxh3he5AAt5FPvvaGd72fmRWeoVdm -cpZmPKhGIQffGTcL4bifgXgCEQDPjArZY2g7Van/ZWbEhFQGRYVGvLbfZpeNG5OZSYV1kRrCI7lE -nGMsH/HfrkUivwPx5K0WyDF+ukj/DoZaY5PD+XHZ6hVVza++X5/0mH55yurrU1DG+jV/2HP1WGXL -tZq9sWOrdCG1zkfdefRY5ZbYVc82PeLzdONNLNaPYs2G/wFoPaYiXweiJ/rF6OGm6mcquupaBCeX -iR+c9IHiZBXhxGXkY0YsVzgsv/RxDi8LfUS6z/h1NN686F93jPwieKDJRBGl6voyH1h8O1j/aRCw -1MpeNFttF+U4GPDWkUadCoxpygPZOHJc7SW0EreJI8iePwrQDaJSdxo11DqCSpHs57YUnhJUT/q1 -C9RalWCKfAJgk5i83dbKBpTZqCq0oHoh5iHTr9y9IH9yAAvoUudppoM1IGNnT42frVNXPwjRJLB2 -j0NDKPkeBBg0Cgd2vZ7kvarKOP0GPiNUOUv17mFo6c1W9DEmZFoAfc0iyYOE76VgJsAK0UY8MZI= +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/driver.cxx b/tests/load/driver.cxx index 727f054..0f2c8de 100644 --- a/tests/load/driver.cxx +++ b/tests/load/driver.cxx @@ -3,7 +3,6 @@ #include <iostream> #include <exception> -#include <algorithm> // sort(), find() #include <odb/session.hxx> #include <odb/transaction.hxx> @@ -39,7 +38,7 @@ check_location (shared_ptr<package>& p) { if (p->internal ()) return p->location && *p->location == - path (p->name.string () + "-" + p->version.string () + ".tar.gz"); + path (p->name.string () + '-' + p->version.string () + ".tar.gz"); else return !p->location; } @@ -58,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 () && @@ -385,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); @@ -397,7 +396,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpvxy)); assert (fpvxy->sha256sum && *fpvxy->sha256sum == - "c994fd49f051ab7fb25f3a4e68ca878e484c5d3c2cb132b37d41224b0621b618"); + "c25e5cae2f72664a3961c3ef88a82e67150c4bcc2a5e1fb4d250e621c5574187"); assert (fpvxy->buildable); @@ -421,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); @@ -433,7 +432,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv1)); assert (fpv1->sha256sum && *fpv1->sha256sum == - "e89c6d746f8b1ea3ec58d294946d2f683d133438d2ac8c88549ba24c19627e76"); + "7382152bac5b4ce10215a5ecd6c94c490d0efc007031d3b03f407d068b74e624"); assert (fpv1->buildable); @@ -455,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); @@ -478,7 +477,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv2)); assert (fpv2->sha256sum && *fpv2->sha256sum == - "088068ea3d69542a153f829cf836013374763148fba0a43d8047974f58b5efd7"); + "75d2a7d3eec62d63afd3d3a84d91bd02b05ecb16cd0907d5b0db1fc654e3753f"); assert (!fpv2->buildable); @@ -501,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); @@ -542,7 +541,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv2a)); assert (fpv2a->sha256sum && *fpv2a->sha256sum == - "f5d3e9e6e8f9621a638b1375d31f0eb50e6279d8066170b25da21e84198cfd82"); + "71321f6616036380ac5c9c5dc81efa04b23577ef9dc18f1ce413587bb57677c9"); assert (!fpv2a->buildable); @@ -564,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); @@ -580,7 +579,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv3)); assert (fpv3->sha256sum && *fpv3->sha256sum == - "f2ebecac6cac8addd7c623bc1becf055e76b13a0d2dd385832b92c38c58956d8"); + "24c53899bd4dbfdde6a727e07724984bfb4ca7f20142291c40e30304f15434c3"); assert (!fpv3->buildable); @@ -592,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"); @@ -601,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 == @@ -619,7 +621,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv4)); assert (fpv4->sha256sum && *fpv4->sha256sum == - "aa1606323bfc59b70de642629dc5d8318cc5348e3646f90ed89406d975db1e1d"); + "98f80ca0cd1c053fd45ab37f72a6a31f1a0304747c636822df8d573420284642"); assert (!fpv4->buildable); @@ -687,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); @@ -708,7 +710,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (xpv)); assert (xpv->sha256sum && *xpv->sha256sum == - "1833906dd93ccc0cda832d6a1b3ef9ed7877bb9958b46d9b2666033d4a7919c9"); + "aa52d5b49ee1bad825cd6bca554f72636e8451f93c74f9a443bafce3c2bf82c0"); assert (xpv->buildable); @@ -725,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 " @@ -733,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 () == @@ -757,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 == @@ -844,7 +862,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (fpv5)); assert (fpv5->sha256sum && *fpv5->sha256sum == - "d23a7ff116ab7264c3d423af97e4830bdaa8c9101cd95b210b19a97bb8512b74"); + "ffce9d3e3ca9899d3fd6da1f6b93c07cce2c3f6b7004948b59757dae420f801b"); assert (fpv5->buildable); @@ -860,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); @@ -871,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); @@ -903,7 +921,7 @@ test_pkg_repos (const cstrings& loader_args, assert (check_location (epv)); assert (epv->sha256sum && *epv->sha256sum == - "317c8c6f45d9dfdfdef3a823411920cecd51729c7c4f58f9a0b0bbd681c07bd6"); + "d90cfe583890cd0c05cdfc204e69dd3b986c2da49851f7a87fa0ca870788ff79"); // Verify libpq package version. // diff --git a/tests/submit/data.testscript b/tests/submit/data.testscript index 875b4eb..b0fe8f0 100644 --- a/tests/submit/data.testscript +++ b/tests/submit/data.testscript @@ -3,12 +3,13 @@ # Pre-created submission data directory that will be copied by subsequent # tests and scope setup commands. The common approach will be that group -# scopes copy and modify the parent scope submission directory as required by -# the nested tests and scopes. Tests will also clone the parent scope -# submission data directory to optionally modify it, use and cleanup at the -# end. Note that configuration can not be shared between multiple submission -# handler processes. Also we need to make sure that submission data -# directories are not cloned while being used by submission handler scripts. +# scopes copy and modify the parent scope submission data directory as +# required by the nested tests and scopes. Tests will also clone the parent +# scope submission data directory to optionally modify it, use and cleanup at +# the end. Note that submission data directory can not be shared between +# multiple submission handler processes. Also we need to make sure that +# submission data directories are not cloned while being used by submission +# handler scripts. # data_dir = $regex.replace($path_search('*/request.manifest', $src_base), \ '(.*)/.*', \ @@ -25,10 +26,10 @@ root_data_dir = $~/$data_dir # The most commonly used submission data directory cloning command that copies # it from the parent scope working directory. # -clone_data = cp --no-cleanup -r ../$data_dir ./ -clone_data_clean = cp --no-cleanup -r ../$data_dir ./ &$data_dir/*** +clone_data = [cmdline] cp --no-cleanup -r ../$data_dir ./ +clone_data_clean = [cmdline] cp --no-cleanup -r ../$data_dir ./ &$data_dir/*** # Clones the original submission data directory. # -clone_root_data = cp --no-cleanup -r $root_data_dir ./ -clone_root_data_clean = cp --no-cleanup -r $root_data_dir ./ &$data_dir/*** +clone_root_data = [cmdline] cp --no-cleanup -r $root_data_dir ./ +clone_root_data_clean = [cmdline] cp --no-cleanup -r $root_data_dir ./ &$data_dir/*** diff --git a/tests/submit/submit-dir.testscript b/tests/submit/submit-dir.testscript index 81dc494..285710f 100644 --- a/tests/submit/submit-dir.testscript +++ b/tests/submit/submit-dir.testscript @@ -77,7 +77,16 @@ $* >>"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 8cdb29a..5197afc 100644 --- a/tests/submit/submit-git.testscript +++ b/tests/submit/submit-git.testscript @@ -9,19 +9,23 @@ # # test.redirects += 2>! -g = git 2>! >&2 +g = [cmdline] git 2>! >&2 # Create and clone the reference repository. # root_ref = $~/ref.git root_ref_dir = $~/ref -clone_root_ref = cp --no-cleanup -r $root_ref ./ &ref.git/*** +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 @@ -44,7 +48,7 @@ root_tgt_url = "file:///$~/tgt.git" +cp -r $root_ref $root_tgt -clone_root_tgt = cp --no-cleanup -r $root_tgt ./ &tgt.git/*** +clone_root_tgt = [cmdline] cp --no-cleanup -r $root_tgt ./ &tgt.git/*** # Extract the package repository. # @@ -466,21 +470,14 @@ pkg_ctl="$prj_ctl/hello.git" sections['*']=1/alpha EOI - # Add the libhello/0.1.0+1 package revision to the target repository. - # - tar -xf $data_dir/libhello-0.1.0.tar.gz &libhello-0.1.0/***; - sed -i -e 's/(version: 0.1.0)/\1+1/' libhello-0.1.0/manifest; - mv libhello-0.1.0 libhello-0.1.0+1; - mkdir -p tgt/1/alpha/hello/; - tar cfz tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz libhello-0.1.0+1; - $g -C tgt add 1/; - $g -C tgt config user.name 'Test Script'; $g -C tgt config user.email 'testscript@example.com'; $g -C tgt commit -am 'Add config and archive'; $g -C tgt push; - $* "file:///$~/tgt.git" $data_dir >>"EOO" &tgt/1/alpha/hello/libhello-0.1.0.tar.gz; + # Initial submission. + # + $* "file:///$~/tgt.git" $data_dir >>"EOO"; : 1 status: 200 message: package submission is queued: libhello/0.1.0 @@ -489,8 +486,46 @@ pkg_ctl="$prj_ctl/hello.git" $g -C tgt pull; - test -f tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz == 1; - test -f tgt/1/alpha/hello/libhello-0.1.0.tar.gz + test -f tgt/1/alpha/hello/libhello-0.1.0.tar.gz; + + # Revision submission. + # + # Here we test that the handler removes the previous revision. + # + $clone_root_data_clean; + + tar -xf $~/$data_dir/libhello-0.1.0.tar.gz; + sed -i -e 's/(version: 0.1.0)/\1+1/' libhello-0.1.0/manifest; + mv libhello-0.1.0 libhello-0.1.0+1; + tar cfz $~/$data_dir/libhello-0.1.0+1.tar.gz libhello-0.1.0+1; + rm -r libhello-0.1.0+1; + rm $~/$data_dir/libhello-0.1.0.tar.gz; + sed -i -e 's/(archive: libhello-0.1.0)(.tar.gz)/\1+1\2/' $data_dir/request.manifest; + + $* "file:///$~/tgt.git" $data_dir >>"EOO" &tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz; + : 1 + status: 200 + message: package submission is queued: libhello/0.1.0+1 + reference: $checksum + EOO + + $g -C tgt pull; + + test -f tgt/1/alpha/hello/libhello-0.1.0.tar.gz == 1; + test -f tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz; + + # While at it, test the older revision submission. + # + $clone_root_data_clean; + + $* "file:///$~/tgt.git" $data_dir >>"EOO"; + : 1 + status: 422 + message: newer revision libhello/0.1.0+1 is present + reference: $checksum + EOO + + test -f tgt/1/alpha/hello/libhello-0.1.0+1.tar.gz } : section-fallback diff --git a/tests/submit/submit-pub.testscript b/tests/submit/submit-pub.testscript index 07517be..8c042a7 100644 --- a/tests/submit/submit-pub.testscript +++ b/tests/submit/submit-pub.testscript @@ -17,7 +17,7 @@ root_rep=$~/pkg-1 +echo ": 1" >=$root_rep/1/repositories.manifest +bpkg rep-create $root_rep/1 2>! &$root_rep/1/packages.manifest -clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock +clone_root_rep = [cmdline] cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock : args { @@ -84,14 +84,8 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock $clone_root_rep; ln -s pkg-1 pkg; - # Add the libhello/0.1.0+1 package revision to the repository. + # Initial submission. # - mkdir --no-cleanup pkg-1/1/hello; - tar -xf $~/$data_dir/libhello-0.1.0.tar.gz &libhello-0.1.0/***; - sed -i -e 's/(version: 0.1.0)/\1+1/' libhello-0.1.0/manifest; - mv libhello-0.1.0 libhello-0.1.0+1; - tar cfz pkg-1/1/hello/libhello-0.1.0+1.tar.gz libhello-0.1.0+1; - $* $~/pkg $~/$data_dir &!pkg-1/*** &pkg-*/*** >>"EOO"; : 1 status: 200 @@ -99,7 +93,6 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock reference: $checksum EOO - test -f pkg/1/hello/libhello-0.1.0+1.tar.gz == 1; test -f pkg/1/hello/libhello-0.1.0.tar.gz; # While at it, test the duplicate submission. @@ -113,7 +106,42 @@ clone_root_rep = cp --no-cleanup -r $root_rep ./ &pkg-1/*** &?pkg.lock reference: $checksum EOO - test -f pkg/1/hello/libhello-0.1.0.tar.gz + test -f pkg/1/hello/libhello-0.1.0.tar.gz; + + # Revision submission. + # + # Here we test that the handler removes the previous revision. + # + tar -xf $~/$data_dir/libhello-0.1.0.tar.gz; + sed -i -e 's/(version: 0.1.0)/\1+1/' libhello-0.1.0/manifest; + mv libhello-0.1.0 libhello-0.1.0+1; + tar cfz $~/$data_dir/libhello-0.1.0+1.tar.gz libhello-0.1.0+1; + rm -r libhello-0.1.0+1; + rm $~/$data_dir/libhello-0.1.0.tar.gz; + sed -i -e 's/(archive: libhello-0.1.0)(.tar.gz)/\1+1\2/' $data_dir/request.manifest; + + $* $~/pkg $~/$data_dir >>"EOO"; + : 1 + status: 200 + message: package is published: libhello/0.1.0+1 + reference: $checksum + EOO + + test -f pkg/1/hello/libhello-0.1.0.tar.gz == 1; + test -f pkg/1/hello/libhello-0.1.0+1.tar.gz; + + # While at it, test the older revision submission. + # + $clone_root_data_clean; + + $* $~/pkg $~/$data_dir >>"EOO"; + : 1 + status: 422 + message: newer revision libhello/0.1.0+1 is present + reference: $checksum + EOO + + test -f pkg/1/hello/libhello-0.1.0+1.tar.gz } : result-url diff --git a/tests/upload/545f1f78-63ea-4acf-bcb8-37b2513a78c8/archive.tar b/tests/upload/545f1f78-63ea-4acf-bcb8-37b2513a78c8/archive.tar Binary files differnew file mode 100644 index 0000000..d3b5b17 --- /dev/null +++ b/tests/upload/545f1f78-63ea-4acf-bcb8-37b2513a78c8/archive.tar diff --git a/tests/upload/545f1f78-63ea-4acf-bcb8-37b2513a78c8/request.manifest b/tests/upload/545f1f78-63ea-4acf-bcb8-37b2513a78c8/request.manifest new file mode 100644 index 0000000..c59303b --- /dev/null +++ b/tests/upload/545f1f78-63ea-4acf-bcb8-37b2513a78c8/request.manifest @@ -0,0 +1,22 @@ +: 1 +id: 545f1f78-63ea-4acf-bcb8-37b2513a78c8 +session: 4d4c8b36-56c5-42e0-91d1-58bfd1228002/libhello/1.1.0+10/x86_64-linux-\ +gnu/linux_fedora_37-gcc_12.2-bindist/default/queue/0.3.0/1683122318585120886 +instance: archive +archive: archive.tar +sha256sum: 4fa79e4e11a03db321514800806a2b0a3a8eef9375dc22963f4e5a16764c0d5e +timestamp: 2023-05-08T09:18:20Z +name: libhello +version: 1.1.0+10 +project: hello +target-config: linux_fedora_37-gcc_12.2-bindist +package-config: default +target: x86_64-linux-gnu +tenant: 4d4c8b36-56c5-42e0-91d1-58bfd1228002 +toolchain-name: queue +toolchain-version: 0.3.0 +repository-name: git:build2.org/var/scm/hello/libhello#master@7f62790591b66bd\ +a248140013bdbd12bf078c2a2 +machine-name: linux_fedora_37-bindist-gcc_12.2 +machine-summary: Fedora Linux 37 with system-default GCC 12.2.1 and bpkg-pkg-\ +bindist prerequisites diff --git a/tests/upload/buildfile b/tests/upload/buildfile new file mode 100644 index 0000000..32d7720 --- /dev/null +++ b/tests/upload/buildfile @@ -0,0 +1,13 @@ +# file : tests/upload/buildfile +# license : MIT; see accompanying LICENSE file + +dir = ../../brep/handler/upload/ + +include $dir + +commons = data + +./: testscript{* -{$commons}} common_testscript{$commons} {*/ -test/}{**} \ + $dir/exe{brep-upload-bindist} + +testscript{upload-bindist}@./: test = $out_base/$dir/brep-upload-bindist diff --git a/tests/upload/data.testscript b/tests/upload/data.testscript new file mode 100644 index 0000000..3d3eede --- /dev/null +++ b/tests/upload/data.testscript @@ -0,0 +1,34 @@ +# file : tests/upload/data.testscript +# license : MIT; see accompanying LICENSE file + +# Pre-created upload data directory that will be copied by subsequent tests +# and scope setup commands. The common approach will be that group scopes copy +# and modify the parent scope upload data directory as required by the nested +# tests and scopes. Tests will also clone the parent scope upload data +# directory to optionally modify it, use and cleanup at the end. Note that +# upload data directory can not be shared between multiple upload handler +# processes. Also we need to make sure that upload data directories are not +# cloned while being used by upload handler scripts. +# +data_dir = $regex.replace($path_search('*/request.manifest', $src_base), \ + '(.*)/.*', \ + '\1') + +request_id = "$data_dir" + +# Copy the original upload data directory to the root scope. +# ++cp -r $src_base/$data_dir ./ + +root_data_dir = $~/$data_dir + +# The most commonly used upload data directory cloning command that copies it +# from the parent scope working directory. +# +clone_data = [cmdline] cp --no-cleanup -r ../$data_dir ./ +clone_data_clean = [cmdline] cp --no-cleanup -r ../$data_dir ./ &$data_dir/*** + +# Clones the original upload data directory. +# +clone_root_data = [cmdline] cp --no-cleanup -r $root_data_dir ./ +clone_root_data_clean = [cmdline] cp --no-cleanup -r $root_data_dir ./ &$data_dir/*** diff --git a/tests/upload/upload-bindist.testscript b/tests/upload/upload-bindist.testscript new file mode 100644 index 0000000..d43c567 --- /dev/null +++ b/tests/upload/upload-bindist.testscript @@ -0,0 +1,126 @@ +# file : tests/upload/upload-bindist.testscript +# license : MIT; see accompanying LICENSE file + +.include data.testscript + +: args +{ + : no-dir + : + $* 2>>~%EOE% != 0 + %\[.+\] \[brep:error\] \[ref \] \[brep-upload-bindist\]: usage: .+brep-upload-bindist \[<options>\] <root> <dir>% + EOE + + : no-root + : + $* $~/dir 2>>~%EOE% != 0 + %\[.+\] \[brep:error\] \[ref dir\] \[brep-upload-bindist\]: usage: .+brep-upload-bindist \[<options>\] <root> <dir>% + EOE + + : root-not-exist + : + : While at it, also test that the trailing slash is stripped from the + : directory paths. + : + $* $~/root/ $~/dir/ 2>>~%EOE% != 0 + %\[.+\] \[brep:error\] \[ref dir\] \[brep-upload-bindist\]: '.+root' does not exist or is not a directory% + EOE + + : data-not-exist + : + mkdir root; + $* $~/root $~/dir 2>>~%EOE% != 0 + %\[.+\] \[brep:error\] \[ref dir\] \[brep-upload-bindist\]: '.+dir' does not exist or is not a directory% + EOE +} + +: success +: +{ + mkdir --no-cleanup bindist-root/ &bindist-root/***; + + # Test the first upload. + # + $clone_data; + + $* $~/bindist-root/ $~/$data_dir >>"EOO"; + : 1 + status: 200 + message: binary distribution packages are published + reference: $request_id + EOO + + timestamp = '2023-05-08T09:18:20Z'; + tenant = '4d4c8b36-56c5-42e0-91d1-58bfd1228002'; + dir = [dir_path] bindist-root/$tenant/archive/fedora35/hello/libhello/1.1.0+10/; + + test -f $dir/default/libhello-1.0.0+10.tar.xz; + test -f $dir/default-$timestamp/libhello-1.0.0+10.tar.xz; + + # Repeat the upload using the same timestamp to make sure that we properly + # handle this situation (by adding the retry number as a suffix to the + # package configuration directory name). + # + $clone_data; + + $* $~/bindist-root/ $~/$data_dir >>"EOO" &bindist-root/***; + : 1 + status: 200 + message: binary distribution packages are published + reference: $request_id + EOO + + test -f $dir/default/libhello-1.0.0+10.tar.xz; + test -f $dir/default-$timestamp-0/libhello-1.0.0+10.tar.xz; + test -d $dir/default-$timestamp/ != 0; + + # Test the second upload without --keep-previous option. + # + data_dir2 = 22222222-2222-2222-2222-222222222222; + request_id2 = $data_dir2; + timestamp2 = '2023-05-09T09:18:20Z'; + + cp --no-cleanup -r ../$data_dir ./$data_dir2; + + sed -i -e "s%^\(id:\) .+\$%\\1 $request_id2%" \ + $data_dir2/request.manifest; + + sed -i -e "s%^\(timestamp:\) .+\$%\\1 $timestamp2%" \ + $data_dir2/request.manifest; + + $* $~/bindist-root/ $~/$data_dir2 >>"EOO"; + : 1 + status: 200 + message: binary distribution packages are published + reference: $request_id2 + EOO + + test -f $dir/default/libhello-1.0.0+10.tar.xz; + test -f $dir/default-$timestamp2/libhello-1.0.0+10.tar.xz; + test -d $dir/default-$timestamp.0/ != 0; + + # Test the third upload with --keep-previous option. + # + data_dir3 = 33333333-3333-3333-3333-333333333333; + request_id3 = $data_dir3; + timestamp3 = '2023-05-10T09:18:20Z'; + + cp --no-cleanup -r ../$data_dir ./$data_dir3; + + sed -i -e "s%^\(id:\) .+\$%\\1 $request_id3%" \ + $data_dir3/request.manifest; + + sed -i -e "s%^\(timestamp:\) .+\$%\\1 $timestamp3%" \ + $data_dir3/request.manifest; + + $* --keep-previous $~/bindist-root/ $~/$data_dir3 >>"EOO"; + : 1 + status: 200 + message: binary distribution packages are published + reference: $request_id3 + EOO + + test -f $dir/default/libhello-1.0.0+10.tar.xz; + test -f $dir/default-$timestamp3/libhello-1.0.0+10.tar.xz; + test -f $dir/default-$timestamp2/libhello-1.0.0+10.tar.xz +} |