test(lint): a compiler installed in a directory of its own
LintCompilerHeaders stages an installation of its own: the toolchain's compiler copied into install/bin, beside links to the rest of the real installation, and one header more in its c++/v1, crafter_issue46.h. The toolchain it points the build at with CRAFTER_BUILD_LLVM_DIR has a bin/clang++ that links to that copy, and no include directory. The compiler runs from install/bin, so the compile of a file that includes <algorithm> and crafter_issue46.h finds both, and the build's scan of the file and lint's parse of it have to as well. Without the lint fix the parse fails on crafter_issue46.h on a host whose /usr has a libc++, and on <algorithm> in crafter-build's Flatpak, whose /usr has none. It fails in the same two ways with argv[0] taken from the compile command, llvm/bin/clang++. Without the scan fix the scan, given llvm/bin/clang++ as well, fails the same two ways, and the build with it, which the test's first check reports. The compiler is copied because a link would lead clang back to the real installation, and the copy is of the clang++ in the directory `clang++ --version` names, so that a wrapper on PATH that runs the compiler is not copied in its place. The test takes CRAFTER_BUILD_LIBCXX_DIR out of its environment, which would have every compile take that libc++ in place of the staged one, and the std module the staged toolchain builds goes to a cache of its own. It skips where it cannot stage the compiler: where no clang++ is found, the compiler's installation has no libc++ headers of its own, no llvm-ar or clang-scan-deps is beside the compiler, or the copy names no resource directory it has. A second configuration on the same toolchain passes -no-canonical-prefixes, with which the compiler takes itself to be in llvm/bin, as written, and reads the clang++.cfg the test writes there, which adds a directory only it names; its file includes the one header that directory holds, and none of the C++ standard library, which llvm/ has no include directory for. Given install/bin/clang++ whatever the command's prefix flags, the scan fails on that header, and the build with it, and so does the parse. The test takes CLANG_NO_DEFAULT_CONFIG out of its environment as well, which would have clang read no configuration file, and where the compile with the flag still does not read the file beside the link, as where a user or system configuration directory holds a clang++.cfg, or a <triple>-clang++.cfg, that clang finds first, it leaves the second configuration out and skips, unless the first configuration failed.
This commit is contained in:
parent
090d8f6363
commit
043b1a3015
2 changed files with 236 additions and 0 deletions
|
|
@ -352,6 +352,7 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
|
|||
cfg.AddTest("SourceScan").Dependencies({ CrafterBuildLib.get() });
|
||||
cfg.AddTest("BuildAll").Dependencies({ CrafterBuildLib.get() });
|
||||
cfg.AddTest("Lint").Dependencies({ CrafterBuildLib.get() });
|
||||
cfg.AddTest("LintCompilerHeaders").Dependencies({ CrafterBuildLib.get() });
|
||||
}
|
||||
|
||||
// Dogfood: the lite house rules, imported from their own repo through
|
||||
|
|
|
|||
Loading…
Reference in a new issue