diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-03-04 17:19:18 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-03-04 17:20:36 +0300 |
commit | 8ff6314283396a60ae9806a03f1c017bdc3ec4cc (patch) | |
tree | ddc3aea79452773b8134fab1266a9ce899c32d96 /tests | |
parent | 8dcd798f784ee4eecbca7e13370149440b206a3e (diff) |
Add support for --stdout-format to pkg-status command
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pkg-status.testscript | 337 | ||||
-rw-r--r-- | tests/pkg-status/testing/libbar-1.0.0+1.tar.gz | bin | 325 -> 363 bytes | |||
-rw-r--r-- | tests/pkg-status/testing/libbar-1.1.0.tar.gz | bin | 322 -> 373 bytes | |||
-rw-r--r-- | tests/pkg-status/testing/libbaz-1.0.0.tar.gz | bin | 0 -> 360 bytes |
4 files changed, 221 insertions, 116 deletions
diff --git a/tests/pkg-status.testscript b/tests/pkg-status.testscript index 86a85d4..e90e3bf 100644 --- a/tests/pkg-status.testscript +++ b/tests/pkg-status.testscript @@ -54,183 +54,288 @@ $git_extract $src/git/style-basic.tar &$out_git/state0/*** end -pkg_fetch += 2>! -pkg_purge += -d cfg 2>! rep_add += -d cfg 2>! rep_fetch += -d cfg --auth all --trust-yes 2>! +pkg_fetch += 2>! +pkg_build += -d cfg --yes 2>! +pkg_purge += -d cfg 2>! +pkg_drop += -d cfg --yes 2>! -: basics +: lines : { +$clone_cfg - : not-fetched + : basics : { +$clone_cfg - : libfoo-1.0.0 - : - $clone_cfg; - $* libfoo/1.0.0 >'libfoo unknown 1.0.0' - - : libfoo - : - $clone_cfg; - $* libfoo >'libfoo unknown' - } - - : rep-fetched - : - { - +$clone_cfg && $rep_add $rep/stable && $rep_fetch - - +cp -r cfg ./fetched - +$pkg_fetch libfoo/1.0.0 -d fetched &fetched/libfoo-1.0.0.tar.gz - - : libfoo-1.0.0 + : not-fetched : - $clone_cfg; - $* libfoo/1.0.0 >'libfoo available 1.0.0' + { + +$clone_cfg - : libfoo-1.0.0+0 - : - $clone_cfg; - $* libfoo/1.0.0+0 >'libfoo available 1.0.0' + : libfoo-1.0.0 + : + $clone_cfg; + $* libfoo/1.0.0 >'libfoo unknown 1.0.0' - : libfoo - : - $clone_cfg; - $* libfoo >'libfoo available 1.0.0' + : libfoo + : + $clone_cfg; + $* libfoo >'libfoo unknown' + } - : pkg-fetched + : rep-fetched : { - clone_cfg = cp -r ../../fetched cfg + +$clone_cfg && $rep_add $rep/stable && $rep_fetch + + +cp -r cfg ./fetched + +$pkg_fetch libfoo/1.0.0 -d fetched &fetched/libfoo-1.0.0.tar.gz : libfoo-1.0.0 : $clone_cfg; - $* libfoo/1.0.0 >'libfoo fetched 1.0.0' + $* libfoo/1.0.0 >'libfoo available 1.0.0' + + : libfoo-1.0.0+0 + : + $clone_cfg; + $* libfoo/1.0.0+0 >'libfoo available 1.0.0' : libfoo : $clone_cfg; - $* libfoo >'libfoo fetched 1.0.0' + $* libfoo >'libfoo available 1.0.0' + + : pkg-fetched + : + { + clone_cfg = cp -r ../../fetched cfg + + : libfoo-1.0.0 + : + $clone_cfg; + $* libfoo/1.0.0 >'libfoo fetched 1.0.0' + + : libfoo + : + $clone_cfg; + $* libfoo >'libfoo fetched 1.0.0' + } } } -} - -: multiple-versions -{ - # Prepare the nested tests to copy the root configuration. Note that they - # must provide the destination directory name as an argument. - # - clone_cfg = cp -r $~/../cfg - : extra - : + : multiple-versions { - # Here we, first, prepare 2 configurations that derive from each other, and - # then spawn 2 tests on them. + # Prepare the nested tests to copy the root configuration. Note that they + # must provide the destination directory name as an argument. # - +$clone_cfg extra && $rep_add -d extra $rep/extra && $rep_fetch -d extra + clone_cfg = cp -r $~/../cfg - +cp -r extra extra-stable - +$rep_add -d extra-stable $rep/stable && $rep_fetch -d extra-stable - - : libbar + : extra : - $* -d ../extra libbar >'libbar available 1.1.0+1 [1.0.0]' - - : libbar-stable - : - $* -d ../extra-stable libbar >'libbar available 1.1.0+1 1.0.0' - } + { + # Here we, first, prepare 2 configurations that derive from each other, + # and then spawn 2 tests on them. + # + +$clone_cfg extra && $rep_add -d extra $rep/extra && $rep_fetch -d extra - : testing - : - { - +$clone_cfg ./ && $rep_add $rep/testing && $rep_fetch + +cp -r extra extra-stable + +$rep_add -d extra-stable $rep/stable && $rep_fetch -d extra-stable - clone_cfg = cp -r ../cfg ./ + : libbar + : + $* -d ../extra libbar >'libbar available 1.1.0+1 [1.0.0]' - : no-version - : - { - $clone_cfg; - $* libbar >'libbar available [1.1.0+1] 1.1.0 1.0.0+1 1.0.0' + : libbar-stable + : + $* -d ../extra-stable libbar >'libbar available 1.1.0+1 1.0.0' } - : no-revision + : testing : { - $clone_cfg; - $* libbar/1.0.0 >'libbar available 1.0.0+1 1.0.0' + +$clone_cfg ./ && $rep_add $rep/testing && $rep_fetch + + clone_cfg = cp -r ../cfg ./ + + : no-version + : + { + $clone_cfg; + $* libbar >'libbar available [1.1.0+1] 1.1.0 1.0.0+1 1.0.0' + } + + : no-revision + : + { + $clone_cfg; + $* libbar/1.0.0 >'libbar available 1.0.0+1 1.0.0' + } + + : zero-revision + : + { + $clone_cfg; + $* libbar/1.0.0+0 >'libbar available 1.0.0' + } + + : recursive + : + { + $clone_cfg; + + $pkg_build libbar; + + $* libbar --recursive >>EOO; + !libbar configured 1.1.0 available [1.1.0+1] + libbaz configured 1.0.0 + EOO + + $pkg_drop libbar + } } - : zero-revision + : unstable : { - $clone_cfg; - $* libbar/1.0.0+0 >'libbar available 1.0.0' + # Here we, first, prepare 3 configurations that derive from each other, + # and then spawn 3 tests on them. + # + +$clone_cfg ./ && $rep_add $rep/unstable && $rep_fetch + + +cp -r cfg fetched1 + +$pkg_fetch libbar/1.0.0+1 -d fetched1 &fetched1/libbar-1.0.0+1.tar.gz + + +cp -r fetched1 fetched2 + +$pkg_purge -d fetched2 libbar &!fetched2/libbar-1.0.0+1.tar.gz + +$pkg_fetch libbar/2.0.0 -d fetched2 &fetched2/libbar-2.0.0.tar.gz + + : not-fetched + : + $* -d ../cfg libbar >'libbar available 2.0.0 [1.1.0+1] 1.1.0 1.0.0+1 1.0.0' + + : fetched-1 + : + $* -d ../fetched1 libbar >'libbar fetched 1.0.0+1 available 2.0.0 [1.1.0+1] 1.1.0' + + : fetched-2 + : + $* -d ../fetched2 libbar >'libbar fetched 2.0.0' } } - : unstable + : git-rep : + if! $git_supported { - # Here we, first, prepare 3 configurations that derive from each other, and - # then spawn 3 tests on them. + # Skip git repository tests. # - +$clone_cfg ./ && $rep_add $rep/unstable && $rep_fetch - - +cp -r cfg fetched1 - +$pkg_fetch libbar/1.0.0+1 -d fetched1 &fetched1/libbar-1.0.0+1.tar.gz - - +cp -r fetched1 fetched2 - +$pkg_purge -d fetched2 libbar &!fetched2/libbar-1.0.0+1.tar.gz - +$pkg_fetch libbar/2.0.0 -d fetched2 &fetched2/libbar-2.0.0.tar.gz + } + else + { + rep = "$rep_git/state0" + test.cleanups += &cfg/.bpkg/repos/*/*** - : not-fetched + : complement-cycle : - $* -d ../cfg libbar >'libbar available 2.0.0 [1.1.0+1] 1.1.0 1.0.0+1 1.0.0' - - : fetched-1 + : Make sure that we properly handle the root<->style repository dependency + : cycle while searching for the style-basic package, that is an available + : package but not from the user-added repository (or its complement), and + : so is not detected as buildable by the status command. Note that the root + : repository is the default complement for git repositories (see + : rep_fetch() implementation for the reasoning). : - $* -d ../fetched1 libbar >'libbar fetched 1.0.0+1 available 2.0.0 [1.1.0+1] 1.1.0' + $clone_root_cfg; + $rep_add "$rep/libbar.git#master" && $rep_add "$rep/style.git#master"; - : fetched-2 - : - $* -d ../fetched2 libbar >'libbar fetched 2.0.0' + $rep_fetch 2>!; + + $* style-basic >~'%style-basic available \[1\.1\.0-a\.0\..+\]%' } } -: git-rep +: json : -if! $git_supported { - # Skip git repository tests. - # -} -else -{ - rep = "$rep_git/state0" - test.cleanups += &cfg/.bpkg/repos/*/*** + test.arguments += --stdout-format json + + +$clone_cfg - : complement-cycle + : not-fetched : - : Make sure that we properly handle the root<->style repository dependency - : cycle while searching for the style-basic package, that is an available - : package but not from the user-added repository (or its complement), and so - : is not detected as buildable by the status command. Note that the root - : repository is the default complement for git repositories (see rep_fetch() - : implementation for the reasoning). + { + +$clone_cfg + + : libfoo-1.0.0 + : + $clone_cfg; + $* libfoo/1.0.0 >>EOO + [ + { + "name": "libfoo", + "status": "unknown", + "version": "1.0.0" + } + ] + EOO + + : libfoo + : + $clone_cfg; + $* libfoo >>EOO + [ + { + "name": "libfoo", + "status": "unknown" + } + ] + EOO + } + + : fetched : - $clone_root_cfg; - $rep_add "$rep/libbar.git#master" && $rep_add "$rep/style.git#master"; + { + +$clone_cfg - $rep_fetch 2>!; + +$rep_add $rep/testing && $rep_fetch - $* style-basic >~'%style-basic available \[1\.1\.0-a\.0\..+\]%' + : recursive + : + { + $clone_cfg; + + $pkg_build libbar; + + $* libbar --recursive --constraint >>EOO; + [ + { + "name": "libbar", + "status": "configured", + "version": "1.1.0", + "hold_package": true, + "available_versions": [ + { + "version": "1.1.0+1", + "dependency": true + } + ], + "dependencies": [ + { + "name": "libbaz", + "constraint": "^1.0.0", + "status": "configured", + "version": "1.0.0" + } + ] + } + ] + EOO + + $pkg_drop libbar + } + } } diff --git a/tests/pkg-status/testing/libbar-1.0.0+1.tar.gz b/tests/pkg-status/testing/libbar-1.0.0+1.tar.gz Binary files differindex 9c2d0ed..d38cbbd 100644 --- a/tests/pkg-status/testing/libbar-1.0.0+1.tar.gz +++ b/tests/pkg-status/testing/libbar-1.0.0+1.tar.gz diff --git a/tests/pkg-status/testing/libbar-1.1.0.tar.gz b/tests/pkg-status/testing/libbar-1.1.0.tar.gz Binary files differindex 6ca773a..a5e060d 100644 --- a/tests/pkg-status/testing/libbar-1.1.0.tar.gz +++ b/tests/pkg-status/testing/libbar-1.1.0.tar.gz diff --git a/tests/pkg-status/testing/libbaz-1.0.0.tar.gz b/tests/pkg-status/testing/libbaz-1.0.0.tar.gz Binary files differnew file mode 100644 index 0000000..8d4c2f3 --- /dev/null +++ b/tests/pkg-status/testing/libbaz-1.0.0.tar.gz |