aboutsummaryrefslogtreecommitdiff
path: root/tests/pkg-checkout.testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-09-04 14:02:11 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-04 14:02:11 +0300
commitf8fdb500cc705e2b8b4a74166ceb2c6d8cee3fd3 (patch)
tree3f94b0b79ebad275904b9dc4a4165326ff598492 /tests/pkg-checkout.testscript
parentf727c2b8fe273a12d059826291523060dab4b512 (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/pkg-checkout.testscript')
-rw-r--r--tests/pkg-checkout.testscript105
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/pkg-checkout.testscript b/tests/pkg-checkout.testscript
new file mode 100644
index 0000000..d279eb4
--- /dev/null
+++ b/tests/pkg-checkout.testscript
@@ -0,0 +1,105 @@
+# file : tests/pkg-checkout.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.testscript config.testscript remote-git.testscript
+
+# Source repository:
+#
+# pkg-checkout
+# `-- git
+# |-- libbar.git -> style-basic.git (prerequisite)
+# `-- style-basic.git
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ # Create git repositories.
+ #
+ $git_extract $src/git/libbar.tar
+ $git_extract $src/git/style-basic0.tar &$out_git/state0/***
+ $git_extract $src/git/style-basic1.tar &$out_git/state1/***
+end
+
+: git-rep
+:
+if ($git_supported != true)
+{
+ # Skip git repository tests.
+ #
+}
+else
+{
+ rep = "$rep_git/state0"
+
+ rep_add += -d cfg 2>!
+ rep_fetch += -d cfg 2>!
+ pkg_configure += -d cfg 2>!
+ pkg_disfigure += -d cfg 2>!
+ pkg_purge += -d cfg 2>!
+ pkg_status += -d cfg
+
+ test.cleanups += &cfg/.bpkg/repos/*/***
+
+ : unconfigured-dependency
+ :
+ $clone_root_cfg;
+ $rep_add "$rep/libbar.git#master";
+ $rep_fetch;
+
+ $* libmbar/1.0.0 2>>EOE != 0
+ error: no configured package satisfies dependency on style-basic >= 1.0.0
+ EOE
+
+ : configured-dependency
+ :
+ $clone_root_cfg;
+ $rep_add "$rep/libbar.git#master" && $rep_add "$rep/style-basic.git#master";
+ $rep_fetch;
+
+ $pkg_status style-basic | sed -n -e 's/style-basic available \[.+\] ([^ ]+)/\1/p' | set v;
+
+ $* "style-basic/$v" 2>>"EOE";
+ distributing style-basic/$v
+ checked out style-basic/$v
+ EOE
+
+ $pkg_configure style-basic;
+
+ $* libmbar/1.0.0 2>>EOE;
+ distributing libmbar/1.0.0
+ checked out libmbar/1.0.0
+ EOE
+
+ $pkg_disfigure style-basic;
+
+ $pkg_purge libmbar;
+ $pkg_purge style-basic
+
+ : replacement
+ :
+ # @@ Reduce to a single repository when multiple revisions can be specified
+ # in the repository URL fragment.
+ #
+ rep0 = "$rep_git/state0";
+ rep1 = "$rep_git/state1";
+
+ $clone_root_cfg;
+ $rep_add "$rep0/style-basic.git#master";
+ $rep_add "$rep1/style-basic.git#stable";
+ $rep_fetch;
+
+ $pkg_status style-basic | \
+ sed -n -e 's/style-basic available ([^ ]+) +([^ ]+)/\1 \2/p' | set vs;
+
+ echo "$vs" | sed -e 's/([^ ]+).+/\1/' | set v0;
+ echo "$vs" | sed -e 's/([^ ]+) +([^ ]+)/\2/' | set v1;
+
+ $* "style-basic/$v0" 2>!;
+ $pkg_status style-basic >~"/style-basic unpacked $v0/";
+
+ $* --replace "style-basic/$v1" 2>!;
+ $pkg_status style-basic >~"/style-basic unpacked $v1 .+/";
+
+ $pkg_purge style-basic
+}