aboutsummaryrefslogtreecommitdiff
path: root/tests/pkg-clean.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-clean.testscript
parentf727c2b8fe273a12d059826291523060dab4b512 (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/pkg-clean.testscript')
-rw-r--r--tests/pkg-clean.testscript136
1 files changed, 136 insertions, 0 deletions
diff --git a/tests/pkg-clean.testscript b/tests/pkg-clean.testscript
new file mode 100644
index 0000000..0c05557
--- /dev/null
+++ b/tests/pkg-clean.testscript
@@ -0,0 +1,136 @@
+# file : tests/pkg-clean.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.testscript auth.testscript config.testscript remote.testscript
+
+# Source repository:
+#
+# pkg-clean
+# |-- hello
+# | |-- libhello-1.0.0.tar.gz
+# | `-- repositories.manifest
+# `-- 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.
+#
++if ($remote != true)
+ rep_create += 2>!
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories.manifest
+
+ $rep_create --key $key $out/hello &$out/hello/packages.manifest \
+ &$out/hello/signature.manifest
+end
+
+pkg_configure += -d cfg "config.cxx=$config.cxx" 2>!
+pkg_disfigure += -d cfg
+pkg_fetch += -d cfg 2>!
+pkg_purge += -d cfg
+pkg_unpack += -d cfg 2>!
+pkg_update += -d cfg 2>!
+rep_add += -d cfg 2>!
+rep_fetch += -d cfg --auth all 2>!
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-clean' for more information
+ EOE
+
+: fetched
+:
+{
+ +$clone_cfg
+ +$rep_add $rep/hello
+ +$rep_fetch --trust $cert_fp &cfg/.bpkg/certs/**
+
+ : no-such-package
+ :
+ $clone_cfg;
+ $* libhello 2>>/EOE != 0
+ error: package libhello does not exist in configuration cfg/
+ EOE
+
+ : wrong-state
+ :
+ {
+ $clone_cfg && $pkg_fetch libhello/1.0.0;
+
+ $* libhello 2>>EOE != 0;
+ error: package libhello is fetched
+ info: expected it to be configured
+ EOE
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+
+ : src-eq-out
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libhello/1.0.0 && $pkg_unpack libhello;
+ $pkg_configure libhello && $pkg_update libhello;
+
+ $* libhello 2>>~%EOE%;
+ %rm .+%{6}
+ cleaned libhello/1.0.0
+ EOE
+
+ $* libhello 2>>~%EOE%;
+ %info: .+ is clean%
+ cleaned libhello/1.0.0
+ EOE
+
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+}
+
+: src-ne-out
+:
+{
+ $clone_cfg;
+ $pkg_unpack -e $src/libhello-1.0.0;
+ $pkg_configure libhello && $pkg_update libhello;
+
+ $* libhello 2>>~%EOE%;
+ %rm .+%{8}
+ cleaned libhello/1.0.0
+ EOE
+
+ $* libhello 2>>~%EOE%;
+ %info: .+ is clean%
+ cleaned libhello/1.0.0
+ EOE
+
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+}