This is an archive of the discontinued LLVM Phabricator instance.

[lit] Multiple build outputs and default target bitness
ClosedPublic

Authored by zturner on Dec 3 2018, 12:06 PM.

Details

Summary

This patch introduces two improvements to the build.py script.

First, it supports multiple build inputs and outputs. This is helpful if you want to run with mode=compile but you want to compile many source files at once. Now, you can specify an output directory and it will write all of them to that location.

Second, it changes the default architecture of test executables to be whatever the system is.

Both of these will help with porting DIA PDB tests over to the new build script, but are also generally useful features that most tests will probably want anyway.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner created this revision.Dec 3 2018, 12:06 PM

What is the reason we aren't using cmake + ninja for this kind of stuff? Or is it using it under the covers?

What is the reason we aren't using cmake + ninja for this kind of stuff? Or is it using it under the covers?

CMake gives you a nice static configuration for how you want to build your host toolchain, but that doesn't always match up with how you want to build your test inferiors. You might even have a situation where two test inferiors need to be built with different toolchains than each other. I think dotest has a lot of the same issues here, that's why we use the Makefile system over there.

Eventually, we will want to be able to decouple the test suite from the local build entirely, so that you could invoke it from the command line similar to how you can currently invoke dotest from the command line. This would allow running the test suite multiple times with different toolchains or settings, which wouldn't be possible if there's a single upfront configuration done at CMake time.

It's also nice for test reproducibility to be able to look at a test and see the extact reproducer, e.g. (run this command line to build, then run lldb in this way and it repros).

lldb/lit/helper/build.py
664 ↗(On Diff #176447)

Why not? It makes sense that the test might still need to know and/or specify the name of the binary that was produced. The script could require that both -o and --outdir are specified, but I think -o is still needed.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 4 2018, 1:51 PM
This revision was automatically updated to reflect the committed changes.

LLDB :: BuildScript/toolchain-clang-cl.test is failing on Linux.

2018-12-05T17:59:42.1570845Z Command Output (stderr):
2018-12-05T17:59:42.1582271Z --
2018-12-05T17:59:42.1593369Z Traceback (most recent call last):
2018-12-05T17:59:42.1604689Z   File "/home/e2admin/vstsdrive/_work/51/s/llvm/tools/lldb/lit/helper/build.py", line 723, in <module>
2018-12-05T17:59:42.1615962Z     build(cmds)
2018-12-05T17:59:42.1627379Z   File "/home/e2admin/vstsdrive/_work/51/s/llvm/tools/lldb/lit/helper/build.py", line 621, in build
2018-12-05T17:59:42.1794738Z     print_environment(env)
2018-12-05T17:59:42.1806250Z   File "/home/e2admin/vstsdrive/_work/51/s/llvm/tools/lldb/lit/helper/build.py", line 154, in print_environment
2018-12-05T17:59:42.1817473Z     for e in env:
2018-12-05T17:59:42.1837821Z TypeError: 'NoneType' object is not iterable
2018-12-05T17:59:42.1850161Z /home/e2admin/vstsdrive/_work/51/s/llvm/tools/lldb/lit/BuildScript/toolchain-clang-cl.test:13:11: error: CHECK-32: expected string not found in input
2018-12-05T17:59:42.1861865Z CHECK-32: Output: {{.*}}toolchain-clang-cl.test.tmp\foo.exe
2018-12-05T17:59:42.1872878Z           ^
2018-12-05T17:59:42.1883892Z <stdin>:5:2: note: scanning from here
2018-12-05T17:59:42.1895337Z  Output: /home/e2admin/vstsdrive/_work/51/b/LLVMBuild/tools/lldb/lit/BuildScript/Output/toolchain-clang-cl.test.tmp/foo.exe
2018-12-05T17:59:42.1906629Z  ^
2018-12-05T17:59:42.1917610Z <stdin>:5:82: note: possible intended match here
2018-12-05T17:59:42.1929075Z  Output: /home/e2admin/vstsdrive/_work/51/b/LLVMBuild/tools/lldb/lit/BuildScript/Output/toolchain-clang-cl.test.tmp/foo.exe
2018-12-05T17:59:42.1940723Z                                                                                  ^
2018-12-05T17:59:42.1946391Z 
2018-12-05T17:59:42.1957310Z --