blob: f532d76ced9de4678ea1f0cb5ac01f4136354684 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# file : tests/common.test
# 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). Note that 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 or updated by a command being tested.
#
build = $recall($build.path)
test.options += --build $build
# Check that git version is the minimum supported one or above. The lowest
# common denominator for bdep commands is 2.1.
#
+git --version | set git_version_out
+echo "$git_version_out" | sed -n -e 's/git version (\d+\.\d+\.\d+).*/\1/p' | \
set git_version
+if ("$git_version" == "")
exit "unable to obtain git version from '$git_version_out'"
end
+echo "$git_version" | sed -e 's/(\d+).*/\1/' | set git_version_major
+echo "$git_version" | sed -e 's/\d+\.(\d+).*/\1/' | set git_version_minor
# This flag must be used by testscripts to decide if they should skip git
# repository-related tests or adjust bdep commands. Note that specific command
# tests may still adjust this flag to express the higher requirements for the
# minimum supported git version.
#
git_supported = ($git_version_major > 2 || \
$git_version_major == 2 && $git_version_minor >= 1)
# 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 --no-checks --vcs ($git_supported ? git : none)
status = $* status
sync = $* sync
update = $* update
config = $* config
publish = $* publish
# 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
|