aboutsummaryrefslogtreecommitdiff
path: root/tests/test/script/common.test
blob: 781be305038aff36539e3e796add150110b89c2e (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
# file      : tests/test/script/common.test
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license   : MIT; see accompanying LICENSE file

# Commonly-used build system test project setup and driver command line
# (test module using testscript tests).
#

+mkdir build
+cat <<"EOI" >=build/bootstrap.build
project = test
amalgamation =

using test
EOI

# We assume the specified target if any is in out_base which would be two
# levels up from our working directory.
#
+if! $empty($target)
  cat <<"EOI" >=build/root.build
  target = \$src_root/../../$string([name] $target)
  test{*}: test = \$target
  EOI
end

# The "cat & build" setup: first cat ($c) the testscript, then run build ($b)
# which will execute the testscript. We have to quote stdin because of the
# command line re-expansion.
#
# Note that the buildfile is clever hack that relies on the first target
# automatically becoming dir{./}'s prerequisite.
#
c = cat >=testscript
b = $0 --jobs 1 --quiet --buildfile - test <"'test{testscript}: \$target'" \
&?test/***