[llvm] r370812 - Skip MCJIT unit tests if LLVM is not configured for native compilation

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 12:30:45 PDT 2019


Author: dblaikie
Date: Tue Sep  3 12:30:45 2019
New Revision: 370812

URL: http://llvm.org/viewvc/llvm-project?rev=370812&view=rev
Log:
Skip MCJIT unit tests if LLVM is not configured for native compilation

Patch by Sergej Jaskiewicz!

Differential Revision: D67089

Modified:
    llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h

Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h?rev=370812&r1=370811&r2=370812&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h (original)
+++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h Tue Sep  3 12:30:45 2019
@@ -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);




More information about the llvm-commits mailing list