3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/bpftrace/disable-gtests.patch
2018-10-28 14:33:37 +10:00

74 lines
2.2 KiB
Diff

From 221eea24674fffb3b657b2bd0c923071b69d48a7 Mon Sep 17 00:00:00 2001
From: Rodney Lorrimar <dev@rodney.id.au>
Date: Tue, 16 Oct 2018 09:56:47 +1000
Subject: [PATCH 2/3] Disable tests
Would prefer to use gtest library in the normal way rather through
ExternalProject.
---
CMakeLists.txt | 4 ++--
tests/CMakeLists.txt | 18 +++++++++++-------
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b20fb33..7025d17 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ add_compile_options("-Wno-format-security")
#add_compile_options("-Wstrict-overflow=5")
#add_compile_options("-Wdisabled-optimization")
-enable_testing()
+# enable_testing()
if (OFFLINE_BUILDS)
include(ExternalProject)
@@ -79,7 +79,7 @@ include_directories(${CLANG_INCLUDE_DIRS})
add_subdirectory(src/arch)
add_subdirectory(src/ast)
add_subdirectory(src)
-add_subdirectory(tests)
+# add_subdirectory(tests)
add_subdirectory(resources)
add_subdirectory(tools)
add_subdirectory(man)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c283efa..6b5bff0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -45,6 +45,8 @@ if (OFFLINE_BUILDS)
EXCLUDE_FROM_ALL 1
UPDATE_DISCONNECTED 1
)
+elseif (NIX_BUILDS)
+
else()
include(ExternalProject)
ExternalProject_Add(gtest-git
@@ -54,13 +56,15 @@ else()
EXCLUDE_FROM_ALL 1
)
endif()
-add_dependencies(bpftrace_test gtest-git-build)
-ExternalProject_Get_Property(gtest-git source_dir binary_dir)
-target_include_directories(bpftrace_test PUBLIC ${source_dir}/googletest/include)
-target_include_directories(bpftrace_test PUBLIC ${source_dir}/googlemock/include)
-target_link_libraries(bpftrace_test ${binary_dir}/googlemock/gtest/libgtest.a)
-target_link_libraries(bpftrace_test ${binary_dir}/googlemock/gtest/libgtest_main.a)
-target_link_libraries(bpftrace_test ${binary_dir}/googlemock/libgmock.a)
+
+find_library(LIBGTEST "gtest")
+if(LIBGTEST)
+ set(LIBRARY_DEPENDENCIES
+ ${LIBRARY_DEPENDENCIES}
+ ${LIBGTEST}
+ )
+endif()
+
target_link_libraries(bpftrace_test ${CMAKE_THREAD_LIBS_INIT})
add_test(NAME bpftrace_test COMMAND bpftrace_test)
--
2.17.1