aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-12-23 21:10:53 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-01-17 18:45:14 +0300
commit56e0a851185136dbdd6f1eaa75f44da774a61e51 (patch)
treeb2d195419cf20e90bd8663d43c3a8071ed2ebef5 /tests
parentf806768c53361f5404148cd4d216b10421a1288f (diff)
Add support for multiple dependencies in alternative
Diffstat (limited to 'tests')
-rw-r--r--tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gzbin0 -> 373 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gzbin0 -> 350 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gzbin0 -> 360 bytes
-rw-r--r--tests/common/dependency-alternatives/t8a/repositories.manifest1
-rw-r--r--tests/pkg-build.testscript35
l---------tests/pkg-build/t8a1
-rw-r--r--tests/pkg-configure.testscript49
l---------tests/pkg-configure/t8a1
8 files changed, 83 insertions, 4 deletions
diff --git a/tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz
new file mode 100644
index 0000000..bca3658
--- /dev/null
+++ b/tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz
new file mode 100644
index 0000000..ce7f270
--- /dev/null
+++ b/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz
new file mode 100644
index 0000000..1dd802e
--- /dev/null
+++ b/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/dependency-alternatives/t8a/repositories.manifest b/tests/common/dependency-alternatives/t8a/repositories.manifest
new file mode 100644
index 0000000..5b70556
--- /dev/null
+++ b/tests/common/dependency-alternatives/t8a/repositories.manifest
@@ -0,0 +1 @@
+: 1
diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript
index 058a08b..213290d 100644
--- a/tests/pkg-build.testscript
+++ b/tests/pkg-build.testscript
@@ -136,6 +136,12 @@
# | |-- libbox-1.1.0.tar.gz -> * foo ^1.0.0
# | `-- repositories.manifest
# |
+# |-- t8a
+# | |-- foo-1.0.0.tar.gz -> {libbar libbaz} ^1.0.0
+# | |-- libbar-1.0.0.tar.gz
+# | |-- libbaz-1.0.0.tar.gz
+# | `-- repositories.manifest
+# |
# `-- git
# |-- libbar.git -> style-basic.git (prerequisite repository)
# |-- libbaz.git
@@ -164,6 +170,7 @@ posix = ($cxx.target.class != 'windows')
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
+ cp -r $src/t8a $out/t8a && $rep_create $out/t8a &$out/t8a/packages.manifest
# Create git repositories.
#
@@ -2972,6 +2979,34 @@ test.options += --no-progress
-$pkg_drop libbar libbaz libfoo
}
+
+ : alternative
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t8a && $rep_fetch
+
+ : multiple-dependencies
+ :
+ {
+ $clone_cfg;
+
+ $* foo --yes 2>>~%EOE%;
+ fetched libbaz/1.0.0
+ unpacked libbaz/1.0.0
+ fetched libbar/1.0.0
+ unpacked libbar/1.0.0
+ fetched foo/1.0.0
+ unpacked foo/1.0.0
+ configured libbaz/1.0.0
+ configured libbar/1.0.0
+ configured foo/1.0.0
+ %info: .+foo-1.0.0.+ is up to date%
+ updated foo/1.0.0
+ EOE
+
+ $pkg_drop foo
+ }
+ }
}
: dependent
diff --git a/tests/pkg-build/t8a b/tests/pkg-build/t8a
new file mode 120000
index 0000000..8fa2bda
--- /dev/null
+++ b/tests/pkg-build/t8a
@@ -0,0 +1 @@
+../common/dependency-alternatives/t8a/ \ No newline at end of file
diff --git a/tests/pkg-configure.testscript b/tests/pkg-configure.testscript
index 5a7d8aa..eff0a2e 100644
--- a/tests/pkg-configure.testscript
+++ b/tests/pkg-configure.testscript
@@ -35,6 +35,9 @@
# | | |-- driver.cxx
# | | `-- test.out
# | `-- version
+# |
+# |-- t8a (see pkg-build for details)
+# |
# `-- stable
# |-- libbar-1.0.0.tar.gz -> libfoo
# |-- libbar-1.1.0.tar.gz -> libfoo >= 1.1.0
@@ -63,6 +66,8 @@
#
cp -r $src/stable $out/stable
$rep_create $out/stable &$out/stable/packages.manifest
+
+ cp -r $src/t8a $out/t8a && $rep_create $out/t8a &$out/t8a/packages.manifest
end
test.arguments += config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
@@ -280,7 +285,7 @@ if ($posix && "$uid" != '0')
$pkg_fetch libbar/1.0.0 && $pkg_unpack libbar;
$* libbar 2>>EOE != 0;
- error: no configured package satisfies dependency on libfoo
+ error: unable to satisfy dependency on libfoo
EOE
$pkg_status libbar/1.0.0 1>'libbar unpacked 1.0.0';
@@ -288,7 +293,7 @@ if ($posix && "$uid" != '0')
$pkg_unpack libfoo;
$* libbar 2>>EOE != 0;
- error: no configured package satisfies dependency on libfoo
+ error: unable to satisfy dependency on libfoo
EOE
$* libfoo 2>'configured libfoo/1.0.0';
@@ -317,7 +322,7 @@ if ($posix && "$uid" != '0')
$pkg_unpack libbar;
$* libbar 2>>EOE != 0;
- error: no configured package satisfies dependency on libfoo >= 1.1.0
+ error: unable to satisfy dependency on libfoo >= 1.1.0
EOE
$pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
@@ -344,7 +349,7 @@ if ($posix && "$uid" != '0')
$pkg_unpack libbar;
$* libbar 2>>EOE != 0;
- error: no configured package satisfies dependency on libfox | libfoo >= 1.2.0
+ error: unable to satisfy dependency on libfox | libfoo >= 1.2.0
EOE
$pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
@@ -411,3 +416,39 @@ if ($posix && "$uid" != '0')
test -d cfg/libhello != 0
}
}
+
+: dependency-alternatives
+:
+{
+ +$clone_root_cfg && $rep_add $rep/t8a && $rep_fetch --trust-yes
+
+ : multiple-dependencies
+ :
+ {
+ $clone_cfg;
+
+ $pkg_fetch foo/1.0.0 && $pkg_unpack foo;
+
+ $pkg_fetch libbar/1.0.0 && $pkg_unpack libbar;
+ $* libbar 2>!;
+
+ # Make sure that dependent configuration fails if some of the alternative
+ # dependencies is not configured.
+ #
+ $* foo 2>>EOE != 0;
+ error: unable to satisfy dependency on {libbar ^1.0.0 libbaz ^1.0.0}
+ EOE
+
+ $pkg_fetch libbaz/1.0.0 && $pkg_unpack libbaz;
+ $* libbaz 2>!;
+
+ $* foo 2>'configured foo/1.0.0';
+
+ $pkg_disfigure foo 2>!;
+ $pkg_purge foo 2>!;
+ $pkg_disfigure libbaz 2>!;
+ $pkg_purge libbaz 2>!;
+ $pkg_disfigure libbar 2>!;
+ $pkg_purge libbar 2>!
+ }
+}
diff --git a/tests/pkg-configure/t8a b/tests/pkg-configure/t8a
new file mode 120000
index 0000000..8fa2bda
--- /dev/null
+++ b/tests/pkg-configure/t8a
@@ -0,0 +1 @@
+../common/dependency-alternatives/t8a/ \ No newline at end of file