aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cfg-add.testscript190
-rw-r--r--tests/cfg-create.testscript126
-rw-r--r--tests/common.testscript1
-rw-r--r--tests/common/associated/t7a/foo-1.0.0.tar.gzbin0 -> 361 bytes
-rw-r--r--tests/common/associated/t7a/libbar-1.0.0.tar.gzbin0 -> 371 bytes
-rw-r--r--tests/common/associated/t7a/libbaz-1.0.0.tar.gzbin0 -> 354 bytes
-rw-r--r--tests/common/associated/t7a/libbox-1.0.0.tar.gzbin0 -> 373 bytes
-rw-r--r--tests/common/associated/t7a/libfix-1.0.0.tar.gzbin0 -> 373 bytes
-rw-r--r--tests/common/associated/t7a/repositories.manifest1
-rw-r--r--tests/common/associated/t7b/foo-1.1.0.tar.gzbin0 -> 361 bytes
-rw-r--r--tests/common/associated/t7b/libbar-1.1.0.tar.gzbin0 -> 374 bytes
-rw-r--r--tests/common/associated/t7b/libbaz-1.1.0.tar.gzbin0 -> 355 bytes
-rw-r--r--tests/common/associated/t7b/libbox-1.1.0.tar.gzbin0 -> 371 bytes
-rw-r--r--tests/common/associated/t7b/repositories.manifest4
-rw-r--r--tests/pkg-build.testscript769
l---------tests/pkg-build/t7a1
l---------tests/pkg-build/t7b1
-rw-r--r--tests/pkg-drop.testscript256
l---------tests/pkg-drop/t7a1
l---------tests/pkg-drop/t7b1
20 files changed, 1343 insertions, 8 deletions
diff --git a/tests/cfg-add.testscript b/tests/cfg-add.testscript
new file mode 100644
index 0000000..d47d6e4
--- /dev/null
+++ b/tests/cfg-add.testscript
@@ -0,0 +1,190 @@
+# file : tests/cfg-add.testscript
+# license : MIT; see accompanying LICENSE file
+
+.include common.testscript
+
+cfg_create += 2>!
+
+# @@ To verify the association result use cfg-list command rather than
+# pkg-status, when implemented.
+#
+
+test.arguments += -d cfg
+
+cfg_uuid = '18f48b4b-b5d9-4712-b98c-1930df1c4228'
+acfg_uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228'
+
+: success
+:
+{
+ $cfg_create -d cfg --name 'main';
+ $cfg_create -d acfg --name 'shared' --config-uuid "$acfg_uuid" &acfg/***;
+
+ # Try to associate configuration under the same name.
+ #
+ $* cfg 2>>/~"%EOE%" != 0;
+ %error: associating configuration .+/cfg/ with itself%
+ % info: uuid: .{36}%
+ EOE
+
+ # Try to associate configuration under the same name.
+ #
+ $* acfg --name 'main' 2>>/~"%EOE%" != 0;
+ %error: associating configuration .+/acfg/ using current configuration name 'main'%
+ info: consider specifying alternative name with --name
+ EOE
+
+ # Associate configuration.
+ #
+ $* acfg 2>>/~"%EOE%";
+ %associated configuration .+/acfg/%
+ info: uuid: $acfg_uuid
+ info: type: target
+ info: name: shared
+ info: id: 1
+ EOE
+
+ $pkg_status -d cfg libfoo >'libfoo unknown';
+ $pkg_status -d acfg libfoo >'libfoo unknown';
+
+ # Test that the recreated configuration can be implicitly re-associated.
+ #
+ rm -r cfg;
+ $cfg_create -d cfg --name 'test' --config-uuid "$cfg_uuid" &cfg/***;
+
+ $* acfg 2>>/~"%EOE%";
+ %warning: current configuration .+/cfg/ is already implicitly associated with .+/acfg/%
+ %associated configuration .+/acfg/%
+ info: uuid: $acfg_uuid
+ info: type: target
+ info: name: shared
+ info: id: 1
+ EOE
+
+ # Test that the repeated association is reported.
+ #
+ $* acfg 2>>/~%EOE% != 0;
+ %error: configuration with uuid .{36} is already associated as \.\./acfg/%
+ EOE
+
+ rm -r acfg;
+
+ $cfg_create -d acfg --name 'shared' &acfg/***;
+
+ # Test that the path clash is reported.
+ #
+ $* acfg 2>>/~%EOE% != 0;
+ %error: configuration with path .+/acfg/ is already associated%
+ EOE
+
+ # Test that the name clash is reported.
+ #
+ $cfg_create -d acfg2 --name 'shared' &acfg2/***;
+
+ $* acfg2 --name 'shared' 2>>/EOE != 0;
+ error: configuration with name shared is already associated as ../acfg/
+ info: consider specifying alternative name with --name
+ EOE
+
+ $* acfg2 2>>/~%EOE%;
+ warning: configuration with name shared is already associated as ../acfg/, associating as unnamed
+ %associated configuration .+/acfg2/%
+ % info: uuid: .{36}%
+ info: type: target
+ info: id: 2
+ EOE
+
+ # Test that the integrity check fails.
+ #
+ $pkg_status -d cfg libfoo 2>>/~"%EOE%" != 0;
+ error: configuration acfg/ uuid mismatch
+ % info: uuid .+%
+ info: associated with cfg/ as $acfg_uuid
+ EOE
+
+ # Associate the second configuration.
+ #
+ rm -r acfg;
+ $cfg_create -d acfg --name 'shared' --config-uuid "$acfg_uuid" &acfg/***;
+
+ $pkg_status -d cfg libfoo >'libfoo unknown';
+ $pkg_status -d acfg2 libfoo >'libfoo unknown';
+
+ # Test that the configuration type mismatch is reported.
+ #
+ mv cfg cfg.tmp;
+ $cfg_create -d cfg --type host --config-uuid "$cfg_uuid";
+
+ $* -d acfg2 cfg 2>>/EOE != 0;
+ error: configuration cfg/ type mismatch
+ info: type host
+ info: implicitly associated with acfg2/ as target
+ EOE
+
+ rm -r cfg;
+ mv cfg.tmp cfg;
+
+ # Make the implicit association explicit.
+ #
+ $* -d acfg2 cfg 2>>/~"%EOE%";
+ %associated configuration .+/cfg/%
+ info: uuid: $cfg_uuid
+ info: type: target
+ info: name: test
+ info: id: 1
+ EOE
+
+ $pkg_status -d cfg libfoo >'libfoo unknown';
+ $pkg_status -d acfg2 libfoo >'libfoo unknown';
+
+ $* -d acfg2 cfg 2>>/~%EOE% != 0;
+ %error: configuration with uuid .{36} is already associated as \.\./cfg/%
+ EOE
+
+ # Test that the reverse association path clash is reported.
+ #
+ rm -r cfg;
+ $cfg_create -d cfg --name 'test' &cfg/***;
+
+ $* acfg2 2>>/~%EOE% != 0;
+ %error: current configuration .+/cfg/ is already associated with .+/acfg2/%
+ EOE
+
+ # Test that the repeated reverse association is reported.
+ #
+ $cfg_create -d cfg2 --config-uuid "$cfg_uuid";
+
+ $* -d cfg2 acfg2 2>>/~"%EOE%" != 0;
+ %error: current configuration $cfg_uuid is already associated with .+/acfg2/%
+ EOE
+
+ # Make sure that current configuration is reverse associated as unnamed.
+ #
+ # @@ Make sure that's really the case when the cfg-list command is
+ # implemented.
+ #
+ rm -r cfg2;
+ $cfg_create -d cfg2 --name 'test' &cfg2/***;
+
+ $* -d cfg2 acfg2 2>>/~%EOE%;
+ %associated configuration .+/acfg2/%
+ % info: uuid: .{36}%
+ info: type: target
+ info: name: shared
+ info: id: 1
+ EOE
+
+ # Test that the integrity check fails.
+ #
+ $pkg_status -d cfg2 libfoo 2>>/~"%EOE%" != 0;
+ error: configuration cfg/ uuid mismatch
+ % info: uuid .+%
+ info: associated with acfg2/ as $cfg_uuid
+ EOE
+
+ rm -r cfg;
+ $cfg_create -d cfg --name 'test' --config-uuid "$cfg_uuid" &cfg/***;
+
+ $pkg_status -d cfg2 libfoo >'libfoo unknown';
+ $pkg_status -d acfg2 libfoo >'libfoo unknown'
+}
diff --git a/tests/cfg-create.testscript b/tests/cfg-create.testscript
index 9461dad..1993547 100644
--- a/tests/cfg-create.testscript
+++ b/tests/cfg-create.testscript
@@ -5,6 +5,11 @@
config_cxx = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
+cfg_create += 2>!
+
+# @@ To verify the creation result use cfg-list command rather than
+# pkg-status, when implemented.
+#
pkg_status += -d cfg
: non-empty
@@ -25,6 +30,8 @@ EOE
{
$* 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
EOE
$pkg_status libfoo >'libfoo unknown'
@@ -35,6 +42,8 @@ EOE
{
$* "config.install.root='$~/opt'" 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
EOE
$pkg_status libfoo >'libfoo unknown';
@@ -51,6 +60,8 @@ EOE
{
$* cxx $config_cxx 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
EOE
$pkg_status libfoo >'libfoo unknown';
@@ -69,6 +80,8 @@ EOE
$* --wipe 2>>/~%EOE%;
%created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
EOE
$pkg_status libfoo >'libfoo unknown'
@@ -81,8 +94,121 @@ EOE
$* --existing 2>>/~%EOE%;
%initialized existing configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
+ EOE
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+}
+
+: name
+:
+{
+ test.arguments += -d cfg
+
+ : valid
+ :
+ {
+ $* --name foo 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
+ info: name: foo
EOE
+ # @@ To verify the result use cfg-list, when implemented.
+ #
$pkg_status libfoo >'libfoo unknown'
}
+
+ : invalid
+ :
+ : Also use the short option.
+ :
+ $* --name 123 2>>EOE != 0
+ error: invalid --name option value '123': illegal first character (must be alphabetic or underscore)
+ EOE
+}
+
+: type
+:
+{
+ test.arguments += -d cfg
+
+ : valid
+ :
+ {
+ $* --type host 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: host
+ EOE
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+
+ : invalid
+ :
+ : Also use the short option.
+ :
+ $* --type '' 2>>EOE != 0
+ error: empty --type option value
+ EOE
+}
+
+: uuid
+:
+{
+ test.arguments += -d cfg
+
+ : valid
+ :
+ {
+ $* --config-uuid '18f48b4b-b5d9-4712-b98c-1930df1c4228' 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ info: uuid: 18f48b4b-b5d9-4712-b98c-1930df1c4228
+ info: type: target
+ EOE
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+
+ : invalid
+ :
+ : Also use the short option.
+ :
+ $* --config-uuid '123' 2>>EOE != 0
+ error: invalid value '123' for option '--config-uuid'
+ EOE
+}
+
+: associate-host-config
+:
+{
+ test.arguments += -d cfg
+
+ : valid-type
+ :
+ {
+ $cfg_create -d host --type 'host' &host/***;
+
+ $* --host-config host 2>>/~%EOE% &cfg/***;
+ %created new configuration in .+/cfg/%
+ % info: uuid: .{36}%
+ info: type: target
+ EOE
+
+ $pkg_status libfoo >'libfoo unknown'
+ }
+
+ : invalid-type
+ :
+ {
+ $cfg_create -d host &host/***;
+
+ $* --host-config host 2>>/~%EOE% != 0
+ %error: host configuration .+/host/ is of 'target' type%
+ EOE
+ }
}
diff --git a/tests/common.testscript b/tests/common.testscript
index 5db8c6a..4593d11 100644
--- a/tests/common.testscript
+++ b/tests/common.testscript
@@ -32,6 +32,7 @@ test.options += --default-options $options_guard \
# (for example, to make sure that configuration post-test state is valid and is
# as expected).
#
+cfg_add = $* cfg-add
cfg_create = $* cfg-create
pkg_build = $* pkg-build
pkg_checkout = $* pkg-checkout
diff --git a/tests/common/associated/t7a/foo-1.0.0.tar.gz b/tests/common/associated/t7a/foo-1.0.0.tar.gz
new file mode 100644
index 0000000..100496d
--- /dev/null
+++ b/tests/common/associated/t7a/foo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7a/libbar-1.0.0.tar.gz b/tests/common/associated/t7a/libbar-1.0.0.tar.gz
new file mode 100644
index 0000000..21940a3
--- /dev/null
+++ b/tests/common/associated/t7a/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7a/libbaz-1.0.0.tar.gz b/tests/common/associated/t7a/libbaz-1.0.0.tar.gz
new file mode 100644
index 0000000..723ac32
--- /dev/null
+++ b/tests/common/associated/t7a/libbaz-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7a/libbox-1.0.0.tar.gz b/tests/common/associated/t7a/libbox-1.0.0.tar.gz
new file mode 100644
index 0000000..7c293e0
--- /dev/null
+++ b/tests/common/associated/t7a/libbox-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7a/libfix-1.0.0.tar.gz b/tests/common/associated/t7a/libfix-1.0.0.tar.gz
new file mode 100644
index 0000000..471a75f
--- /dev/null
+++ b/tests/common/associated/t7a/libfix-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7a/repositories.manifest b/tests/common/associated/t7a/repositories.manifest
new file mode 100644
index 0000000..5b70556
--- /dev/null
+++ b/tests/common/associated/t7a/repositories.manifest
@@ -0,0 +1 @@
+: 1
diff --git a/tests/common/associated/t7b/foo-1.1.0.tar.gz b/tests/common/associated/t7b/foo-1.1.0.tar.gz
new file mode 100644
index 0000000..aa929fb
--- /dev/null
+++ b/tests/common/associated/t7b/foo-1.1.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7b/libbar-1.1.0.tar.gz b/tests/common/associated/t7b/libbar-1.1.0.tar.gz
new file mode 100644
index 0000000..9926348
--- /dev/null
+++ b/tests/common/associated/t7b/libbar-1.1.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7b/libbaz-1.1.0.tar.gz b/tests/common/associated/t7b/libbaz-1.1.0.tar.gz
new file mode 100644
index 0000000..6b12460
--- /dev/null
+++ b/tests/common/associated/t7b/libbaz-1.1.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7b/libbox-1.1.0.tar.gz b/tests/common/associated/t7b/libbox-1.1.0.tar.gz
new file mode 100644
index 0000000..698661d
--- /dev/null
+++ b/tests/common/associated/t7b/libbox-1.1.0.tar.gz
Binary files differ
diff --git a/tests/common/associated/t7b/repositories.manifest b/tests/common/associated/t7b/repositories.manifest
new file mode 100644
index 0000000..aed60ed
--- /dev/null
+++ b/tests/common/associated/t7b/repositories.manifest
@@ -0,0 +1,4 @@
+: 1
+location: ../t7a
+role: complement
+:
diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript
index 50db679..a13d454 100644
--- a/tests/pkg-build.testscript
+++ b/tests/pkg-build.testscript
@@ -113,6 +113,21 @@
# | | `-- root.build
# | `-- *
# |
+# |-- t7a
+# | |-- libbaz-1.0.0.tar.gz
+# | |-- foo-1.0.0.tar.gz -> libbaz ^1.0.0
+# | |-- libbar-1.0.0.tar.gz -> * foo ^1.0.0, libbaz ^1.0.0
+# | |-- libbox-1.0.0.tar.gz -> * foo ^1.0.0, libbaz ^1.0.0
+# | |-- libfix-1.0.0.tar.gz -> libbar ^1.0.0, libbox ^1.0.0
+# | `-- repositories.manifest
+# |
+# |-- t7b -> t7a (complement repository)
+# | |-- libbaz-1.1.0.tar.gz
+# | |-- foo-1.1.0.tar.gz -> libbaz ^1.1.0
+# | |-- libbar-1.1.0.tar.gz -> * foo ^1.1.0, libbaz ^1.0.0
+# | |-- libbox-1.1.0.tar.gz -> * foo ^1.0.0
+# | `-- repositories.manifest
+# |
# `-- git
# |-- libbar.git -> style-basic.git (prerequisite repository)
# |-- libbaz.git
@@ -139,6 +154,8 @@ posix = ($cxx.target.class != 'windows')
cp -r $src/t4e $out/t4e && $rep_create $out/t4e &$out/t4e/packages.manifest
cp -r $src/t5 $out/t5 && $rep_create $out/t5 &$out/t5/packages.manifest
cp -r $src/t6 $out/t6 && $rep_create $out/t6 &$out/t6/packages.manifest
+ cp -r $src/t7a $out/t7a && $rep_create $out/t7a &$out/t7a/packages.manifest
+ cp -r $src/t7b $out/t7b && $rep_create $out/t7b &$out/t7b/packages.manifest
# Create git repositories.
#
@@ -149,6 +166,8 @@ end
config_cxx = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
+cfg_create += 2>!
+cfg_add += 2>!
pkg_configure += -d cfg $config_cxx 2>!
pkg_disfigure += -d cfg
pkg_drop += -d cfg --yes 2>!
@@ -408,6 +427,18 @@ test.options += --no-progress
info: while satisfying libbar/1.0.0
EOE
+ : unknown-dependency-config
+ :
+ : As above but with an associated configuration.
+ :
+ $clone_root_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+ $* $src/libbar-1.0.0.tar.gz +{ --config-id 1 } 2>>~%EOE% != 0
+ %error: unknown dependency libfoo of package libbar \[cfg2.\]%
+ %info: while satisfying libbar/1.0.0 \[cfg2.\]%
+ EOE
+
: t2
:
{
@@ -513,6 +544,21 @@ test.options += --no-progress
EOO
}
+ : latest-config
+ :
+ : As above but with an associated configuration.
+ :
+ {
+ $clone_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+
+ $* libbar/1.1.0 +{ --config-id 1 } >>~%EOO%
+ %new libfoo/1.1.0\+1 \[cfg2.\] \(required by libbar \[cfg2.\]\)%
+ %new libbar/1.1.0 \[cfg2.\]%
+ EOO
+ }
+
: zero
:
{
@@ -755,6 +801,24 @@ test.options += --no-progress
info: while satisfying libbaz/1.1.0
EOE
+ : unable-satisfy-config
+ :
+ : As above but with an associated configuration.
+ :
+ $clone_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+ $* libbaz ?libbar +{ --config-id 1 } libfoo/1.0.0 +{ --config-id 1 } 2>>~%EOE% != 0
+ error: unable to satisfy constraints on package libfoo
+ % info: libbar \[cfg2.\] depends on \(libfoo == 1.1.0\)%
+ info: command line depends on (libfoo == 1.0.0)
+ info: available libfoo/1.1.0
+ info: available libfoo/1.0.0
+ info: explicitly specify libfoo version to manually satisfy both constraints
+ %info: while satisfying libbar/1.1.0 \[cfg2.\]%
+ info: while satisfying libbaz/1.1.0
+ EOE
+
: not-available
:
$clone_cfg;
@@ -832,6 +896,38 @@ test.options += --no-progress
$pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
$pkg_purge libfoo 2>'purged libfoo/1.1.0'
}
+
+ : unable-downgrade-config
+ :
+ : As above but with an associated configuration.
+ :
+ {
+ $clone_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $rep_add -d cfg2 $rep/t4c && $rep_fetch -d cfg2;
+ $cfg_add -d cfg2 cfg;
+ $pkg_fetch libfoo/1.1.0 && $pkg_unpack libfoo && $pkg_configure libfoo;
+ $pkg_fetch libbar/1.1.0 && $pkg_unpack libbar && $pkg_configure libbar;
+
+ $* libfoo-1.2.0.tar.gz 2>>EOE != 0;
+ error: unknown package libfoo-1.2.0.tar.gz
+ EOE
+
+ $* -d cfg2 libfoo/1.0.0 +{ --config-id 1 } 2>>~%EOE% != 0;
+ %error: unable to downgrade package libfoo/1.1.0 \[cfg.\] to 1.0.0%
+ % info: because package libbar \[cfg.\] depends on \(libfoo == 1.1.0\)%
+ info: explicitly request up/downgrade of package libbar
+ info: or explicitly specify package libfoo version to manually satisfy these constraints
+ EOE
+
+ $* libfoo/1.1.0 --keep-unused >'update libfoo/1.1.0';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.1.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
}
: dependent-reconfiguration
@@ -1166,6 +1262,37 @@ test.options += --no-progress
$pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
$pkg_purge libfoo 2>'purged libfoo/1.0.0'
}
+
+ : forcing-upgrade-held-config
+ :
+ : As above but with an associated configuration.
+ :
+ {
+ $clone_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+
+ $* libfoo/1.0.0 +{ --config-id 1 } 2>>~%EOE%;
+ %fetched libfoo/1.0.0 \[cfg2.\]%
+ %unpacked libfoo/1.0.0 \[cfg2.\]%
+ %configured libfoo/1.0.0 \[cfg2.\]%
+ %info: .+ is up to date%
+ %updated libfoo/1.0.0 \[cfg2.\]%
+ EOE
+
+ $pkg_status -d cfg2 libfoo >'!libfoo configured !1.0.0';
+
+ $* libbaz ?libbar +{ --config-id 1 } 2>>~%EOE% != 0;
+ %error: package libbar \[cfg2.\] dependency on \(libfoo == 1.1.0\) is forcing upgrade of libfoo/1.0.0 \[cfg2.\] to 1.1.0%
+ % info: package version libfoo/1.0.0 \[cfg2.\] is held%
+ info: explicitly request version upgrade to continue
+ %info: while satisfying libbar/1.1.0 \[cfg2.\]%
+ info: while satisfying libbaz/1.1.0
+ EOE
+
+ $pkg_disfigure -d cfg2 libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge -d cfg2 libfoo 2>'purged libfoo/1.0.0'
+ }
}
: drop-dependencies
@@ -2280,6 +2407,29 @@ test.options += --no-progress
$pkg_drop libbar
}
+
+ : unsatisfied-config
+ :
+ : As above but with an associated configuration.
+ :
+ {
+ $clone_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+
+ $* libbar/0.0.1 +{ --config-id 1 } 2>!;
+
+ $pkg_status -d cfg2 libbaz >'libbaz configured 0.0.1';
+
+ $* ?libbaz/0.0.3 +{ --config-id 1 } 2>>~%EOE% != 0;
+ %error: package libbaz \[cfg2.\] doesn't satisfy its dependents%
+ % info: libbaz/0.0.3 doesn't satisfy libbar/0.0.1 \[cfg2.\]%
+ EOE
+
+ $pkg_status -d cfg2 libbaz >'libbaz configured 0.0.1';
+
+ $pkg_drop -d cfg2 libbar
+ }
}
: scratch
@@ -2434,7 +2584,7 @@ test.options += --no-progress
: as a dependency, so it is built incrementally.
:
{
- $cfg_create cxx $config_cxx -d cfg 2>- &cfg/***;
+ $cfg_create cxx $config_cxx -d cfg &cfg/***;
# Add libhello as the dir repository.
#
@@ -2853,7 +3003,7 @@ test.options += --no-progress
{
test.arguments += --yes
- +$cfg_create cxx $config_cxx -d cfg 2>- &cfg/***
+ +$cfg_create cxx $config_cxx -d cfg &cfg/***
: direct
:
@@ -2872,6 +3022,27 @@ test.options += --no-progress
EOE
}
+ : direct-config
+ :
+ : As above but with an associated configuration.
+ :
+ {
+ $clone_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+
+ cp -r $src/libfoo-1.1.0/ libfoo;
+ echo "depends: libfoo" >+ libfoo/manifest;
+ $rep_add libfoo --type dir;
+
+ $rep_fetch;
+
+ $* libfoo +{ --config-id 1 } 2>>~%EOE% != 0
+ %error: dependency cycle detected involving package libfoo \[cfg2.\]%
+ % info: libfoo/1.1.0 \[cfg2.\] depends on libfoo/1.1.0 \[cfg2.\]%
+ EOE
+ }
+
: indirect
:
{
@@ -2950,7 +3121,7 @@ test.options += --no-progress
{
test.arguments += --yes
- +$cfg_create cxx $config_cxx -d cfg 2>- &cfg/***
+ +$cfg_create cxx $config_cxx -d cfg &cfg/***
+cp -r $src/libhello-1.0.0 ./libhello
+$rep_add libhello --type dir
+$rep_fetch
@@ -3426,6 +3597,30 @@ test.options += --no-progress
$pkg_drop libfoo
}
+ : no-patch-config
+ :
+ : As above but with an associated configuration.
+ :
+ {
+ $clone_root_cfg;
+ $cfg_create -d cfg2 &cfg2/***;
+ $cfg_add -d cfg cfg2;
+
+ $* "libfoo@$rep/t1" +{ --config-id 1 } --patch 2>>~%EOE%;
+ %.+
+ %configured libfoo/1.0.0 \[cfg2.\]%
+ %info: .+ is up to date%
+ %updated libfoo/1.0.0 \[cfg2.\]%
+ EOE
+
+ $* "libfoo@$rep/t3" +{ --config-id 1 } --patch 2>>~%EOE% != 0;
+ %.+
+ %error: patch version for libfoo/1.0.0 \[cfg2.\] is not found in pkg:build2.org/pkg-build/t3%
+ EOE
+
+ $pkg_drop -d cfg2 libfoo
+ }
+
: package-in-complement
:
{
@@ -3528,7 +3723,7 @@ test.options += --no-progress
: keep-out
:
{
- +$cfg_create cxx $config_cxx -d cfg 2>- &cfg/***
+ +$cfg_create cxx $config_cxx -d cfg &cfg/***
# Build libhello as an external package.
#
@@ -3646,7 +3841,7 @@ test.options += --no-progress
# Distribute using the dedicated configuration to avoid the 'c and cxx
# module toolchain pattern mismatch' warning.
#
- +$cfg_create cxx $config_cxx -d cfg 2>- &cfg/***
+ +$cfg_create cxx $config_cxx -d cfg &cfg/***
+$build 'dist(../../libhello/@./cfg/libhello/)' \
config.dist.root=./ \
@@ -3945,3 +4140,567 @@ else
$pkg_purge style-basic
}
}
+
+: associated-configs
+:
+{
+ : 2-configs
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t4c && $rep_fetch
+
+ : invalid-cfg
+ :
+ {
+ +$clone_cfg
+
+ : config-id
+ :
+ {
+ $clone_cfg;
+ $* libbaz --config-id 1 2>>/EOE != 0
+ error: no configuration with id 1 is associated with cfg/
+ EOE
+ }
+
+ : config-name
+ :
+ {
+ $clone_cfg;
+ $* libbaz --config-name foo 2>>/EOE != 0
+ error: no configuration with name 'foo' is associated with cfg/
+ EOE
+ }
+
+ : config-uuid
+ :
+ {
+ $clone_cfg;
+ $* libbaz --config-uuid '18f48b4b-b5d9-4712-b98c-1930df1c4228' 2>>/EOE != 0
+ error: no configuration with uuid 18f48b4b-b5d9-4712-b98c-1930df1c4228 is associated with cfg/
+ EOE
+ }
+
+ : multiple
+ :
+ {
+ $clone_cfg;
+ $* libbaz --config-id 1 --config-name foo 2>>/EOE != 0
+ error: multiple --config-* specified
+ EOE
+ }
+ }
+
+ : baz
+ :
+ {
+ $clone_cfg;
+ $cfg_create -d cfg-bar-foo &cfg-bar-foo/***;
+ $cfg_add -d cfg cfg-bar-foo;
+
+ $* libbaz ?libbar +{ --config-id 1 } ?libfoo +{ --config-id 1 } 2>>~%EOE%;
+ %fetched libfoo/1.1.0 \[cfg-bar-foo.\]%
+ %unpacked libfoo/1.1.0 \[cfg-bar-foo.\]%
+ %fetched libbar/1.1.0 \[cfg-bar-foo.\]%
+ %unpacked libbar/1.1.0 \[cfg-bar-foo.\]%
+ fetched libbaz/1.1.0
+ unpacked libbaz/1.1.0
+ %configured libfoo/1.1.0 \[cfg-bar-foo.\]%
+ %configured libbar/1.1.0 \[cfg-bar-foo.\]%
+ configured libbaz/1.1.0
+ %info: cfg-bar-foo.+libfoo-1.1.0.+ is up to date%
+ %info: cfg-bar-foo.+libbar-1.1.0.+ is up to date%
+ %info: cfg[^-].+libbaz-1.1.0.+ is up to date%
+ %updated libfoo/1.1.0 \[cfg-bar-foo.\]%
+ %updated libbar/1.1.0 \[cfg-bar-foo.\]%
+ updated libbaz/1.1.0
+ EOE
+
+ $pkg_status -r libbaz >>/EOO;
+ !libbaz configured 1.1.0
+ libbar [cfg-bar-foo/] configured 1.1.0
+ libfoo [cfg-bar-foo/] configured 1.1.0
+ libfoo [cfg-bar-foo/] configured 1.1.0
+ EOO
+
+ $pkg_status -d cfg-bar-foo -r libbar >>EOO;
+ libbar configured 1.1.0
+ libfoo configured 1.1.0
+ EOO
+
+ $pkg_status -d cfg-bar-foo libfoo >'libfoo configured 1.1.0';
+
+ $pkg_drop libbaz;
+
+ $pkg_status libbaz libbar libfoo >>EOO
+ libbaz available 1.1.0
+ libbar available [1.1.0]
+ libfoo available [1.1.0] 1.0.0
+ EOO
+ }
+ }
+
+ : 3-configs
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t4c && $rep_fetch
+
+ : baz
+ :
+ {
+ uuid = '28f48b4b-b5d9-4712-b98c-1930df1c4228';
+
+ $clone_cfg;
+ $cfg_create -d cfg-bar &cfg-bar/***;
+ $cfg_create -d cfg-foo --config-uuid $uuid &cfg-foo/***;
+
+ $cfg_add -d cfg cfg-bar;
+ $cfg_add -d cfg-bar cfg-foo;
+
+ $* libbar@"$rep/t4b" -d cfg-bar ?libfoo +{ --config-id 2 } --trust-yes 2>>~%EOE%;
+ added pkg:build2.org/pkg-build/t4b
+ fetching pkg:build2.org/pkg-build/t4b
+ fetching pkg:build2.org/pkg-build/t4a (prerequisite of pkg:build2.org/pkg-build/t4b)
+ %fetched libfoo/1.1.0 \[cfg-foo.\]%
+ %unpacked libfoo/1.1.0 \[cfg-foo.\]%
+ fetched libbar/1.1.0
+ unpacked libbar/1.1.0
+ %configured libfoo/1.1.0 \[cfg-foo.\]%
+ configured libbar/1.1.0
+ %info: cfg-foo.+libfoo-1.1.0.+ is up to date%
+ %info: cfg-bar.+libbar-1.1.0.+ is up to date%
+ %updated libfoo/1.1.0 \[cfg-foo.\]%
+ updated libbar/1.1.0
+ EOE
+
+ $* libfoo --config-uuid $uuid 2>>~%EOE%;
+ %info: cfg-foo.+libfoo-1.1.0.+ is up to date%
+ %updated libfoo/1.1.0 \[cfg-foo.\]%
+ EOE
+
+ $* libbaz 2>>~%EOE%;
+ fetched libbaz/1.1.0
+ unpacked libbaz/1.1.0
+ configured libbaz/1.1.0
+ %info: cfg[^-].+libbaz-1.1.0.+ is up to date%
+ updated libbaz/1.1.0
+ EOE
+
+ $pkg_status -r >>/EOO;
+ !libbaz configured 1.1.0
+ !libbar [cfg-bar/] configured !1.1.0
+ !libfoo [cfg-foo/] configured 1.1.0
+ !libfoo [cfg-foo/] configured 1.1.0
+ !libbar [cfg-bar/] configured !1.1.0
+ !libfoo [cfg-foo/] configured 1.1.0
+ !libfoo [cfg-foo/] configured 1.1.0
+ EOO
+
+ $pkg_drop libbaz;
+
+ $* ?libfoo --config-uuid $uuid; # Unhold.
+
+ $pkg_status libbaz libbar libfoo >>/EOO;
+ libbaz available 1.1.0
+ !libbar [cfg-bar/] configured !1.1.0
+ libfoo [cfg-foo/] configured 1.1.0
+ EOO
+
+ $* ?libbar +{ --config-id 1 } <'y' 2>>~%EOE%;
+ % drop libfoo/1.1.0 \[cfg-foo.\] \(unused\)%
+ % drop libbar/1.1.0 \[cfg-bar.\] \(unused\)%
+ %continue\? \[Y/n\] disfigured libbar/1.1.0 \[cfg-bar.\]%
+ %disfigured libfoo/1.1.0 \[cfg-foo.\]%
+ %purged libfoo/1.1.0 \[cfg-foo.\]%
+ %purged libbar/1.1.0 \[cfg-bar.\]%
+ EOE
+
+ $pkg_status libbar libfoo >>EOO
+ libbar available [1.1.0]
+ libfoo available [1.1.0] 1.0.0
+ EOO
+ }
+ }
+
+ : buildtime-dep
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t7a && $rep_fetch
+
+ : external-config
+ :
+ {
+ +$clone_cfg
+ +$cfg_create -d cfg2 --type host --name alt-host &cfg2/***
+ +$cfg_add -d cfg cfg2
+
+ : upgrade-dependency
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg2 ./;
+
+ $* libbar <'y' 2>>~%EOE%;
+ % new libbaz/1.0.0 \[cfg2.\] \(required by foo \[cfg2.\]\)%
+ % new foo/1.0.0 \[cfg2.\] \(required by libbar\)%
+ % new libbaz/1.0.0 \(required by libbar\)%
+ new libbar/1.0.0
+ %continue\? \[Y/n\] fetched libbaz/1.0.0 \[cfg2.\]%
+ %unpacked libbaz/1.0.0 \[cfg2.\]%
+ %fetched foo/1.0.0 \[cfg2.\]%
+ %unpacked foo/1.0.0 \[cfg2.\]%
+ fetched libbaz/1.0.0
+ unpacked libbaz/1.0.0
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ %configured libbaz/1.0.0 \[cfg2.\]%
+ %configured foo/1.0.0 \[cfg2.\]%
+ configured libbaz/1.0.0
+ configured libbar/1.0.0
+ %info: .+libbar-1.0.0.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status -r libbar >>/EOO;
+ !libbar configured 1.0.0
+ foo [cfg2/] configured 1.0.0
+ libbaz [cfg2/] configured 1.0.0
+ libbaz configured 1.0.0
+ EOO
+
+ # While at it, make sure that from several available host
+ # configurations the selected package configuration is chosen and we
+ # don't fail with the 'multiple possible host configurations'
+ # diagnostics.
+ #
+ $cfg_create -d cfg3 --type host &cfg3/***;
+ $cfg_add -d cfg cfg3;
+
+ $rep_add $rep/t7b && $rep_fetch;
+
+ $* libbar <'y' 2>>~%EOE%;
+ % upgrade libbaz/1.1.0 \[cfg2.\] \(required by foo \[cfg2.\]\)%
+ % upgrade foo/1.1.0 \[cfg2.\] \(required by libbar\)%
+ upgrade libbar/1.1.0
+ %continue\? \[Y/n\] disfigured libbar/1.0.0%
+ %disfigured foo/1.0.0 \[cfg2.\]%
+ %disfigured libbaz/1.0.0 \[cfg2.\]%
+ %fetched libbaz/1.1.0 \[cfg2.\]%
+ %unpacked libbaz/1.1.0 \[cfg2.\]%
+ %fetched foo/1.1.0 \[cfg2.\]%
+ %unpacked foo/1.1.0 \[cfg2.\]%
+ fetched libbar/1.1.0
+ unpacked libbar/1.1.0
+ %configured libbaz/1.1.0 \[cfg2.\]%
+ %configured foo/1.1.0 \[cfg2.\]%
+ configured libbar/1.1.0
+ %info: .+libbar-1.1.0.+ is up to date%
+ updated libbar/1.1.0
+ EOE
+
+ $pkg_status -r libbar >>/EOO;
+ !libbar configured 1.1.0
+ foo [cfg2/] configured 1.1.0
+ libbaz [cfg2/] configured 1.1.0
+ libbaz configured 1.0.0 available 1.1.0
+ EOO
+
+ # Now upgrade libbaz in cfg/ and downgrade it in cfg2/. Note that
+ # libbaz/1.1.0 doesn't exist in the t7a repository where libbar/1.0.0
+ # belongs to, thus we build it to hold rather than a dependency.
+ #
+ # While at it, test the --config-name option.
+ #
+ $* libbar/1.0.0 libbaz/1.1.0 ?foo/1.0.0 +{ --config-name alt-host } \
+ ?libbaz/1.0.0 +{ --config-id 1 } <'y' 2>>~%EOE%;
+ % downgrade libbaz/1.0.0 \[cfg2.\]%
+ % downgrade foo/1.0.0 \[cfg2.\]%
+ upgrade libbaz/1.1.0
+ downgrade libbar/1.0.0
+ continue? [Y/n] disfigured libbar/1.1.0
+ disfigured libbaz/1.0.0
+ %disfigured foo/1.1.0 \[cfg2.\]%
+ %disfigured libbaz/1.1.0 \[cfg2.\]%
+ %fetched libbaz/1.0.0 \[cfg2.\]%
+ %unpacked libbaz/1.0.0 \[cfg2.\]%
+ %fetched foo/1.0.0 \[cfg2.\]%
+ %unpacked foo/1.0.0 \[cfg2.\]%
+ fetched libbaz/1.1.0
+ unpacked libbaz/1.1.0
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ %configured libbaz/1.0.0 \[cfg2.\]%
+ %configured foo/1.0.0 \[cfg2.\]%
+ configured libbaz/1.1.0
+ configured libbar/1.0.0
+ %info: .+libbaz-1.0.0.+ is up to date%
+ %info: .+foo-1.0.0.+ is up to date%
+ %info: .+libbaz-1.1.0.+ is up to date%
+ %info: .+libbar-1.0.0.+ is up to date%
+ %updated libbaz/1.0.0 \[cfg2.\]%
+ %updated foo/1.0.0 \[cfg2.\]%
+ updated libbaz/1.1.0
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status -r libbar >>/EOO;
+ !libbar configured !1.0.0 available 1.1.0
+ foo [cfg2/] configured !1.0.0 available 1.1.0
+ libbaz [cfg2/] configured !1.0.0 available 1.1.0
+ !libbaz configured !1.1.0
+ EOO
+
+ $pkg_drop libbar libbaz
+ }
+
+ : resolve-host-config
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg2 ./;
+
+ $cfg_create -d cfg3 --type host &cfg3/***;
+ $cfg_add -d cfg cfg3;
+
+ $* libbar 2>>/~%EOE% != 0;
+ error: multiple possible host configurations for build-time dependency (foo ^1.0.0)
+ info: cfg2/
+ info: cfg3/
+ info: use --config-* to select the configuration
+ %info: while satisfying libbar.1.0.0%
+ EOE
+
+ $* libbar ?foo +{ --config-id 2 } --yes 2>!;
+
+ $pkg_status -r libbar >>/EOE;
+ !libbar configured 1.0.0
+ foo [cfg3/] configured 1.0.0
+ libbaz [cfg3/] configured 1.0.0
+ libbaz configured 1.0.0
+ EOE
+
+ $pkg_drop libbar
+ }
+
+ : 3-configs
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg2 ./;
+
+ $cfg_create -d cfg3 --type host &cfg3/***;
+ $cfg_add -d cfg2 cfg3;
+
+ $rep_add -d cfg2 $rep/t7a && $rep_fetch -d cfg2;
+
+ $* -d cfg2 libbaz +{ --config-id 2 } 2>!;
+
+ $* libbar --yes 2>>~%EOE%;
+ %fetched foo/1.0.0 \[cfg2.\]%
+ %unpacked foo/1.0.0 \[cfg2.\]%
+ fetched libbaz/1.0.0
+ unpacked libbaz/1.0.0
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ %configured foo/1.0.0 \[cfg2.\]%
+ configured libbaz/1.0.0
+ configured libbar/1.0.0
+ %info: .+libbar-1.0.0.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status -r libbar >>/EOE;
+ !libbar configured 1.0.0
+ foo [cfg2/] configured 1.0.0
+ !libbaz [cfg3/] configured 1.0.0
+ libbaz configured 1.0.0
+ EOE
+
+ $pkg_drop libbar
+ }
+ }
+
+ : private-config
+ :
+ {
+ $clone_cfg;
+
+ $* libbar <'y' 2>>~%EOE% &cfg/.bpkg/host/***;
+ % new libbaz/1.0.0 \[cfg..bpkg.host.\] \(required by foo \[cfg..bpkg.host.\]\)%
+ % new foo/1.0.0 \[cfg..bpkg.host.\] \(required by libbar\)%
+ % new libbaz/1.0.0 \(required by libbar\)%
+ new libbar/1.0.0
+ %continue\? \[Y/n\] fetched libbaz/1.0.0 \[cfg..bpkg.host.\]%
+ %unpacked libbaz/1.0.0 \[cfg..bpkg.host.\]%
+ %fetched foo/1.0.0 \[cfg..bpkg.host.\]%
+ %unpacked foo/1.0.0 \[cfg..bpkg.host.\]%
+ fetched libbaz/1.0.0
+ unpacked libbaz/1.0.0
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ %configured libbaz/1.0.0 \[cfg..bpkg.host.\]%
+ %configured foo/1.0.0 \[cfg..bpkg.host.\]%
+ configured libbaz/1.0.0
+ configured libbar/1.0.0
+ %info: .+libbar-1.0.0.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status -r libbar >>/EOO;
+ !libbar configured 1.0.0
+ foo [cfg/.bpkg/host/] configured 1.0.0
+ libbaz [cfg/.bpkg/host/] configured 1.0.0
+ libbaz configured 1.0.0
+ EOO
+
+ $rep_add $rep/t7b && $rep_fetch;
+
+ $* libbar <'y' 2>>~%EOE%;
+ % upgrade libbaz/1.1.0 \[cfg..bpkg.host.\] \(required by foo \[cfg..bpkg.host.\]\)%
+ % upgrade foo/1.1.0 \[cfg..bpkg.host.\] \(required by libbar\)%
+ upgrade libbar/1.1.0
+ %continue\? \[Y/n\] disfigured libbar/1.0.0%
+ %disfigured foo/1.0.0 \[cfg..bpkg.host.\]%
+ %disfigured libbaz/1.0.0 \[cfg..bpkg.host.\]%
+ %fetched libbaz/1.1.0 \[cfg..bpkg.host.\]%
+ %unpacked libbaz/1.1.0 \[cfg..bpkg.host.\]%
+ %fetched foo/1.1.0 \[cfg..bpkg.host.\]%
+ %unpacked foo/1.1.0 \[cfg..bpkg.host.\]%
+ fetched libbar/1.1.0
+ unpacked libbar/1.1.0
+ %configured libbaz/1.1.0 \[cfg..bpkg.host.\]%
+ %configured foo/1.1.0 \[cfg..bpkg.host.\]%
+ configured libbar/1.1.0
+ %info: .+libbar-1.1.0.+ is up to date%
+ updated libbar/1.1.0
+ EOE
+
+ $pkg_status -r libbar >>/EOO;
+ !libbar configured 1.1.0
+ foo [cfg/.bpkg/host/] configured 1.1.0
+ libbaz [cfg/.bpkg/host/] configured 1.1.0
+ libbaz configured 1.0.0 available 1.1.0
+ EOO
+
+ $pkg_drop libbar
+ }
+
+ : self-hosted-config
+ :
+ {
+ $cfg_create -d cfg --type host &cfg/***;
+ $rep_add $rep/t7a && $rep_fetch;
+
+ $* libbar <'y' 2>>~%EOE%;
+ new libbaz/1.0.0 (required by foo libbar)
+ new foo/1.0.0 (required by libbar)
+ new libbar/1.0.0
+ continue? [Y/n] fetched libbaz/1.0.0
+ unpacked libbaz/1.0.0
+ fetched foo/1.0.0
+ unpacked foo/1.0.0
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ configured libbaz/1.0.0
+ configured foo/1.0.0
+ configured libbar/1.0.0
+ %info: .+libbar-1.0.0.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status -r libbar >>EOO;
+ !libbar configured 1.0.0
+ foo configured 1.0.0
+ libbaz configured 1.0.0
+ libbaz configured 1.0.0
+ EOO
+
+ $rep_add $rep/t7b && $rep_fetch;
+
+ $* libbar <'y' 2>>~%EOE%;
+ upgrade libbaz/1.1.0 (required by foo libbar)
+ upgrade foo/1.1.0 (required by libbar)
+ upgrade libbar/1.1.0
+ continue? [Y/n] disfigured libbar/1.0.0
+ disfigured foo/1.0.0
+ disfigured libbaz/1.0.0
+ fetched libbaz/1.1.0
+ unpacked libbaz/1.1.0
+ fetched foo/1.1.0
+ unpacked foo/1.1.0
+ fetched libbar/1.1.0
+ unpacked libbar/1.1.0
+ configured libbaz/1.1.0
+ configured foo/1.1.0
+ configured libbar/1.1.0
+ %info: .+libbar-1.1.0.+ is up to date%
+ updated libbar/1.1.0
+ EOE
+
+ $pkg_status -r libbar >>EOO;
+ !libbar configured 1.1.0
+ foo configured 1.1.0
+ libbaz configured 1.1.0
+ libbaz configured 1.1.0
+ EOO
+
+ $pkg_drop libbar
+ }
+ }
+
+ : verify-dependencies
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t7a && $rep_fetch
+
+ : fail
+ :
+ {
+ $cfg_create -d cfg2 &cfg2/***;
+ $rep_add -d cfg2 $rep/t7a && $rep_fetch -d cfg2;
+
+ $cfg_create -d cfg3 &cfg3/***;
+ $rep_add -d cfg3 $rep/t7a && $rep_fetch -d cfg3;
+
+ $* -d cfg2 --yes libbar 2>!;
+ $* -d cfg3 --yes libbox 2>!;
+
+ $clone_cfg;
+ $cfg_add -d cfg cfg2;
+ $cfg_add -d cfg cfg3;
+
+ $* libfix --yes 2>>~%EOE% != 0
+ error: package libbaz indirectly required by libfix/1.0.0 is configured in multiple configurations
+ % info: libbaz/1.0.0 \[cfg3.\]%
+ % info: libbaz/1.0.0 \[cfg2.\]%
+ EOE
+ }
+
+ : succeed
+ :
+ {
+ $cfg_create -d cfg2 &cfg2/***;
+ $rep_add -d cfg2 $rep/t7b && $rep_fetch -d cfg2;
+
+ $cfg_create -d cfg3 &cfg3/***;
+ $rep_add -d cfg3 $rep/t7b && $rep_fetch -d cfg3;
+
+ $* -d cfg2 --yes libbar 2>!;
+ $* -d cfg3 --yes libbox 2>!;
+
+ $clone_cfg;
+ $cfg_add -d cfg cfg2;
+ $cfg_add -d cfg cfg3;
+
+ $* libfix --yes 2>>~%EOE%;
+ fetched libfix/1.0.0
+ unpacked libfix/1.0.0
+ configured libfix/1.0.0
+ %info: .+libfix-1.0.0.+ is up to date%
+ updated libfix/1.0.0
+ EOE
+
+ $pkg_drop libfix
+ }
+ }
+}
diff --git a/tests/pkg-build/t7a b/tests/pkg-build/t7a
new file mode 120000
index 0000000..05d62de
--- /dev/null
+++ b/tests/pkg-build/t7a
@@ -0,0 +1 @@
+../common/associated/t7a \ No newline at end of file
diff --git a/tests/pkg-build/t7b b/tests/pkg-build/t7b
new file mode 120000
index 0000000..31d6d0f
--- /dev/null
+++ b/tests/pkg-build/t7b
@@ -0,0 +1 @@
+../common/associated/t7b \ No newline at end of file
diff --git a/tests/pkg-drop.testscript b/tests/pkg-drop.testscript
index db9cf7c..ff42e58 100644
--- a/tests/pkg-drop.testscript
+++ b/tests/pkg-drop.testscript
@@ -9,16 +9,31 @@
# |-- t4a
# | |-- libfoo-1.1.0.tar.gz
# | `-- repositories.manifest
+# |
# |-- t4b -> t4a (prerequisite repository)
# | |-- libbar-1.1.0.tar.gz -> libfoo == 1.1.0
# | `-- repositories.manifest
+# |
# |-- t4c -> t4b (prerequisite repository)
# | |-- 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
-# |-- libfox-1.0.0.tar.gz
+# |
+# |-- t4d -> t4c (complement)
+# | |-- libbiz-1.0.0.tar.gz -> libfox, libfoo, libbaz
+# | |-- libfox-1.0.0.tar.gz
+# | `-- repositories.manifest
+# |
+# |-- t7a
+# | |-- libbaz-1.0.0.tar.gz
+# | |-- foo-1.0.0.tar.gz -> libbaz ^1.0.0
+# | |-- libbar-1.0.0.tar.gz -> * foo ^1.0.0, libbaz ^1.0.0
+# | `-- repositories.manifest
+# |
+# `-- t7b -> t7a (complement repository)
+# |-- libbaz-1.1.0.tar.gz
+# |-- foo-1.1.0.tar.gz -> libbaz ^1.1.0
+# |-- libbar-1.1.0.tar.gz -> * foo ^1.1.0, libbaz ^1.0.0
# `-- repositories.manifest
# Prepare repositories used by tests if running in the local mode.
@@ -30,8 +45,12 @@
cp -r $src/t4b $out/t4b && $rep_create $out/t4b &$out/t4b/packages.manifest
cp -r $src/t4c $out/t4c && $rep_create $out/t4c &$out/t4c/packages.manifest
cp -r $src/t4d $out/t4d && $rep_create $out/t4d &$out/t4d/packages.manifest
+ cp -r $src/t7a $out/t7a && $rep_create $out/t7a &$out/t7a/packages.manifest
+ cp -r $src/t7b $out/t7b && $rep_create $out/t7b &$out/t7b/packages.manifest
end
+cfg_create += 2>!
+cfg_add += 2>!
pkg_build += -d cfg --yes 2>!
pkg_status += -d cfg
rep_add += -d cfg 2>!
@@ -444,3 +463,234 @@ $* libfoo/1.0.0 2>>~%EOE% != 0
$* libfoo 2>'purged libfoo'
}
+
+: associated-configs
+:
+{
+ : 3-configs
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t4c && $rep_fetch
+
+ +$cfg_create -d cfg-bar &cfg-bar/***
+ +$cfg_create -d cfg-foo &cfg-foo/***
+
+ +$cfg_add -d cfg cfg-bar
+ +$cfg_add -d cfg-bar cfg-foo
+
+ : baz
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg-bar ./;
+ cp -pr ../cfg-foo ./;
+
+ $pkg_build libbar@"$rep/t4b" -d cfg-bar ?libfoo +{ --config-id 2 } --trust-yes 2>!;
+ $pkg_build libbaz 2>!;
+
+ $pkg_build '?libbar' +{ --config-id 1 } 2>!;
+
+ $* libbaz <<EOI 2>>/~%EOE%
+ y
+ y
+ EOI
+ following dependencies were automatically built but will no longer be used:
+ libbar [cfg-bar/]
+ libfoo [cfg-foo/]
+ %drop unused packages\? \[Y.n\] drop libbaz%
+ drop libbar [cfg-bar/]
+ drop libfoo [cfg-foo/]
+ %continue\? \[Y.n\] disfigured libbaz%
+ disfigured libbar [cfg-bar/]
+ disfigured libfoo [cfg-foo/]
+ purged libbaz
+ purged libbar [cfg-bar/]
+ purged libfoo [cfg-foo/]
+ EOE
+ }
+
+ : foo
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg-bar ./;
+ cp -pr ../cfg-foo ./;
+
+ $pkg_build libbar@"$rep/t4b" -d cfg-bar ?libfoo +{ --config-id 2 } --trust-yes 2>!;
+ $pkg_build libbaz 2>!;
+
+ # Make sure that dependents of a package being dropped can be found in
+ # implicitly associated configurations recursively. Note that
+ # configuring libbar as system, we make libbaz an only dependent of
+ # libfoo.
+ #
+ $pkg_build '?sys:libbar' +{ --config-id 1 } 2>!;
+
+ $pkg_status -r libbaz >>/EOO;
+ !libbaz configured 1.1.0
+ libbar [cfg-bar/] configured,system !* available [1.1.0]
+ libfoo [cfg-foo/] configured 1.1.0
+ EOO
+
+ $pkg_status -d cfg-bar -r libbar >>EOO;
+ libbar configured,system !* available 1.1.0
+ EOO
+
+ $pkg_status -d cfg-foo libfoo >'libfoo configured 1.1.0';
+
+ $* -d cfg-foo libfoo <<EOI 2>>/~%EOE%;
+ y
+ y
+ y
+ EOI
+ following dependent packages will have to be dropped as well:
+ libbaz [cfg/] (requires libfoo)
+ %drop dependent packages\? \[y.N\] following dependencies were automatically built but will no longer be used:%
+ sys:libbar [cfg-bar/]
+ %drop unused packages\? \[Y.n\] drop libbaz \[cfg/\]%
+ drop libfoo
+ drop libbar [cfg-bar/]
+ %continue\? \[Y.n\] disfigured libbaz \[cfg/\]%
+ disfigured libfoo
+ purged libbar [cfg-bar/]
+ purged libbaz [cfg/]
+ purged libfoo
+ EOE
+
+ $pkg_status libbaz >'libbaz available 1.1.0';
+ $pkg_status -d cfg-bar libbar >'libbar available 1.1.0';
+ $pkg_status -d cfg-foo libfoo >'libfoo unknown'
+ }
+
+ : bar
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg-bar ./;
+ cp -pr ../cfg-foo ./;
+
+ # Test that if we turn implicit associations into explicit, then all
+ # dependents are still discovered.
+ #
+ $cfg_add -d cfg-bar cfg;
+ $cfg_add -d cfg-foo cfg-bar;
+
+ $pkg_build libbar@"$rep/t4b" -d cfg-bar ?libfoo +{ --config-id 2 } --trust-yes 2>!;
+ $pkg_build libbaz 2>!;
+
+ $pkg_status -r libbaz >>/EOO;
+ !libbaz configured 1.1.0
+ !libbar [cfg-bar/] configured !1.1.0
+ libfoo [cfg-foo/] configured 1.1.0
+ libfoo [cfg-foo/] configured 1.1.0
+ EOO
+
+ $pkg_status -d cfg-bar -r libbar >>/EOO;
+ !libbar configured !1.1.0
+ libfoo [cfg-foo/] configured 1.1.0
+ EOO
+
+ $pkg_status -d cfg-foo libfoo >'libfoo configured 1.1.0';
+
+ $* -d cfg-bar libbar <<EOI 2>>/~%EOE%;
+ y
+ y
+ y
+ EOI
+ following dependent packages will have to be dropped as well:
+ libbaz [cfg/] (requires libbar)
+ %drop dependent packages\? \[y.N\] following dependencies were automatically built but will no longer be used:%
+ libfoo [cfg-foo/]
+ %drop unused packages\? \[Y.n\] drop libbaz \[cfg/\]%
+ drop libbar
+ drop libfoo [cfg-foo/]
+ %continue\? \[Y.n\] disfigured libbaz \[cfg/\]%
+ disfigured libbar
+ disfigured libfoo [cfg-foo/]
+ purged libbaz [cfg/]
+ purged libbar
+ purged libfoo [cfg-foo/]
+ EOE
+
+ $pkg_status libbaz >'libbaz available 1.1.0';
+ $pkg_status -d cfg-bar libbar >'libbar available 1.1.0';
+ $pkg_status -d cfg-foo libfoo >'libfoo unknown'
+ }
+ }
+}
+
+: buildtime-dep
+:
+{
+ +$clone_cfg && $rep_add $rep/t7a && $rep_fetch
+ +$cfg_create -d cfg2 --type host &cfg2/***
+ +$cfg_add -d cfg cfg2
+
+ : drop-dependent
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg2 ./;
+
+ $pkg_build libbar --yes >!;
+
+ $* libbar <<EOI 2>>/~%EOE%;
+ y
+ y
+ EOI
+ following dependencies were automatically built but will no longer be used:
+ foo [cfg2/]
+ libbaz [cfg2/]
+ libbaz
+ %drop unused packages\? \[Y.n\] drop libbar%
+ drop foo [cfg2/]
+ drop libbaz [cfg2/]
+ drop libbaz
+ %continue\? \[Y.n\] disfigured libbar%
+ disfigured foo [cfg2/]
+ disfigured libbaz [cfg2/]
+ disfigured libbaz
+ purged libbar
+ purged foo [cfg2/]
+ purged libbaz [cfg2/]
+ purged libbaz
+ EOE
+
+ $pkg_status -r libbar >'libbar available 1.0.0'
+ }
+
+ : drop-dependency
+ :
+ {
+ $clone_cfg;
+ cp -pr ../cfg2 ./;
+
+ $pkg_build libbar --yes >!;
+
+ $* -d cfg2 libbaz <<EOI 2>>/~%EOE%;
+ y
+ y
+ y
+ EOI
+ following dependent packages will have to be dropped as well:
+ foo (requires libbaz)
+ libbar [cfg/] (requires foo)
+ %drop dependent packages\? \[y.N\] following dependencies were automatically built but will no longer be used:%
+ libbaz [cfg/]
+ %drop unused packages\? \[Y.n\] drop libbar \[cfg.\]%
+ drop foo
+ drop libbaz
+ drop libbaz [cfg/]
+ %continue\? \[Y.n\] disfigured libbar \[cfg.\]%
+ disfigured foo
+ disfigured libbaz
+ disfigured libbaz [cfg/]
+ purged libbar [cfg/]
+ purged foo
+ purged libbaz
+ purged libbaz [cfg/]
+ EOE
+
+ $pkg_status -r libbar >'libbar available 1.0.0'
+ }
+}
diff --git a/tests/pkg-drop/t7a b/tests/pkg-drop/t7a
new file mode 120000
index 0000000..05d62de
--- /dev/null
+++ b/tests/pkg-drop/t7a
@@ -0,0 +1 @@
+../common/associated/t7a \ No newline at end of file
diff --git a/tests/pkg-drop/t7b b/tests/pkg-drop/t7b
new file mode 120000
index 0000000..31d6d0f
--- /dev/null
+++ b/tests/pkg-drop/t7b
@@ -0,0 +1 @@
+../common/associated/t7b \ No newline at end of file