Skip to content

Commit 1deea3b

Browse files
committed
Make unittest skip if X86 backend is not built.
1 parent b9dcf9a commit 1deea3b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

llvm/unittests/CodeGen/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ add_llvm_unittest(CodeGenTests
4747
TargetOptionsTest.cpp
4848
TestAsmPrinter.cpp
4949
MLRegAllocDevelopmentFeatures.cpp
50+
X86MCInstLowerTest.cpp
5051
)
5152

5253
add_subdirectory(GlobalISel)

llvm/unittests/CodeGen/X86MCInstLowerTest.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ namespace llvm {
2929
class X86MCInstLowerTest : public testing::Test {
3030
protected:
3131
static void SetUpTestCase() {
32-
LLVMInitializeX86TargetMC();
33-
LLVMInitializeX86Target();
32+
//LLVMInitializeX86TargetInfo();
33+
//LLVMInitializeX86TargetMC();
34+
//LLVMInitializeX86Target();
35+
//LLVMInitializeX86AsmPrinter();
36+
InitializeAllTargetMCs();
37+
InitializeAllTargetInfos();
38+
InitializeAllTargets();
39+
InitializeAllAsmPrinters();
3440
}
3541

3642
// Function to setup codegen pipeline and returns the AsmPrinter.
@@ -96,6 +102,7 @@ class X86MCInstLowerTest : public testing::Test {
96102
Triple TargetTriple("x86_64--");
97103
std::string Error;
98104
const Target *T = TargetRegistry::lookupTarget("", TargetTriple, Error);
105+
// Skip the test if target is not built.
99106
if (!T)
100107
GTEST_SKIP();
101108

@@ -109,8 +116,6 @@ class X86MCInstLowerTest : public testing::Test {
109116
if (!TM)
110117
GTEST_SKIP();
111118

112-
LLVMInitializeX86AsmPrinter();
113-
114119
SMDiagnostic SMError;
115120

116121
// Parse the module.

0 commit comments

Comments
 (0)