[llvm] r230196 - [orc] Add a trivial unit test to get the ball rolling
David Blaikie
dblaikie at gmail.com
Sun Feb 22 16:36:26 PST 2015
Author: dblaikie
Date: Sun Feb 22 18:36:25 2015
New Revision: 230196
URL: http://llvm.org/viewvc/llvm-project?rev=230196&view=rev
Log:
[orc] Add a trivial unit test to get the ball rolling
I made my best guess at the Makefile, since I don't have a make build.
I'm not sure if it should be valid to add an empty list of things, but
it seemed the sort of degenerate case.
Added:
llvm/trunk/unittests/ExecutionEngine/Orc/
llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt
llvm/trunk/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp
llvm/trunk/unittests/ExecutionEngine/Orc/Makefile
- copied, changed from r230193, llvm/trunk/unittests/ExecutionEngine/Makefile
Modified:
llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
llvm/trunk/unittests/ExecutionEngine/CMakeLists.txt
llvm/trunk/unittests/ExecutionEngine/Makefile
Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h?rev=230196&r1=230195&r2=230196&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Sun Feb 22 18:36:25 2015
@@ -19,6 +19,7 @@
#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Mangler.h"
+#include "llvm/IR/Module.h"
#include "llvm/ADT/StringMap.h"
#include <list>
Modified: llvm/trunk/unittests/ExecutionEngine/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/CMakeLists.txt?rev=230196&r1=230195&r2=230196&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/CMakeLists.txt (original)
+++ llvm/trunk/unittests/ExecutionEngine/CMakeLists.txt Sun Feb 22 18:36:25 2015
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
ExecutionEngine
Interpreter
MC
+ OrcJIT
RuntimeDyld
Support
)
@@ -11,6 +12,8 @@ add_llvm_unittest(ExecutionEngineTests
ExecutionEngineTest.cpp
)
+add_subdirectory(Orc)
+
# Include MCJIT tests only if native arch is a built JIT target.
list(FIND LLVM_TARGETS_TO_BUILD "${LLVM_NATIVE_ARCH}" build_idx)
list(FIND LLVM_TARGETS_WITH_JIT "${LLVM_NATIVE_ARCH}" jit_idx)
Modified: llvm/trunk/unittests/ExecutionEngine/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Makefile?rev=230196&r1=230195&r2=230196&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Makefile (original)
+++ llvm/trunk/unittests/ExecutionEngine/Makefile Sun Feb 22 18:36:25 2015
@@ -13,8 +13,10 @@ LINK_COMPONENTS :=interpreter
include $(LEVEL)/Makefile.config
+PARALLEL_DIRS = Orc
+
ifeq ($(TARGET_HAS_JIT),1)
- PARALLEL_DIRS = MCJIT
+ PARALLEL_DIRS = $(PARALLEL_DIRS) MCJIT
endif
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
Added: llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt?rev=230196&view=auto
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt (added)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/CMakeLists.txt Sun Feb 22 18:36:25 2015
@@ -0,0 +1,8 @@
+set(LLVM_LINK_COMPONENTS
+ Core
+ Support
+ )
+
+add_llvm_unittest(OrcJITTests
+ LazyEmittingLayerTest.cpp
+ )
Added: llvm/trunk/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp?rev=230196&view=auto
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp (added)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp Sun Feb 22 18:36:25 2015
@@ -0,0 +1,30 @@
+//===- LazyEmittingLayerTest.cpp - Unit tests for the lazy emitting layer -===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
+#include "gtest/gtest.h"
+
+namespace {
+
+struct MockBaseLayer {
+ typedef int ModuleSetHandleT;
+ ModuleSetHandleT addModuleSet(std::list<std::unique_ptr<llvm::Module>>,
+ std::unique_ptr<llvm::RTDyldMemoryManager> x) {
+ EXPECT_FALSE(x);
+ return 42;
+ }
+};
+
+TEST(LazyEmittingLayerTest, Empty) {
+ MockBaseLayer M;
+ llvm::orc::LazyEmittingLayer<MockBaseLayer> L(M);
+ L.addModuleSet(std::list<std::unique_ptr<llvm::Module>>(), nullptr);
+}
+
+}
Copied: llvm/trunk/unittests/ExecutionEngine/Orc/Makefile (from r230193, llvm/trunk/unittests/ExecutionEngine/Makefile)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/Orc/Makefile?p2=llvm/trunk/unittests/ExecutionEngine/Orc/Makefile&p1=llvm/trunk/unittests/ExecutionEngine/Makefile&r1=230193&r2=230196&rev=230196&view=diff
==============================================================================
--- llvm/trunk/unittests/ExecutionEngine/Makefile (original)
+++ llvm/trunk/unittests/ExecutionEngine/Orc/Makefile Sun Feb 22 18:36:25 2015
@@ -1,4 +1,4 @@
-##===- unittests/ExecutionEngine/Makefile ------------------*- Makefile -*-===##
+##===- unittests/ExecutionEngine/Orc/Makefile --------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
@@ -7,14 +7,10 @@
#
##===----------------------------------------------------------------------===##
-LEVEL = ../..
-TESTNAME = ExecutionEngine
-LINK_COMPONENTS :=interpreter
+LEVEL = ../../..
+TESTNAME = OrcJIT
+LINK_COMPONENTS := core ipo mcjit orcjit native support
include $(LEVEL)/Makefile.config
-
-ifeq ($(TARGET_HAS_JIT),1)
- PARALLEL_DIRS = MCJIT
-endif
-
include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest
+
More information about the llvm-commits
mailing list