diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-02-22 00:58:53 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-03-15 19:15:55 +0300 |
commit | a791b1ce0fa2bc9859474fb6f7a9c0ff8cbd1d4a (patch) | |
tree | 3c9823a54e6e28a8c8f9fb281d82ad2a67c117ba /tests/pkg-status.test | |
parent | 755a99a7ebf24e00675e2f2e0f5184825ad74c4a (diff) |
Port test.sh to testscript
Diffstat (limited to 'tests/pkg-status.test')
-rw-r--r-- | tests/pkg-status.test | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/tests/pkg-status.test b/tests/pkg-status.test new file mode 100644 index 0000000..ff7cab7 --- /dev/null +++ b/tests/pkg-status.test @@ -0,0 +1,160 @@ +# file : tests/pkg-status.test +# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +.include common.test config.test remote.test + +# Source repository: +# +# pkg-status +# |-- extra -> stable (prerequisite) +# | |-- libbar-1.1.0+1.tar.gz +# | `-- repositories +# |-- stable +# | |-- libbar-1.0.0.tar.gz +# | |-- libfoo-1.0.0.tar.gz +# | `-- repositories +# |-- testing -> stable (complement), extra (prerequisite) +# | |-- libbar-1.0.0+1.tar.gz +# | |-- libbar-1.1.0.tar.gz +# | `-- repositories +# `-- unstable -> testing (complement) +# |-- libbar-2.0.0.tar.gz +# `-- repositories + +# Prepare repositories used by tests if running in the local mode. +# ++if ($remote != true) + c = $rep_create 2>- + + cp -r $src/extra $out/extra && $c $out/extra &$out/extra/packages + cp -r $src/stable $out/stable && $c $out/stable &$out/stable/packages + cp -r $src/testing $out/testing && $c $out/testing &$out/testing/packages + cp -r $src/unstable $out/unstable && $c $out/unstable &$out/unstable/packages +end + +pkg_fetch += 2>- +pkg_purge += -d cfg 2>- +rep_add += -d cfg 2>- +rep_fetch += -d cfg --auth all --trust-yes 2>- + +: basics +: +{ + +$clone_cfg + + : not-fetched + : + { + +$clone_cfg + + : libfoo-1.0.0 + : + $clone_cfg; + $* libfoo/1.0.0 >'unknown' + + : libfoo + : + $clone_cfg; + $* 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 + : + $clone_cfg; + $* libfoo/1.0.0 >'available' + + : libfoo + : + $clone_cfg; + $* libfoo >'available 1.0.0 sys:?' + + : pkg-fetched + : + { + clone_cfg = cp -r ../../fetched cfg + + : libfoo-1.0.0 + : + $clone_cfg; + $* libfoo/1.0.0 >'fetched; available' + + : libfoo + : + $clone_cfg; + $* libfoo >'fetched 1.0.0; available sys:?' + } + } +} + +: 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 + : + { + # 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 + + +cp -r extra extra-stable + +$rep_add -d extra-stable $rep/stable && $rep_fetch -d extra-stable + + : libbar + : + $* -d ../extra libbar >'available 1.1.0+1 sys:?' + + : libbar-stable + : + $* -d ../extra-stable libbar >'available 1.1.0+1 1.0.0 sys:?' + } + + : testing + : + { + $clone_cfg ./ && $rep_add $rep/testing && $rep_fetch; + + $* libbar >'available 1.1.0 1.0.0+1 1.0.0 sys:?' + } + + : unstable + : + { + # 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 >'available 2.0.0 1.1.0 1.0.0+1 1.0.0 sys:?' + + : fetched-1 + : + $* -d ../fetched1 libbar >'fetched 1.0.0+1; available 2.0.0 1.1.0 sys:?' + + : fetched-2 + : + $* -d ../fetched2 libbar >'fetched 2.0.0; available sys:?' + } +} |