aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/common.test15
-rw-r--r--tests/fetch.test28
-rw-r--r--tests/init.test49
-rw-r--r--tests/new.test38
-rw-r--r--tests/status.test27
-rw-r--r--tests/sync.test160
-rw-r--r--tests/test.test102
-rw-r--r--tests/update.test95
8 files changed, 403 insertions, 111 deletions
diff --git a/tests/common.test b/tests/common.test
index 8578f5c..3aefde4 100644
--- a/tests/common.test
+++ b/tests/common.test
@@ -5,25 +5,16 @@
# Commonly-used variables setup and driver command line.
#
-# Variables for supporting Windows/POSIX testscript variants.
-#
-win32 = ($cxx.target.class == 'windows')
-exe = ($win32 ? '.exe' : '')
-
# 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). This implies that we don't
-# support cross-testing.
+# to one that may or may not be found via PATH). Note that this implies that
+# we don't support cross-testing.
#
# A common approach will be to run build2 as a sanity check in a directory
-# produced/updated by a command being tested.
+# produced or updated by a command being tested.
#
build = $recall($build.path)
test.options += --build $build
-# @@ It would be nice to query bdep for the bpkg path it uses.
-#
-bpkg = ("$config.bdep.test.bpkg" != '' ? "$config.bdep.test.bpkg" : "bpkg$exe")
-
# 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
# additional options and redirects appended prior to use. A common approach
diff --git a/tests/fetch.test b/tests/fetch.test
index 7fec857..e7fd54e 100644
--- a/tests/fetch.test
+++ b/tests/fetch.test
@@ -4,19 +4,21 @@
.include common.test project.test
+cxx = cc "config.cxx=$config.cxx"
+
new += 2>!
-init += cc "config.cxx=$config.cxx" -d prj 2>!
-status += --all
+init += $cxx -d prj 2>!
+status += --all -d prj
deinit += -d prj
-: add-dependency
+: dependency
:
{
$clone_prj;
- $init -C prj-cfg @cfg &prj-cfg/***;
+ $init -C @cfg &prj-cfg/***;
- $new -t lib --vcs none libfoo &libfoo/*** 2>!;
- $new -t lib --vcs none libbar &libbar/*** 2>!;
+ $new -t lib libbar &libbar/*** 2>!;
+ $new -t lib libfoo &libfoo/*** 2>!;
cat <<EOI >+prj/repositories.manifest;
:
@@ -29,17 +31,19 @@ deinit += -d prj
type: dir
EOI
+ cat <<EOI >+prj/manifest;
+ depends: libfoo
+ depends: libbar
+ EOI
+
$* 2>>/"EOE";
fetching dir:$~/libbar \(complements dir:$~/prj\)
fetching dir:$~/libfoo \(prerequisite of dir:$~/prj\)
EOE
- $status -d prj >'prj configured 0.1.0-a.0.19700101000000';
-
- $bpkg list --complements --prerequisites -d prj-cfg >>/"EOO";
- dir:$~/prj $~/prj
- complement dir:$~/libbar $~/libbar
- prerequisite dir:$~/libfoo $~/libfoo
+ $status libfoo libbar >>~%EOO%;
+ %libfoo available \[.+\]%
+ %libbar available .+%
EOO
$deinit 2>>/"EOE"
diff --git a/tests/init.test b/tests/init.test
index 3fc05c6..0064cf7 100644
--- a/tests/init.test
+++ b/tests/init.test
@@ -7,15 +7,14 @@
.include common.test project.test
-new += -d prj
+cxx = cc "config.cxx=$config.cxx"
+
status += -d prj
deinit += -d prj
-cxx = cc "config.cxx=$config.cxx"
-
: create-cfg
:
-: We will also test that the configuration variables are properly persisted and
+: Here we also test that the configuration variable is properly persisted and
: the project is properly built in the source tree.
:
{
@@ -40,7 +39,7 @@ cxx = cc "config.cxx=$config.cxx"
ln prj-cfg/prj/prj/exe{prj} -> prj/prj/
EOE
- prj/prj/prj 'testscript' >'Hello, testscript!';
+ prj/prj/prj 'testscript' >'Hello, testscript!'; # Make sure is forwarded.
$build prj-cfg/prj/ 2>>/EOE;
info: prj-cfg/dir{prj/} is up to date
@@ -64,10 +63,12 @@ cxx = cc "config.cxx=$config.cxx"
{
$clone_prj;
- $bpkg create $cxx -d prj-cfg1/ 2>! &prj-cfg1/***;
- $bpkg create $cxx -d prj-cfg2/ 2>! &prj-cfg2/***;
+ # Pre-create configurations.
+ #
+ $new -C prj-cfg1 tmp $cxx 2>! &prj-cfg1/*** &tmp/***;
+ $init -C prj-cfg2 -d tmp $cxx 2>! &prj-cfg2/***;
- $* -A @cfg1 2>>/~"%EOE%"; # Shortcut.
+ $* -A @cfg1 2>>/~"%EOE%";
initializing in project $~/prj/
added configuration @cfg1 $~/prj-cfg1/ \(1, default, forwarded, auto-synchronized\)
synchronizing:
@@ -89,23 +90,29 @@ cxx = cc "config.cxx=$config.cxx"
prj configured 0.1.0-a.0.19700101000000
EOO
- $build prj-cfg1/ 2>>/EOE;
- mkdir prj-cfg1/prj/fsdir{prj/}
- c++ prj/prj/cxx{prj}@prj-cfg1/prj/prj/
- ld prj-cfg1/prj/prj/exe{prj}
+ $build prj-cfg1/ 2>>/~%EOE%;
+ %mkdir prj-cfg1/.+%{2}
+ %c\+\+ .+%{2}
+ %ld prj-cfg1/.+%{2}
EOE
- $build prj-cfg2/ 2>>/EOE;
- mkdir prj-cfg2/prj/fsdir{prj/}
- c++ prj/prj/cxx{prj}@prj-cfg2/prj/prj/
- ld prj-cfg2/prj/prj/exe{prj}
+ $build prj-cfg2/ 2>>/~%EOE%;
+ %mkdir prj-cfg2/.+%{2}
+ %c\+\+ .+%{2}
+ %ld prj-cfg2/.+%{2}
EOE
- $build prj/ 2>>/EOE &prj/prj/prj$exe;
+ $build prj/ 2>>/EOE;
ln prj-cfg1/prj/prj/exe{prj} -> prj/prj/
info: prj-cfg1/dir{prj/} is up to date
EOE
+ $build 'clean:' prj/ 2>>/EOE;
+ rm prj-cfg1/prj/prj/exe{prj}
+ rm prj-cfg1/prj/prj/obje{prj}
+ rm prj-cfg1/prj/fsdir{prj/}
+ EOE
+
$deinit 2>>/"EOE"
deinitializing in project $~/prj/
synchronizing:
@@ -139,10 +146,6 @@ cxx = cc "config.cxx=$config.cxx"
ln prj-cfg/prj/prj/exe{prj} -> prj/prj/
EOE
- $build prj-cfg/ 2>>/EOE;
- info: dir{prj-cfg/} is up to date
- EOE
-
# Move the executable package into a separate directory.
#
mkdir --no-cleanup prj/prj.pkg;
@@ -163,11 +166,11 @@ cxx = cc "config.cxx=$config.cxx"
# Add the library package.
#
- $new --package -t lib libprj 2>>/"EOE";
+ $new --package -t lib libprj -d prj 2>>/"EOE";
created new library package libprj in $~/prj/libprj/
EOE
- $init -a -d prj/libprj 2>>/~"%EOE%";
+ $init --all -d prj/libprj 2>>/~"%EOE%";
initializing in project $~/prj/
synchronizing:
% upgrade prj.+19700101000000#1%
diff --git a/tests/new.test b/tests/new.test
index cdb1537..ab9e25a 100644
--- a/tests/new.test
+++ b/tests/new.test
@@ -4,9 +4,9 @@
.include common.test
-status += -d prj
+cxx = "config.cxx=$config.cxx"
-cxx = cc "config.cxx=$config.cxx"
+status += -d prj
: exe
{
@@ -14,7 +14,7 @@ cxx = cc "config.cxx=$config.cxx"
created new executable project prj in $~/prj/
EOE
- $build prj/ 2>>/EOE
+ $build prj/ $cxx 2>>/EOE
c++ prj/prj/cxx{prj}
ld prj/prj/exe{prj}
EOE
@@ -26,18 +26,37 @@ cxx = cc "config.cxx=$config.cxx"
created new library project libprj in $~/libprj/
EOE
- $build libprj/ 2>>/~%EOE%
+ $build libprj/ $cxx 2>>/~%EOE%
%.{4}
%ld libprj/.+%{3}
EOE
}
+: pkg
+:
+: Test creating a library as a separate package in the project.
+:
+{
+ $* -t empty prj 2>>/"EOE" &prj/***;
+ created new empty project prj in $~/prj/
+ EOE
+
+ $* --package -t lib libprj -d prj 2>>/"EOE";
+ created new library package libprj in $~/prj/libprj/
+ EOE
+
+ $build prj/libprj/ $cxx 2>>/~%EOE%
+ %.{4}
+ %ld prj/libprj/.+%{3}
+ EOE
+}
+
: cfg
{
: dir-and-name
:
{
- $* -C prj-config @cfg prj $cxx 2>>/~"%EOE%" &prj/*** &prj-config/***;
+ $* -C prj-config @cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-config/***;
created new executable project prj in $~/prj/
created configuration @cfg $~/prj-config/ \(1, default, forwarded, auto-synchronized\)
synchronizing:
@@ -56,12 +75,13 @@ cxx = cc "config.cxx=$config.cxx"
: name
:
- : Test deducing the configuration directory path from project source
- : directory path and configuration name. Here we also use the dash-prefixed
- : name (as in Windows PowerShell where the leading '@' character is special).
+ : Test deducing the configuration directory path from the project source
+ : directory path and the configuration name. Here we also use the
+ : dash-prefixed name (as in Windows PowerShell where the leading '@'
+ : character is special).
:
{
- $* -C -@cfg prj $cxx 2>>/~"%EOE%" &prj/*** &prj-cfg/***;
+ $* -C -@cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-cfg/***;
created new executable project prj in $~/prj/
created configuration @cfg $~/prj-cfg/ \(1, default, forwarded, auto-synchronized\)
synchronizing:
diff --git a/tests/status.test b/tests/status.test
index 99fe360..9871898 100644
--- a/tests/status.test
+++ b/tests/status.test
@@ -4,12 +4,14 @@
.include common.test project.test
+cxx = cc "config.cxx=$config.cxx"
+
new += 2>!
-init += cc "config.cxx=$config.cxx" -d prj 2>!
+init += $cxx -d prj 2>!
sync += -d prj 2>!
deinit += -d prj
-: no-config
+: no-cfg
:
{
$clone_prj;
@@ -20,11 +22,12 @@ deinit += -d prj
EOE
}
-: one-config
+: single-cfg
:
{
$clone_prj;
- $init -C prj-cfg @cfg &prj-cfg/***;
+
+ $init -C @cfg &prj-cfg/***;
$* >'prj configured 0.1.0-a.0.19700101000000';
@@ -35,12 +38,13 @@ deinit += -d prj
EOE
}
-: two-configs
+: multi-cfg
:
{
$clone_prj;
- $init -C prj-cfg1 @cfg1 &prj-cfg1/***;
- $init -C prj-cfg2 @cfg2 &prj-cfg2/***;
+
+ $init -C @cfg1 &prj-cfg1/***;
+ $init -C @cfg2 &prj-cfg2/***;
$* @cfg2 >'prj configured 0.1.0-a.0.19700101000000';
@@ -63,9 +67,10 @@ deinit += -d prj
:
{
$clone_prj;
- $init -C prj-cfg @cfg &prj-cfg/***;
- $new -t lib --vcs none libprj &libprj/***;
+ $init -C @cfg &prj-cfg/***;
+
+ $new -t lib libprj &libprj/***;
cat <<EOI >+prj/repositories.manifest;
:
@@ -78,7 +83,7 @@ deinit += -d prj
depends: libprj
EOI
- $* --recursive >>EOO 2>>/"EOE";
+ $* --recursive >>EOO 2>>/"EOE"; # Note: implicitly fetches in cfg.
prj configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
EOO
fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
@@ -88,7 +93,7 @@ deinit += -d prj
$* --recursive >>~%EOO%;
prj configured 0.1.0-a.0.19700101000000#1
- % libprj configured 0\.1\.0-a\.0\..+%
+ % libprj configured 0.+%
EOO
$deinit 2>>/"EOE"
diff --git a/tests/sync.test b/tests/sync.test
index 74d9a6d..195a8e0 100644
--- a/tests/sync.test
+++ b/tests/sync.test
@@ -2,22 +2,21 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-.include common.test project.test
+.include common.test
+
+cxx = cc "config.cxx=$config.cxx"
new += 2>!
-init += cc "config.cxx=$config.cxx" -d prj 2>!
+init += $cxx -d prj 2>!
status += --all --recursive -d prj
deinit += -d prj
-: dependency
+: single-pkg-cfg
:
{
- $clone_prj;
+ $new -C @cfg prj $cxx &prj/*** &prj-cfg/***;
- $init -C @cfg1 &prj-cfg1/***;
- $init -C @cfg2 &prj-cfg2/***;
-
- $new -t lib --vcs none libprj &libprj/***;
+ $new -t lib libprj &libprj/***;
cat <<EOI >+prj/repositories.manifest;
:
@@ -52,66 +51,169 @@ deinit += -d prj
}
EOI
- # Sync the default (cfg1) configuration.
- #
- $* 2>>/~"%EOE%";
+ $* -d prj 2>>/~"%EOE%";
fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
synchronizing:
% new libprj.+ \\\(required by prj\\\)%
% upgrade prj.+19700101000000#1%
EOE
- $status >>~%EOO% 2>>/~"%EOE%";
- in configuration @cfg1:
+ $status >>~%EOO%;
prj configured 0.1.0-a.0.19700101000000#1
% libprj configured 0.+%
+ EOO
+
+ $build prj/ 2>>/~%EOE%;
+ %mkdir prj-cfg/.+%{2}
+ %.{3}
+ %ld prj-cfg/.+%{2}
+ ln prj-cfg/prj/prj/exe{prj} -> prj/prj/
+ EOE
+
+ $build 'clean:' prj/ 2>>/EOE;
+ rm prj-cfg/prj/prj/exe{prj}
+ rm prj-cfg/prj/prj/obje{prj}
+ rm prj-cfg/prj/fsdir{prj/}
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ synchronizing:
+ drop prj
+ drop libprj
+ EOE
+}
+
+: multi-pkg-cfg
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg1 &prj-cfg1/***;
+ $init -C @cfg2 &prj-cfg2/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/pkg1/manifest;
+ depends: libprj
+ EOI
+
+ sed -i -e 's/^(#import .+)$/import libs += libprj%lib{prj}/' \
+ prj/pkg1/pkg1/buildfile;
+
+ cat <<EOI >=prj/pkg1/pkg1/pkg1.cxx;
+ #include <iostream>
+
+ #include <libprj/prj.hxx>
+
+ using namespace std;
+
+ int main (int argc, char* argv[])
+ {
+ if (argc < 2)
+ {
+ cerr << "error: missing name" << endl;
+ return 1;
+ }
+
+ prj::say_hello (cout, argv[1]);
+ }
+ EOI
+
+ cat <<EOI >+prj/pkg2/manifest;
+ tags: c++
+ EOI
+
+ # Sync the default (cfg1) configuration (via the package directory).
+ #
+ $* -d prj/pkg2 2>>/~"%EOE%";
+ fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
+ synchronizing:
+ % new libprj.+ \\\(required by pkg1\\\)%
+ % upgrade pkg1.+19700101000000#1%
+ % upgrade pkg2.+19700101000000#1%
+ EOE
+
+ $status >>~%EOO% 2>>/~"%EOE%"; # Note: implicitly fetches into cfg2.
+ in configuration @cfg1:
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ % libprj configured 0.+%
+ pkg2 configured 0.1.0-a.0.19700101000000#1
in configuration @cfg2:
- prj configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
+ pkg1 configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
+ pkg2 configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1
EOO
fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
EOE
- # Sync all configuration.
+ # Sync all configurations (via the project directory).
#
- $* --all 2>>~%EOE%;
+ $* --all -d prj 2>>~%EOE%;
in configuration @cfg1:
in configuration @cfg2:
synchronizing:
- % new libprj.+ \(required by prj\)%
- upgrade prj/0.1.0-a.0.19700101000000#1
+ % new libprj.+ \(required by pkg1\)%
+ upgrade pkg1/0.1.0-a.0.19700101000000#1
+ upgrade pkg2/0.1.0-a.0.19700101000000#1
EOE
$status >>~%EOE%;
in configuration @cfg1:
- prj configured 0.1.0-a.0.19700101000000#1
+ pkg1 configured 0.1.0-a.0.19700101000000#1
% libprj configured 0.+%
+ pkg2 configured 0.1.0-a.0.19700101000000#1
in configuration @cfg2:
- prj configured 0.1.0-a.0.19700101000000#1
+ pkg1 configured 0.1.0-a.0.19700101000000#1
% libprj configured 0.+%
+ pkg2 configured 0.1.0-a.0.19700101000000#1
EOE
- # @@ Add synchronizing a single package when 'new -t empty' is supported.
- #
- $build prj/ 2>>/~"%EOE%";
+ $build prj/pkg1/ 2>>/~%EOE%;
%mkdir prj-cfg1/.+%{2}
%.{3}
%ld prj-cfg1/.+%{2}
- ln prj-cfg1/prj/prj/exe{prj} -> prj/prj/
+ ln prj-cfg1/pkg1/pkg1/exe{pkg1} -> prj/pkg1/pkg1/
EOE
- $build 'clean:' prj/ 2>>/EOE;
- rm prj-cfg1/prj/prj/exe{prj}
- rm prj-cfg1/prj/prj/obje{prj}
- rm prj-cfg1/prj/fsdir{prj/}
+ $build prj/pkg2/ 2>>/EOE;
+ mkdir prj-cfg1/pkg2/fsdir{pkg2/}
+ c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg1/pkg2/pkg2/
+ ld prj-cfg1/pkg2/pkg2/exe{pkg2}
+ ln prj-cfg1/pkg2/pkg2/exe{pkg2} -> prj/pkg2/pkg2/
+ EOE
+
+ $build 'clean:' prj/pkg1/ 2>>/EOE;
+ rm prj-cfg1/pkg1/pkg1/exe{pkg1}
+ rm prj-cfg1/pkg1/pkg1/obje{pkg1}
+ rm prj-cfg1/pkg1/fsdir{pkg1/}
+ EOE
+
+ $build 'clean:' prj/pkg2/ 2>>/EOE;
+ rm prj-cfg1/pkg2/pkg2/exe{pkg2}
+ rm prj-cfg1/pkg2/pkg2/obje{pkg2}
+ rm prj-cfg1/pkg2/fsdir{pkg2/}
EOE
$deinit 2>>/"EOE"
deinitializing in project $~/prj/
+ deinitializing package pkg1
+ deinitializing package pkg2
synchronizing:
- drop prj
+ drop pkg1
drop libprj
+ drop pkg2
EOE
}
diff --git a/tests/test.test b/tests/test.test
index 673927b..a2ed771 100644
--- a/tests/test.test
+++ b/tests/test.test
@@ -2,19 +2,20 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
-.include common.test project.test
+.include common.test
+cxx = cc "config.cxx=$config.cxx"
+
+new += 2>!
init += cc "config.cxx=$config.cxx" -d prj 2>!
deinit += -d prj
-: project
+: single-pkg-cfg
:
{
- $clone_prj;
-
- $init -C @cfg &prj-cfg/***;
+ $new -C @cfg prj $cxx &prj/*** &prj-cfg/***;
- $* 2>>/EOE;
+ $* -d prj 2>>/EOE;
mkdir prj-cfg/prj/fsdir{prj/}
c++ prj/prj/cxx{prj}@prj-cfg/prj/prj/
ld prj-cfg/prj/prj/exe{prj}
@@ -27,3 +28,92 @@ deinit += -d prj
drop prj
EOE
}
+
+: multi-pkg-cfg
+:
+: Here we will also test recursively.
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg1 &prj-cfg1/***;
+ $init -C @cfg2 &prj-cfg2/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/pkg1/manifest;
+ depends: libprj
+ EOI
+
+ sed -i -e 's/^(#import .+)$/import libs += libprj%lib{prj}/' \
+ prj/pkg1/pkg1/buildfile;
+
+ cat <<EOI >=prj/pkg1/pkg1/pkg1.cxx;
+ #include <iostream>
+
+ #include <libprj/prj.hxx>
+
+ using namespace std;
+
+ int main (int argc, char* argv[])
+ {
+ if (argc < 2)
+ {
+ cerr << "error: missing name" << endl;
+ return 1;
+ }
+
+ prj::say_hello (cout, argv[1]);
+ }
+ EOI
+
+ cat <<EOI >+prj/pkg2/manifest;
+ tags: c++
+ EOI
+
+ $* -d prj/pkg2 2>>/~"%EOE%"; # Default (cfg1).
+ fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
+ synchronizing:
+ % new libprj.+ \\\(required by pkg1\\\)%
+ % upgrade pkg1.+19700101000000#1%
+ % upgrade pkg2.+19700101000000#1%
+ mkdir prj-cfg1/pkg2/fsdir{pkg2/}
+ c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg1/pkg2/pkg2/
+ ld prj-cfg1/pkg2/pkg2/exe{pkg2}
+ test prj/pkg2/pkg2/test{testscript}@prj-cfg1/pkg2/pkg2/ prj-cfg1/pkg2/pkg2/exe{pkg2}
+ EOE
+
+ $* @cfg2 -d prj/pkg2 2>>/~"%EOE%"; # By name (cfg2).
+ fetching dir:$~/libprj \(prerequisite of dir:$~/prj\)
+ synchronizing:
+ % new libprj.+ \\\(required by pkg1\\\)%
+ % upgrade pkg1.+19700101000000#1%
+ % upgrade pkg2.+19700101000000#1%
+ mkdir prj-cfg2/pkg2/fsdir{pkg2/}
+ c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg2/pkg2/pkg2/
+ ld prj-cfg2/pkg2/pkg2/exe{pkg2}
+ test prj/pkg2/pkg2/test{testscript}@prj-cfg2/pkg2/pkg2/ prj-cfg2/pkg2/pkg2/exe{pkg2}
+ EOE
+
+ $* -a --recursive -d prj/pkg1 2>>/~%EOE% # All configs recursive.
+ in configuration @cfg1:
+ %mkdir prj-cfg1/.+%{3}
+ %.{7}
+ %test prj.+%{2}
+
+ in configuration @cfg2:
+ %mkdir prj-cfg2/.+%{3}
+ %.{7}
+ %test prj.+%{2}
+ EOE
+}
diff --git a/tests/update.test b/tests/update.test
index 23055c6..3e8e5f5 100644
--- a/tests/update.test
+++ b/tests/update.test
@@ -5,26 +5,26 @@
# Here we test both update and clean commands.
#
-.include common.test project.test
+.include common.test
-init += cc "config.cxx=$config.cxx" -d prj 2>!
+cxx = cc "config.cxx=$config.cxx"
+
+new += 2>!
+init += $cxx -d prj 2>!
deinit += -d prj
-clean += -d prj
-: project
+: single-pkg-cfg
:
{
- $clone_prj;
-
- $init -C @cfg &prj-cfg/***;
+ $new -C @cfg prj $cxx &prj/*** &prj-cfg/***;
- $* 2>>/EOE;
+ $* -d prj 2>>/EOE;
mkdir prj-cfg/prj/fsdir{prj/}
c++ prj/prj/cxx{prj}@prj-cfg/prj/prj/
ld prj-cfg/prj/prj/exe{prj}
EOE
- $clean 2>>/EOE;
+ $clean -d prj 2>>/EOE;
rm prj-cfg/prj/prj/exe{prj}
rm prj-cfg/prj/prj/obje{prj}
rm prj-cfg/prj/fsdir{prj/}
@@ -36,3 +36,80 @@ clean += -d prj
drop prj
EOE
}
+
+: multi-pkg-cfg
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg1 &prj-cfg1/***;
+ $init -C @cfg2 &prj-cfg2/***;
+
+ # Update.
+ #
+ $* -d prj/pkg1 2>>/EOE; # Default (cfg1).
+ mkdir prj-cfg1/pkg1/fsdir{pkg1/}
+ c++ prj/pkg1/pkg1/cxx{pkg1}@prj-cfg1/pkg1/pkg1/
+ ld prj-cfg1/pkg1/pkg1/exe{pkg1}
+ EOE
+
+ $* @cfg2 -d prj/pkg1 2>>/EOE; # By name (cfg2).
+ mkdir prj-cfg2/pkg1/fsdir{pkg1/}
+ c++ prj/pkg1/pkg1/cxx{pkg1}@prj-cfg2/pkg1/pkg1/
+ ld prj-cfg2/pkg1/pkg1/exe{pkg1}
+ EOE
+
+ $* --all -d prj 2>>/EOE; # All configs (and packages).
+ in configuration @cfg1:
+ mkdir prj-cfg1/pkg2/fsdir{pkg2/}
+ c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg1/pkg2/pkg2/
+ ld prj-cfg1/pkg2/pkg2/exe{pkg2}
+ info: prj-cfg1/dir{pkg1/} is up to date
+
+ in configuration @cfg2:
+ mkdir prj-cfg2/pkg2/fsdir{pkg2/}
+ c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg2/pkg2/pkg2/
+ ld prj-cfg2/pkg2/pkg2/exe{pkg2}
+ info: prj-cfg2/dir{pkg1/} is up to date
+ EOE
+
+ # Clean.
+ #
+ $clean -d prj/pkg1 2>>/EOE; # Default (cfg1).
+ rm prj-cfg1/pkg1/pkg1/exe{pkg1}
+ rm prj-cfg1/pkg1/pkg1/obje{pkg1}
+ rm prj-cfg1/pkg1/fsdir{pkg1/}
+ EOE
+
+ $clean @cfg2 -d prj/pkg1 2>>/EOE; # By name (cfg2).
+ rm prj-cfg2/pkg1/pkg1/exe{pkg1}
+ rm prj-cfg2/pkg1/pkg1/obje{pkg1}
+ rm prj-cfg2/pkg1/fsdir{pkg1/}
+ EOE
+
+ $clean --all -d prj 2>>/EOE; # All configs (and packages).
+ in configuration @cfg1:
+ rm prj-cfg1/pkg2/pkg2/exe{pkg2}
+ rm prj-cfg1/pkg2/pkg2/obje{pkg2}
+ rm prj-cfg1/pkg2/fsdir{pkg2/}
+ info: prj-cfg1/dir{pkg1/} is clean
+
+ in configuration @cfg2:
+ rm prj-cfg2/pkg2/pkg2/exe{pkg2}
+ rm prj-cfg2/pkg2/pkg2/obje{pkg2}
+ rm prj-cfg2/pkg2/fsdir{pkg2/}
+ info: prj-cfg2/dir{pkg1/} is clean
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ deinitializing package pkg1
+ deinitializing package pkg2
+ synchronizing:
+ drop pkg1
+ drop pkg2
+ EOE
+}