From c6196464780fbdb1a2dbdda92061189395e5072e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 12 Mar 2018 19:22:42 +0300 Subject: Add support for --keep-out option --- tests/common.test | 3 +- tests/pkg-build.test | 348 ++++++++++++++++++++++++++++++++++------- tests/pkg-build/libhello-1.0.0 | 1 + tests/pkg-configure.test | 11 +- 4 files changed, 297 insertions(+), 66 deletions(-) create mode 120000 tests/pkg-build/libhello-1.0.0 (limited to 'tests') diff --git a/tests/common.test b/tests/common.test index 4002df3..21c7801 100644 --- a/tests/common.test +++ b/tests/common.test @@ -8,7 +8,8 @@ # Use the same build system driver as the one running the tests (as opposed # to one that may or may not be found via PATH). # -test.options += --build $recall($build.path) +build = $recall($build.path) +test.options += --build $build # Helper commands that can be used by tests to prepare the testing environment # or validate an outcome of the command being tested. They are likely to get diff --git a/tests/pkg-build.test b/tests/pkg-build.test index f4e77cd..fefaf00 100644 --- a/tests/pkg-build.test +++ b/tests/pkg-build.test @@ -26,12 +26,12 @@ # | `-- repositories.manifest # | # |-- t2 -# | |-- libbar-1.0.0.tar.gz -> libfoo +# | |-- libbar-1.0.0.tar.gz -> libfoo # | |-- libfoo-1.0.0.tar.gz # | `-- repositories.manifest # | -# |-- t3 -> t2 (prerequisite) -# | |-- libbaz-1.0.0.tar.gz -> libbar +# |-- t3 -> t2 (prerequisite) +# | |-- libbaz-1.0.0.tar.gz -> libbar # | |-- libfox-1.0.0.tar.gz # | `-- repositories.manifest # | @@ -39,17 +39,17 @@ # | |-- libfoo-1.1.0.tar.gz # | `-- repositories.manifest # | -# |-- t4b -> t4a (prerequisite) -# | |-- libbar-1.1.0.tar.gz -> libfoo == 1.1.0 +# |-- t4b -> t4a (prerequisite) +# | |-- libbar-1.1.0.tar.gz -> libfoo == 1.1.0 # | `-- repositories.manifest # | -# |-- t4c -> t4b (prerequisite) -# | |-- libbaz-1.1.0.tar.gz -> libfoo, libbar +# |-- t4c -> t4b (prerequisite) +# | |-- libbaz-1.1.0.tar.gz -> libfoo, libbar # | |-- libfoo-1.0.0.tar.gz # | `-- repositories.manifest # | -# |-- t4d -> t4c (complement) -# | |-- libbiz-1.0.0.tar.gz -> libfox, libfoo, libbaz +# |-- t4d -> t4c (complement) +# | |-- libbiz-1.0.0.tar.gz -> libfox, libfoo, libbaz # | |-- libfox-1.0.0.tar.gz # | `-- repositories.manifest # | @@ -58,9 +58,33 @@ # | `-- repositories.manifest # | # `-- git -# |-- libbar.git -> style-basic.git (prerequisite) -# |-- libbaz.git -# `-- style-basic.git +# | |-- libbar.git -> style-basic.git (prerequisite) +# | |-- libbaz.git +# | `-- style-basic.git +# | +# `-- 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 # Prepare repositories used by tests if running in the local mode. # @@ -779,7 +803,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! $* $src/libfoo-1.1.0/ 2>>~%EOE%; disfigured libfoo/1.0.0 - unpacked libfoo/1.1.0 + using libfoo/1.1.0 (external) configured libfoo/1.1.0 %info: .+dir\{libfoo-1.1.0.\} is up to date% updated libfoo/1.1.0 @@ -1074,14 +1098,14 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! %.*fetched libfoo/1.1.0% unpacked libfoo/1.1.0 configured libfoo/1.1.0 - unpacked libbar/1.1.0 + using libbar/1.1.0 (external) configured libbar/1.1.0 %info: .+dir\{libbar.\} is up to date% updated libbar/1.1.0 EOE $* ./libbaz/ 2>>~%EOE%; - unpacked libbaz/1.1.0 + using libbaz/1.1.0 (external) configured libbaz/1.1.0 %info: .+dir\{libbaz.\} is up to date% updated libbaz/1.1.0 @@ -1496,6 +1520,186 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! } } +: keep-out +: +{ + +$cfg_create cxx "config.cxx=$config.cxx" -d cfg 2>- &cfg/*** + + # Build libhello as an external package. + # + +cp -r $src/libhello-1.0.0 ./libhello + +$rep_add libhello --type dir + +$rep_fetch + +$* libhello 2>! + + # Move libhello version ahead. + # + +sed -i -e 's/(version: 1.0).0/\1.1/' libhello/manifest + +$rep_fetch + + test.arguments += --yes # Is a command-specific option. + + : unspecified + : + : Test that libhello is fully rebuilt. + : + { + $clone_cfg; + $rep_fetch; + + $* libhello 2>>~%EOE% + disfigured libhello/1.0.0 + using libhello/1.0.1 (external) + configured libhello/1.0.1 + %mkdir .+%+ + %c\+\+ .+%+ + %ld .+%+ + updated libhello/1.0.1 + EOE + } + + : specified + : + { + test.arguments += --keep-out + + +$clone_cfg + + : dir-repo + : + : Test that libhello is built incrementally. May re-link due to the + : configuration copying. + : + { + $clone_cfg; + + $* libhello 2>>~%EOE%; + disfigured libhello/1.0.0 + using libhello/1.0.1 (external) + configured libhello/1.0.1 + %ld .+%* + updated libhello/1.0.1 + EOE + + test -d cfg/libhello/; + test -d cfg/libhello-1.0.1/ == 1 + } + + : directory + : + : Test that libhello is built incrementally. May re-link due to the + : configuration copying. + : + { + +$clone_cfg + + : arg + : + { + $clone_cfg; + + $* ../../../libhello/ 2>>~%EOE%; + disfigured libhello/1.0.0 + using libhello/1.0.1 (external) + configured libhello/1.0.1 + %ld .+%* + updated libhello/1.0.1 + EOE + + test -d cfg/libhello/; + test -d cfg/libhello-1.0.1/ == 1 + } + + : unpacked + : + { + $clone_cfg; + $pkg_disfigure libhello --keep-out 2>!; + $pkg_unpack -r -e ../../../libhello; + + $* libhello 2>>~%EOE%; + configured libhello/1.0.1 + %ld .+%* + updated libhello/1.0.1 + EOE + + test -d cfg/libhello/; + test -d cfg/libhello-1.0.1/ == 1 + } + } + + : archive + : + : Test that libhello is fully rebuilt, as the resulted package is not + : external. + : + : @@ On Windows the dist operation fails as tar can not find gzip for some + : reason. We will disable the test for Windows until the issue is fixed. + : + if ($cxx.target.class != 'windows') + { + clone_cfg = cp --no-cleanup -r ../../cfg ./ + + +$build 'dist(../../libhello/@./out/)' \ + "config.cxx=$config.cxx" config.dist.root=./ \ + config.dist.archives=tar.gz 2>! \ + &out/*** &libhello-1.0.1/*** &libhello-1.0.1.tar.gz + + : arg + : + { + $clone_cfg; + + $* ../libhello-1.0.1.tar.gz 2>>~%EOE%; + disfigured libhello/1.0.0 + fetched libhello/1.0.1 + unpacked libhello/1.0.1 + configured libhello/1.0.1 + %c\+\+ .+%+ + %ld .+%+ + updated libhello/1.0.1 + EOE + + test -d cfg/libhello-1.0.1/; + test -d cfg/libhello/ == 1; + + $pkg_disfigure libhello 2>'disfigured libhello/1.0.1'; + $pkg_purge libhello 2>'purged libhello/1.0.1'; + + rm -r cfg/ + } + + : unpacked + : + { + $clone_cfg; + + $pkg_disfigure libhello 2>!; + $pkg_fetch -r -e ../libhello-1.0.1.tar.gz; + $pkg_unpack libhello; + + $* libhello 2>>~%EOE%; + configured libhello/1.0.1 + %c\+\+ .+%+ + %ld .+%+ + updated libhello/1.0.1 + EOE + + test -d cfg/libhello-1.0.1/; + test -d cfg/libhello/ == 1; + + $pkg_disfigure libhello 2>'disfigured libhello/1.0.1'; + $pkg_purge libhello 2>'purged libhello/1.0.1'; + + rm -r cfg/ + } + } + } + + -$pkg_disfigure libhello 2>'disfigured libhello/1.0.0' + -$pkg_purge libhello 2>'purged libhello/1.0.0' +} + : git-rep : if ($git_supported != true) @@ -1518,27 +1722,29 @@ else : Prerequisite package of the dependent being built is in the prerequisite : repository. : - $clone_root_cfg; - $rep_add "$rep0/libbar.git#master"; - $rep_add "$rep0/style-basic.git#master"; - $rep_fetch &cfg/.bpkg/repos/*/***; - - $* libmbar 2>>~%EOE%; - %dist style-basic-.+% - %checked out style-basic/.+% - %configured style-basic/.+% - dist libmbar-1.0.0 - checked out libmbar/1.0.0 - configured libmbar/1.0.0 - %info: .+dir\{libmbar-.+\} is up to date% - updated libmbar/1.0.0 - EOE - - $pkg_disfigure libmbar; - $pkg_disfigure style-basic; - - $pkg_purge libmbar; - $pkg_purge style-basic + { + $clone_root_cfg; + $rep_add "$rep0/libbar.git#master"; + $rep_add "$rep0/style-basic.git#master"; + $rep_fetch &cfg/.bpkg/repos/*/***; + + $* libmbar 2>>~%EOE%; + %dist style-basic-.+% + %checked out style-basic/.+% + %configured style-basic/.+% + dist libmbar-1.0.0 + checked out libmbar/1.0.0 + configured libmbar/1.0.0 + %info: .+dir\{libmbar-.+\} is up to date% + updated libmbar/1.0.0 + EOE + + $pkg_disfigure libmbar; + $pkg_disfigure style-basic; + + $pkg_purge libmbar; + $pkg_purge style-basic + } : no-prerequisite-repos : @@ -1546,25 +1752,53 @@ else : dependency is picked up via the root repository that complements its : repository (see rep_fetch() function implementation for details). : - $clone_root_cfg; - $rep_add "$rep1/libbaz.git#master"; - $rep_add "$rep0/style-basic.git#master"; - $rep_fetch &cfg/.bpkg/repos/*/***; - - $* libbaz 2>>~%EOE%; - %dist style-basic-.+% - %checked out style-basic/.+% - %configured style-basic/.+% - dist libbaz-1.0.0 - checked out libbaz/1.0.0 - configured libbaz/1.0.0 - %info: .+dir\{libbaz-.+\} is up to date% - updated libbaz/1.0.0 - EOE - - $pkg_disfigure libbaz; - $pkg_disfigure style-basic; - - $pkg_purge libbaz; - $pkg_purge style-basic + { + $clone_root_cfg; + $rep_add "$rep1/libbaz.git#master"; + $rep_add "$rep0/style-basic.git#master"; + $rep_fetch &cfg/.bpkg/repos/*/***; + + $* libbaz 2>>~%EOE%; + %dist style-basic-.+% + %checked out style-basic/.+% + %configured style-basic/.+% + dist libbaz-1.0.0 + checked out libbaz/1.0.0 + configured libbaz/1.0.0 + %info: .+dir\{libbaz-.+\} is up to date% + updated libbaz/1.0.0 + EOE + + $pkg_disfigure libbaz; + $pkg_disfigure style-basic; + + $pkg_purge libbaz; + $pkg_purge style-basic + } + + : build-unpacked + : + : Test that the unpacked external package is properly built for the first + : time and is not rebuilt afterwards via the directory argument. + : + if ($remote != true) + { + $clone_root_cfg; + + d = $canonicalize([dir_path] $out_git/state0/style-basic.git); + $pkg_unpack -e $d; + + $* style-basic 2>>~%EOE%; + %configured style-basic/1\.1\.0-a\.0\.\d+\..+% + %info: .+style-basic.+ is up to date% + %updated style-basic/1\.1\.0-a\.0\.\d+\..+% + EOE + + $* $d 2>>~%EOE%; + %info: .+style-basic.+ is up to date% + %updated style-basic/1\.1\.0-a\.0\.\d+\..+% + EOE + + $pkg_disfigure style-basic + } } diff --git a/tests/pkg-build/libhello-1.0.0 b/tests/pkg-build/libhello-1.0.0 new file mode 120000 index 0000000..614ff24 --- /dev/null +++ b/tests/pkg-build/libhello-1.0.0 @@ -0,0 +1 @@ +../common/libhello-1.0.0/ \ No newline at end of file diff --git a/tests/pkg-configure.test b/tests/pkg-configure.test index 3b4834e..c82593c 100644 --- a/tests/pkg-configure.test +++ b/tests/pkg-configure.test @@ -188,14 +188,9 @@ $* libhello libhello 2>>EOE != 0 $* libhello 2>'configured libhello/1.0.0'; touch cfg/libhello/stray &!cfg/libhello/stray; - $pkg_disfigure libhello 2>>/EOE != 0; - warning: directory cfg/libhello/ is not empty, not removing - error: package output directory cfg/libhello/ still exists - info: package libhello is now broken; use 'pkg-purge' to remove - EOE + $pkg_disfigure libhello 2>'disfigured libhello/1.0.0'; - $pkg_status libhello/1.0.0 >'broken'; - rm -r cfg/libhello; + $pkg_status libhello/1.0.0 >'unpacked'; $pkg_purge -f libhello 2>'purged libhello/1.0.0'; $pkg_status libhello/1.0.0 1>'unknown' @@ -255,7 +250,7 @@ if ($cxx.target.class != 'windows') $* libhello 2>>/~%EOE% != 0; %error: unable to create directory cfg/libhello/build/.+% - %error: unable to remove directory cfg/libhello/build/.+% + %error: unable to remove directory cfg/libhello/.+% info: package libhello is now broken; use 'pkg-purge' to remove EOE -- cgit v1.1