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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to