From bc24eec7208187e171fd61ced7130fd8e2828257 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 14 Mar 2018 00:54:05 +0300 Subject: Add support for version iteration --- tests/common/git/state0/libbar.tar | Bin 71680 -> 71680 bytes tests/common/git/state0/libfoo.tar | Bin 296960 -> 296960 bytes tests/common/git/state0/style-basic.tar | Bin 71680 -> 71680 bytes tests/common/git/state0/style.tar | Bin 133120 -> 133120 bytes tests/common/git/state1/libbaz.tar | Bin 61440 -> 61440 bytes tests/common/git/state1/libfoo.tar | Bin 378880 -> 378880 bytes tests/common/git/state1/style-basic.tar | Bin 71680 -> 71680 bytes tests/common/git/state1/style.tar | Bin 133120 -> 133120 bytes tests/pkg-build.test | 101 ++++++++++++++++------ tests/rep-fetch.test | 147 +++++++++++++++++++++++++++++++- tests/rep-fetch/libhello-1.0.0 | 1 + 11 files changed, 218 insertions(+), 31 deletions(-) create mode 120000 tests/rep-fetch/libhello-1.0.0 (limited to 'tests') diff --git a/tests/common/git/state0/libbar.tar b/tests/common/git/state0/libbar.tar index 4861d35..bbb6f81 100644 Binary files a/tests/common/git/state0/libbar.tar and b/tests/common/git/state0/libbar.tar differ diff --git a/tests/common/git/state0/libfoo.tar b/tests/common/git/state0/libfoo.tar index 2707476..6f9af32 100644 Binary files a/tests/common/git/state0/libfoo.tar and b/tests/common/git/state0/libfoo.tar differ diff --git a/tests/common/git/state0/style-basic.tar b/tests/common/git/state0/style-basic.tar index 9444ab8..6a7a1f2 100644 Binary files a/tests/common/git/state0/style-basic.tar and b/tests/common/git/state0/style-basic.tar differ diff --git a/tests/common/git/state0/style.tar b/tests/common/git/state0/style.tar index 7989e77..6295f34 100644 Binary files a/tests/common/git/state0/style.tar and b/tests/common/git/state0/style.tar differ diff --git a/tests/common/git/state1/libbaz.tar b/tests/common/git/state1/libbaz.tar index b2bf286..ee8ad3e 100644 Binary files a/tests/common/git/state1/libbaz.tar and b/tests/common/git/state1/libbaz.tar differ diff --git a/tests/common/git/state1/libfoo.tar b/tests/common/git/state1/libfoo.tar index 859637a..4221cdd 100644 Binary files a/tests/common/git/state1/libfoo.tar and b/tests/common/git/state1/libfoo.tar differ diff --git a/tests/common/git/state1/style-basic.tar b/tests/common/git/state1/style-basic.tar index a8a3a88..8bc8b85 100644 Binary files a/tests/common/git/state1/style-basic.tar and b/tests/common/git/state1/style-basic.tar differ diff --git a/tests/common/git/state1/style.tar b/tests/common/git/state1/style.tar index 8ef9104..feedcaa 100644 Binary files a/tests/common/git/state1/style.tar and b/tests/common/git/state1/style.tar differ diff --git a/tests/pkg-build.test b/tests/pkg-build.test index fefaf00..e70bb1a 100644 --- a/tests/pkg-build.test +++ b/tests/pkg-build.test @@ -57,34 +57,17 @@ # | |-- libbar-1.2.0.tar.gz # | `-- repositories.manifest # | -# `-- git -# | |-- libbar.git -> style-basic.git (prerequisite) -# | |-- libbaz.git -# | `-- style-basic.git +# |-- libhello-1.0.0 +# | |-- build +# | | |-- bootstrap.build +# | | |-- export.build +# | | `-- root.build +# | `-- * # | -# `-- libhello-1.0.0 -# |-- build -# | |-- bootstrap.build -# | |-- export.build -# | `-- root.build -# |-- buildfile -# |-- hello -# | |-- buildfile -# | |-- export -# | |-- hello -# | `-- hello.cxx -# |-- INSTALL -# |-- manifest -# |-- tests -# | |-- build -# | | |-- bootstrap.build -# | | `-- root.build -# | |-- buildfile -# | `-- test -# | |-- buildfile -# | |-- driver.cxx -# | `-- test.out -# `-- version +# `-- git +# |-- libbar.git -> style-basic.git (prerequisite) +# |-- libbaz.git +# `-- style-basic.git # Prepare repositories used by tests if running in the local mode. # @@ -114,6 +97,7 @@ pkg_purge += -d cfg pkg_status += -d cfg pkg_unpack += -d cfg 2>! rep_add += -d cfg 2>! +rep_remove += -d cfg 2>! rep_fetch += -d cfg --auth all --trust-yes 2>! : libfoo @@ -805,7 +789,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! disfigured libfoo/1.0.0 using libfoo/1.1.0 (external) configured libfoo/1.1.0 - %info: .+dir\{libfoo-1.1.0.\} is up to date% + %info: .+dir\{libfoo.\} is up to date% updated libfoo/1.1.0 EOE @@ -1565,6 +1549,9 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! +$clone_cfg + # @@ Uncomment the following tests when -p option is supported for the cp + # builtin. + #\ : dir-repo : : Test that libhello is built incrementally. May re-link due to the @@ -1593,6 +1580,11 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! { +$clone_cfg + # To avoid 'external package is already available' failure for the + # nested tests. + # + +$rep_remove --all + : arg : { @@ -1627,6 +1619,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! test -d cfg/libhello-1.0.1/ == 1 } } + #\ : archive : @@ -1700,6 +1693,58 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! -$pkg_purge libhello 2>'purged libhello/1.0.0' } +: iter +: +{ + test.arguments += --yes # Is a command-specific option. + + : already-available + : + { + $clone_root_cfg; + $rep_add $src/libfoo-1.1.0 --type dir && $rep_fetch; + + $* $src/libfoo-1.1.0/ 2>>~%EOE% != 0 + %error: external package libfoo/1.1.0 is already available from dir:.+libfoo-1.1.0% + EOE + } + + : upgrade + : + { + $clone_root_cfg; + + $* $src/libfoo-1.1.0/ 2>>~%EOE%; + using libfoo/1.1.0 (external) + configured libfoo/1.1.0 + %info: .+dir\{libfoo.\} is up to date% + updated libfoo/1.1.0 + EOE + + cp -r $src/libfoo-1.1.0 libfoo; + + $* libfoo/ 2>>~%EOE%; + disfigured libfoo/1.1.0 + using libfoo/1.1.0#1 (external) + configured libfoo/1.1.0#1 + %info: .+dir\{libfoo.\} is up to date% + updated libfoo/1.1.0#1 + EOE + + $rep_add $src/libfoo-1.1.0 --type dir && $rep_fetch; + + $* libfoo 2>>~%EOE%; + disfigured libfoo/1.1.0#1 + using libfoo/1.1.0#2 (external) + configured libfoo/1.1.0#2 + %info: .+dir\{libfoo.\} is up to date% + updated libfoo/1.1.0#2 + EOE + + $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0#2' + } +} + : git-rep : if ($git_supported != true) diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test index 1ee0d4b..535627d 100644 --- a/tests/rep-fetch.test +++ b/tests/rep-fetch.test @@ -32,6 +32,13 @@ # | |-- libhello-1.0.0.tar.gz # | `-- repositories.manifest # | +# |-- libhello-1.0.0 +# | |-- build +# | | |-- bootstrap.build +# | | |-- export.build +# | | `-- root.build +# | `-- * +# | # |-- circle # | |-- extra -> stable (prerequisite) # | | |-- libbar-1.1.0+1.tar.gz @@ -102,9 +109,14 @@ $git_extract $src/git/state1/style-basic.tar &$out_git/state1/*** end -rep_add += -d cfg 2>! -rep_list += -d cfg --prerequisites --complements -pkg_status += -d cfg +rep_add += -d cfg 2>! +rep_list += -d cfg --prerequisites --complements +rep_remove += -d cfg 2>! +pkg_status += -d cfg +pkg_fetch += -d cfg 2>! +pkg_unpack += -d cfg 2>! +pkg_checkout += -d cfg 2>! +pkg_purge += -d cfg : no-repos : @@ -403,6 +415,135 @@ if ($remote != true) } } +: iter +: +{ + rep_add += --type dir + + : multiple-repos + : + { + cp -r $src/libhello-1.0.0 libhello1; + cp -r $src/libhello-1.0.0 libhello2; + + $clone_root_cfg && $rep_add libhello1 libhello2; + + $* 2>>~%EOE% != 0 + %fetching dir:.+libhello1% + %fetching dir:.+libhello2% + error: external package libhello/1.0.0 is available from two repositories + % info: repository .+libhello1% + % info: repository .+libhello2% + EOE + } + + : inc + : + { + : path-changed + : + { + $clone_root_cfg && $rep_add $src/libhello-1.0.0; + + $* 2>!; + $pkg_unpack libhello/1.0.0; + + $rep_remove --all; + + cp -r $src/libhello-1.0.0 libhello; + $rep_add libhello; + + $* 2>!; + + $pkg_status libhello >'unpacked 1.0.0; available 1.0.0#1 sys:?' + } + + : manifest-changed + : + { + cp -r $src/libhello-1.0.0 libhello; + + $clone_root_cfg && $rep_add libhello; + + $* 2>!; + $pkg_unpack libhello/1.0.0; + + echo "" >+ libhello/manifest; + $* 2>!; + + $pkg_status libhello >'unpacked 1.0.0; available 1.0.0#1 sys:?' + } + + : pkg-rep + { + +$clone_root_cfg + + +$* --auth all --trust-yes $rep/hello &cfg/.bpkg/certs/** 2>! + +$pkg_fetch libhello/1.0.0 + +$pkg_unpack libhello + + : unchanged-external + : + { + $clone_cfg && $rep_add $src/libhello-1.0.0; + $* 2>!; + + $pkg_status libhello >'unpacked 1.0.0; available sys:?' + } + + : changed-external + : + { + cp -r $src/libhello-1.0.0 libhello; + echo "" >+ libhello/manifest; + + $clone_cfg && $rep_add libhello; + $* 2>!; + + $pkg_status libhello >'unpacked 1.0.0; available 1.0.0#1 sys:?' + } + + -$pkg_purge libhello 2>'purged libhello/1.0.0' + } + + : git-rep + : + if ($remote != true) + { + rep = $canonicalize([dir_path] $out_git/state0); + + $clone_root_cfg; + + $* "$rep/style.git#master" 2>! &cfg/.bpkg/repos/*/***; + $pkg_checkout "style/1.0.0" 2>!; + + $rep_add $rep/style.git; + $* 2>!; + + $pkg_status style >"unpacked 1.0.0; available sys:?"; + + $pkg_purge style 2>"purged style/1.0.0" + } + } + + : no-inc + : + { + $clone_root_cfg; + + $pkg_unpack -e $src/libhello-1.0.0; + + $rep_add $src/libhello-1.0.0; + + $* 2>>~%EOE%; + %fetching dir:.+libhello-1.0.0% + 1 package(s) in 1 repository(s) + EOE + + $pkg_status libhello >'unpacked 1.0.0; available sys:?' + } +} + : git-rep : if ($git_supported != true) diff --git a/tests/rep-fetch/libhello-1.0.0 b/tests/rep-fetch/libhello-1.0.0 new file mode 120000 index 0000000..614ff24 --- /dev/null +++ b/tests/rep-fetch/libhello-1.0.0 @@ -0,0 +1 @@ +../common/libhello-1.0.0/ \ No newline at end of file -- cgit v1.1