aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Driver/ToolChainTest.cpp
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2022-10-21 11:36:37 +0200
committerTimm Bäder <tbaeder@redhat.com>2022-10-26 07:29:32 +0200
commit4a5184f4c357eeafcced3371cd8539fa0ac9f24d (patch)
tree9ef6f231a0e1e6e7d53e3747dc8c35c5d582ac39 /clang/unittests/Driver/ToolChainTest.cpp
parent3a0b6101c68928ada6c1220a8521eff41491f6a5 (diff)
downloadllvm-4a5184f4c357eeafcced3371cd8539fa0ac9f24d.zip
llvm-4a5184f4c357eeafcced3371cd8539fa0ac9f24d.tar.gz
llvm-4a5184f4c357eeafcced3371cd8539fa0ac9f24d.tar.bz2
[clang][driver] Remove dynamic gcc-toolset/devtoolset logic
This breaks when the newest available devtoolset directory is not a complete toolset: https://github.com/llvm/llvm-project/issues/57843 Remove this again in favor or just adding the two new directories for devtoolset/gcc-toolset 12. This reverts commit 35aaf548237a4f213ba9d95de53b33c5ce1eadce. This reverts commit 9f97720268911abae2ad9d90e270358db234a1c1. Fixes https://github.com/llvm/llvm-project/issues/57843 Differential Revision: https://reviews.llvm.org/D136435
Diffstat (limited to 'clang/unittests/Driver/ToolChainTest.cpp')
-rw-r--r--clang/unittests/Driver/ToolChainTest.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp
index a9ac309..10b20a9 100644
--- a/clang/unittests/Driver/ToolChainTest.cpp
+++ b/clang/unittests/Driver/ToolChainTest.cpp
@@ -20,7 +20,6 @@
#include "clang/Frontend/CompilerInstance.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/MC/TargetRegistry.h"
-#include "llvm/Support/Host.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
@@ -394,96 +393,6 @@ struct SimpleDiagnosticConsumer : public DiagnosticConsumer {
std::vector<SmallString<32>> Errors;
};
-TEST(ToolChainTest, Toolsets) {
- // Ignore this test on Windows hosts.
- llvm::Triple Host(llvm::sys::getProcessTriple());
- if (Host.isOSWindows())
- GTEST_SKIP();
-
- IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
- IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
-
- // Check (newer) GCC toolset installation.
- {
- IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
- new llvm::vfs::InMemoryFileSystem);
-
- // These should be ignored.
- InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-2", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
- InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
- InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
- InMemoryFileSystem->addFile("/opt/rh/gcc-toolset--1", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
-
- // File needed for GCC installation detection.
- InMemoryFileSystem->addFile("/opt/rh/gcc-toolset-12/root/usr/lib/gcc/"
- "x86_64-redhat-linux/11/crtbegin.o",
- 0, llvm::MemoryBuffer::getMemBuffer("\n"));
-
- DiagnosticsEngine Diags(DiagID, &*DiagOpts, new SimpleDiagnosticConsumer);
- Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
- "clang LLVM compiler", InMemoryFileSystem);
- std::unique_ptr<Compilation> C(
- TheDriver.BuildCompilation({"clang", "--gcc-toolchain="}));
- ASSERT_TRUE(C);
- std::string S;
- {
- llvm::raw_string_ostream OS(S);
- C->getDefaultToolChain().printVerboseInfo(OS);
- }
- EXPECT_EQ("Found candidate GCC installation: "
- "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
- "Selected GCC installation: "
- "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
- "Candidate multilib: .;@m64\n"
- "Selected multilib: .;@m64\n",
- S);
- }
-
- // And older devtoolset.
- {
- IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem(
- new llvm::vfs::InMemoryFileSystem);
-
- // These should be ignored.
- InMemoryFileSystem->addFile("/opt/rh/devtoolset-2", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
- InMemoryFileSystem->addFile("/opt/rh/devtoolset-", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
- InMemoryFileSystem->addFile("/opt/rh/devtoolset--", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
- InMemoryFileSystem->addFile("/opt/rh/devtoolset--1", 0,
- llvm::MemoryBuffer::getMemBuffer("\n"));
-
- // File needed for GCC installation detection.
- InMemoryFileSystem->addFile("/opt/rh/devtoolset-12/root/usr/lib/gcc/"
- "x86_64-redhat-linux/11/crtbegin.o",
- 0, llvm::MemoryBuffer::getMemBuffer("\n"));
-
- DiagnosticsEngine Diags(DiagID, &*DiagOpts, new SimpleDiagnosticConsumer);
- Driver TheDriver("/bin/clang", "x86_64-redhat-linux", Diags,
- "clang LLVM compiler", InMemoryFileSystem);
- std::unique_ptr<Compilation> C(
- TheDriver.BuildCompilation({"clang", "--gcc-toolchain="}));
- ASSERT_TRUE(C);
- std::string S;
- {
- llvm::raw_string_ostream OS(S);
- C->getDefaultToolChain().printVerboseInfo(OS);
- }
- EXPECT_EQ("Found candidate GCC installation: "
- "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
- "Selected GCC installation: "
- "/opt/rh/devtoolset-12/root/usr/lib/gcc/x86_64-redhat-linux/11\n"
- "Candidate multilib: .;@m64\n"
- "Selected multilib: .;@m64\n",
- S);
- }
-}
-
TEST(ToolChainTest, ConfigFileSearch) {
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts = new DiagnosticOptions();
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());