aboutsummaryrefslogtreecommitdiff
path: root/tests/common.test
blob: 8578f5cef5c49a2ccb9f5b3212f9d5d826343cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# file      : tests/common.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

# Commonly-used variables setup and driver command line.
#

# Variables for supporting Windows/POSIX testscript variants.
#
win32 = ($cxx.target.class == 'windows')
exe   = ($win32 ? '.exe' : '')

# 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). This implies that we don't
# support cross-testing.
#
# A common approach will be to run build2 as a sanity check in a directory
# produced/updated by a command being tested.
#
build = $recall($build.path)
test.options += --build $build

# @@ It would be nice to query bdep for the bpkg path it uses.
#
bpkg = ("$config.bdep.test.bpkg" != '' ? "$config.bdep.test.bpkg" : "bpkg$exe")

# 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).
#
clean  = $* clean
deinit = $* deinit
init   = $* init
fetch  = $* fetch
new    = $* new
status = $* status
sync   = $* sync
update = $* update

# All testscripts are named after bdep commands, for example sync.test. So the
# testscript scope id is a name of the command being tested.
#
cmd = [string] $@
test.arguments = $cmd