Skip to content

Commit d9db435

Browse files
Add --build-tool-options to pass options to make/ninja/etc. (#25)
7688741 stopped us always using make but in the process removed the "-k" flag. This flag causes make to carry on even when some targets fail. This is very important for running the test suite in CI. Without it, a single build failure marks thousands of subsequent programs as missing, as if they too had failed to compile. If I deliberately break a single source test the results currently are: ``` Total Discovered Tests: 3424 Passed : 378 (11.04%) Executable Missing: 3046 (88.96%) Import succeeded. ``` This is what they should be: ``` Executable Missing Tests (1): test-suite :: SingleSource/UnitTests/2003-04-22-Switch.test Total Discovered Tests: 3424 Passed : 3423 (99.97%) Executable Missing: 1 (0.03%) Import succeeded. ``` cmake --build does not have its own -k option, so we have to pass it after -- to the native tool. Unfortunately ninja's -k takes a number, so ninja -k 0 is equivalent to make -k. Therefore we can't just always add "-- -k" here. Instead I've added a new option --build-tool-options where you can pass any arguments you want. The build bots will use this to pass "-k" to make, as we know for sure they use make. Anything using ninja will also want to pass "-k 0" to get the same effect.
1 parent f987c12 commit d9db435

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

docs/quickstart.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ command. The information below should be enough to get you started, but see the
7272
The ``SANDBOX`` value is a path to where the test suite build products and
7373
results will be stored (inside a timestamped directory, by default).
7474

75+
We recommend adding ``--build-tool-options "-k"`` (if you are using ``make``)
76+
or ``--build-tool-options "-k 0"`` (if you are using ``ninja``). This ensures
77+
that the build tool carries on building even if there is a compilation
78+
failure in one of the tests. Without these options, every test after the
79+
compilation failure will not be compiled and will be reported as a missing
80+
executable.
81+
7582
#. On most systems, the execution time results will be a bit noisy. There are
7683
a range of things you can do to reduce noisiness (with LNT runtest test-suite
7784
command line options when available between brackets):

lnt/tests/test_suite.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,8 @@ def _build(self, path):
580580
'--build', '.',
581581
'-t', target,
582582
'-j', str(self._build_threads())] +
583-
([] if self.opts.succinct else ["-v"]),
583+
([] if self.opts.succinct else ["-v"]) +
584+
["--"] + shlex.split(self.opts.build_tool_options),
584585
cwd=subdir)
585586
except subprocess.CalledProcessError:
586587
# cmake is expected to exit with code 1 if there was any build
@@ -1168,6 +1169,9 @@ def diagnose(self):
11681169
@click.option("--use-make", "make", metavar="PATH",
11691170
type=click.UNPROCESSED,
11701171
help="Path to the build system tool [make/ninja/...]")
1172+
@click.option("--build-tool-options",
1173+
help="Options to pass to the build system tool",
1174+
type=click.UNPROCESSED)
11711175
@click.option("--use-lit", "lit", metavar="PATH", type=click.UNPROCESSED,
11721176
default="llvm-lit",
11731177
help="Path to the LIT test runner [llvm-lit]")

0 commit comments

Comments
 (0)