Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/test/Other/codegen-plugin-loading.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: llc -load %llvmshlibdir/../unittests/CodeGen/CGPluginTest/CGTestPlugin%pluginext %s -o - | FileCheck %s
; RUN: llc -load %llvm_obj_root/unittests/CodeGen/CGPluginTest/CGTestPlugin%pluginext %s -o - | FileCheck %s
; REQUIRES: native, system-linux, llvm-dylib

; CHECK: CodeGen Test Pass running on main
Expand Down
1 change: 0 additions & 1 deletion llvm/unittests/CodeGen/CGPluginTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set(LLVM_LINK_COMPONENTS
Core
MC
Target
TargetParser
CodeGen
)

Expand Down
11 changes: 4 additions & 7 deletions llvm/unittests/CodeGen/CGPluginTest/Plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ if (NOT WIN32 AND NOT CYGWIN)
add_llvm_library(CGTestPlugin MODULE BUILDTREE_ONLY
CodeGenTestPass.cpp
Plugin.cpp
)

# Put PLUGIN next to the unit test executable.
set_output_directory(CGTestPlugin
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/../
LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/../
DEPENDS
intrinsics_gen
vt_gen
)
set_target_properties(CGTestPlugin PROPERTIES FOLDER "Tests")

add_dependencies(CGTestPlugin intrinsics_gen vt_gen)
set_target_properties(CGTestPlugin PROPERTIES FOLDER "Tests")
add_dependencies(CGPluginTest CGTestPlugin)
endif ()
17 changes: 1 addition & 16 deletions llvm/unittests/CodeGen/CGPluginTest/PluginTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@

using namespace llvm;

namespace {
void anchor() {}

std::string libPath(const std::string &Name) {
const auto &Argvs = testing::internal::GetArgvs();
const char *Argv0 = Argvs.size() > 0 ? Argvs[0].c_str() : "CGPluginTest";
void *Ptr = (void *)(intptr_t)anchor;
std::string Path = sys::fs::getMainExecutable(Argv0, Ptr);
SmallString<256> Buf{sys::path::parent_path(Path)};
sys::path::append(Buf, (Name + LLVM_PLUGIN_EXT).c_str());
return std::string(Buf.str());
}
} // namespace

namespace llvm {
class CGPluginTests : public testing::Test {
protected:
Expand All @@ -56,8 +42,7 @@ TEST_F(CGPluginTests, LoadPlugin) {
GTEST_SKIP();
#endif

auto PluginPath = libPath("CGTestPlugin");
ASSERT_NE("", PluginPath);
auto PluginPath{std::string{"CGTestPlugin"} + LLVM_PLUGIN_EXT};

std::string Error;
auto Library = sys::DynamicLibrary::getLibrary(PluginPath.c_str(), &Error);
Expand Down