From: David Blaikie Date: Tue, 3 Sep 2019 19:30:45 +0000 (+0000) Subject: Skip MCJIT unit tests if LLVM is not configured for native compilation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1f841b1ce3d774f0085912af25b8cfb62854820;p=llvm Skip MCJIT unit tests if LLVM is not configured for native compilation Patch by Sergej Jaskiewicz! Differential Revision: D67089 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@370812 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h b/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h index 0f554439ad4..f47de56d3e4 100644 --- a/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h +++ b/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h @@ -21,13 +21,14 @@ #include "llvm/InitializePasses.h" #include "llvm/Support/Host.h" #include "llvm/Support/TargetSelect.h" +#include "llvm/Support/TargetRegistry.h" // Used to skip tests on unsupported architectures and operating systems. // To skip a test, add this macro at the top of a test-case in a suite that // inherits from MCJITTestBase. See MCJITTest.cpp for examples. #define SKIP_UNSUPPORTED_PLATFORM \ do \ - if (!ArchSupportsMCJIT() || !OSSupportsMCJIT()) \ + if (!ArchSupportsMCJIT() || !OSSupportsMCJIT() || !HostCanBeTargeted()) \ return; \ while(0) @@ -52,6 +53,11 @@ protected: HostTriple = Triple::normalize(HostTriple); } + bool HostCanBeTargeted() { + std::string Error; + return TargetRegistry::lookupTarget(HostTriple, Error) != nullptr; + } + /// Returns true if the host architecture is known to support MCJIT bool ArchSupportsMCJIT() { Triple Host(HostTriple);