[PATCH] D66834: Driver tests: set `--sysroot` to "" to support toolchains with default sysroot

Sergej Jaskiewicz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 27 15:08:04 PDT 2019


broadwaylamb created this revision.
broadwaylamb added reviewers: rsmith, sfantao, sepavloff.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

When testing clang that has been compiled with `-DDEFAULT_SYSROOT` set to some path,
the test `VFSGCCInstallation` would fail, because the search always starts either
in the default sysroot (which doesn't exist in the just-created in-memory VFS), or in
`${CLANG_BINARY_DIR}/../lib`, while the virtual GCC installation is in
`${CLANG_BINARY_DIR}/../usr/lib`.

Override sysroot to be empty string for the test to succeed.

(Note that a very similar test `VFSGCCInstallationRelativeDir` was passing because
the GCC installation was, in fact, in `${CLANG_BINARY_DIR}/../lib`.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66834

Files:
  clang/unittests/Driver/ToolChainTest.cpp


Index: clang/unittests/Driver/ToolChainTest.cpp
===================================================================
--- clang/unittests/Driver/ToolChainTest.cpp
+++ clang/unittests/Driver/ToolChainTest.cpp
@@ -60,7 +60,7 @@
                                 llvm::MemoryBuffer::getMemBuffer("\n"));
 
   std::unique_ptr<Compilation> C(TheDriver.BuildCompilation(
-      {"-fsyntax-only", "--gcc-toolchain=", "foo.cpp"}));
+      {"-fsyntax-only", "--gcc-toolchain=", "--sysroot=", "foo.cpp"}));
   EXPECT_TRUE(C);
 
   std::string S;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66834.217507.patch
Type: text/x-patch
Size: 533 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190827/fad208be/attachment.bin>


More information about the cfe-commits mailing list