aboutsummaryrefslogtreecommitdiff
path: root/tests/common.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/common.testscript
parentf727c2b8fe273a12d059826291523060dab4b512 (diff)
Rename .test/test{} to .testscript/testscript{}
Diffstat (limited to 'tests/common.testscript')
-rw-r--r--tests/common.testscript51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/common.testscript b/tests/common.testscript
new file mode 100644
index 0000000..b9739fd
--- /dev/null
+++ b/tests/common.testscript
@@ -0,0 +1,51 @@
+# file : tests/common.testscript
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Commonly-used variables setup and driver command line.
+#
+
+# 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).
+#
+build = $recall($build.path)
+test.options += --build $build
+
+# 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
+# will be to redirect output to the null device for commands that are used for
+# test setup, and to match it for commands being tested or performing teardown
+# (for example, to make sure that configuration post-test state is valid and is
+# as expected).
+#
+cfg_create = $* cfg-create
+pkg_build = $* pkg-build
+pkg_checkout = $* pkg-checkout
+pkg_configure = $* pkg-configure
+pkg_disfigure = $* pkg-disfigure
+pkg_drop = $* pkg-drop
+pkg_fetch = $* pkg-fetch
+pkg_purge = $* pkg-purge
+pkg_status = $* pkg-status
+pkg_unpack = $* pkg-unpack
+pkg_update = $* pkg-update
+rep_add = $* rep-add
+rep_create = $* rep-create
+rep_fetch = $* rep-fetch
+rep_info = $* rep-info
+rep_list = $* rep-list
+rep_remove = $* rep-remove
+
+# All testscripts are named after bpkg commands, for example
+# pkg-verify.testscript. So the testscript scope id is a name of the command
+# being tested.
+#
+cmd = [string] $@
+test.arguments = $cmd
+
+# Each testscript has an associated repository source directory. Its
+# subdirectories are copied by tests to manipulate locally and throw away upon
+# completion.
+#
+src = [dir_path] "$src_base/$@"