[libc-commits] [libc] 7cdda6b - Revert "[cmake] Prefix gtest and gtest_main with "llvm_"."

Stella Laurenzo via libc-commits libc-commits at lists.llvm.org
Wed Mar 2 11:14:42 PST 2022


Author: Stella Laurenzo
Date: 2022-03-02T11:13:46-08:00
New Revision: 7cdda6b8ce49ae3c90c068cff4dc355bba5d77f2

URL: https://github.com/llvm/llvm-project/commit/7cdda6b8ce49ae3c90c068cff4dc355bba5d77f2
DIFF: https://github.com/llvm/llvm-project/commit/7cdda6b8ce49ae3c90c068cff4dc355bba5d77f2.diff

LOG: Revert "[cmake] Prefix gtest and gtest_main with "llvm_"."

lldb buildbot failure. will investigate and roll forward.

This reverts commit 9f37775472b45986b0ecce5243bd6ce119e5bd69.

Added: 
    

Modified: 
    compiler-rt/lib/asan/tests/CMakeLists.txt
    compiler-rt/lib/fuzzer/tests/CMakeLists.txt
    compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
    compiler-rt/lib/interception/tests/CMakeLists.txt
    compiler-rt/lib/msan/tests/CMakeLists.txt
    compiler-rt/lib/orc/unittests/CMakeLists.txt
    compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
    compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
    compiler-rt/lib/tsan/tests/CMakeLists.txt
    compiler-rt/lib/xray/tests/CMakeLists.txt
    flang/CMakeLists.txt
    libc/benchmarks/CMakeLists.txt
    libc/test/utils/tools/CMakeLists.txt
    lldb/unittests/CMakeLists.txt
    llvm/cmake/modules/AddLLVM.cmake
    llvm/lib/Testing/Support/CMakeLists.txt
    llvm/runtimes/CMakeLists.txt
    llvm/unittests/Support/CommandLineInit/CMakeLists.txt
    llvm/utils/unittest/CMakeLists.txt
    llvm/utils/unittest/UnitTestMain/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/tests/CMakeLists.txt b/compiler-rt/lib/asan/tests/CMakeLists.txt
index b2e27f66b7312..047a3fa282c40 100644
--- a/compiler-rt/lib/asan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/asan/tests/CMakeLists.txt
@@ -172,7 +172,7 @@ function(add_asan_tests arch test_runtime)
   function(generate_asan_tests test_objects test_suite testname)
     generate_compiler_rt_tests(${test_objects} ${test_suite} ${testname} ${arch}
       COMPILE_DEPS ${ASAN_UNITTEST_HEADERS} ${ASAN_IGNORELIST_FILE}
-      DEPS llvm_gtest asan
+      DEPS gtest asan
       KIND ${TEST_KIND}
       ${ARGN}
       )

diff  --git a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
index 10fcfbaa083e5..85369990889ec 100644
--- a/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
+++ b/compiler-rt/lib/fuzzer/tests/CMakeLists.txt
@@ -74,7 +74,7 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH)
     FuzzerUnitTests "Fuzzer-${arch}-Test" ${arch}
     SOURCES FuzzerUnittest.cpp ${COMPILER_RT_GTEST_SOURCE}
     RUNTIME ${LIBFUZZER_TEST_RUNTIME}
-    DEPS llvm_gtest ${LIBFUZZER_TEST_RUNTIME_DEPS}
+    DEPS gtest ${LIBFUZZER_TEST_RUNTIME_DEPS} 
     CFLAGS ${LIBFUZZER_UNITTEST_CFLAGS} ${LIBFUZZER_TEST_RUNTIME_CFLAGS}
     LINK_FLAGS ${LIBFUZZER_UNITTEST_LINK_FLAGS} ${LIBFUZZER_TEST_RUNTIME_LINK_FLAGS})
   set_target_properties(FuzzerUnitTests PROPERTIES
@@ -84,7 +84,7 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST FUZZER_SUPPORTED_ARCH)
   generate_compiler_rt_tests(FuzzedDataProviderTestObjects
     FuzzedDataProviderUnitTests "FuzzerUtils-${arch}-Test" ${arch}
     SOURCES FuzzedDataProviderUnittest.cpp ${COMPILER_RT_GTEST_SOURCE}
-    DEPS llvm_gtest ${LIBFUZZER_TEST_RUNTIME_DEPS} ${COMPILER_RT_SOURCE_DIR}/include/fuzzer/FuzzedDataProvider.h
+    DEPS gtest ${LIBFUZZER_TEST_RUNTIME_DEPS} ${COMPILER_RT_SOURCE_DIR}/include/fuzzer/FuzzedDataProvider.h
     CFLAGS ${LIBFUZZER_UNITTEST_CFLAGS} ${LIBFUZZER_TEST_RUNTIME_CFLAGS}
     LINK_FLAGS ${LIBFUZZER_UNITTEST_LINK_FLAGS} ${LIBFUZZER_TEST_RUNTIME_LINK_FLAGS})
   set_target_properties(FuzzedDataProviderUnitTests PROPERTIES

diff  --git a/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt b/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
index 8b4ee7d553b82..abc02a49637cc 100644
--- a/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/gwp_asan/tests/CMakeLists.txt
@@ -66,7 +66,7 @@ if(COMPILER_RT_DEFAULT_TARGET_ARCH IN_LIST GWP_ASAN_SUPPORTED_ARCH)
     GwpAsanUnitTests "GwpAsan-${arch}-Test" ${arch}
     SOURCES ${GWP_ASAN_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
     RUNTIME ${GWP_ASAN_TEST_RUNTIME}
-    DEPS llvm_gtest ${GWP_ASAN_UNIT_TEST_HEADERS}
+    DEPS gtest ${GWP_ASAN_UNIT_TEST_HEADERS}
     CFLAGS ${GWP_ASAN_UNITTEST_CFLAGS}
     LINK_FLAGS ${GWP_ASAN_UNITTEST_LINK_FLAGS})
   set_target_properties(GwpAsanUnitTests PROPERTIES

diff  --git a/compiler-rt/lib/interception/tests/CMakeLists.txt b/compiler-rt/lib/interception/tests/CMakeLists.txt
index 8d5c4abb7af0c..06184ee77447f 100644
--- a/compiler-rt/lib/interception/tests/CMakeLists.txt
+++ b/compiler-rt/lib/interception/tests/CMakeLists.txt
@@ -95,7 +95,7 @@ macro(add_interception_tests_for_arch arch)
     RUNTIME ${INTERCEPTION_COMMON_LIB}
     SOURCES ${INTERCEPTION_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE}
     COMPILE_DEPS ${INTERCEPTION_TEST_HEADERS}
-    DEPS llvm_gtest
+    DEPS gtest
     CFLAGS ${INTERCEPTION_TEST_CFLAGS_COMMON}
     LINK_FLAGS ${INTERCEPTION_TEST_LINK_FLAGS_COMMON})
 endmacro()

diff  --git a/compiler-rt/lib/msan/tests/CMakeLists.txt b/compiler-rt/lib/msan/tests/CMakeLists.txt
index 3ed888b81c6e5..dc8408042bd0b 100644
--- a/compiler-rt/lib/msan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/msan/tests/CMakeLists.txt
@@ -66,7 +66,7 @@ macro(msan_compile obj_list source arch kind cflags)
     ${obj_list} ${source} ${arch}
     KIND ${kind}
     COMPILE_DEPS ${MSAN_UNITTEST_HEADERS}
-    DEPS llvm_gtest msan
+    DEPS gtest msan
     CFLAGS -isystem ${CMAKE_CURRENT_BINARY_DIR}/../libcxx_msan_${arch}/include/c++/v1
            ${MSAN_UNITTEST_INSTRUMENTED_CFLAGS} ${cflags}
   )

diff  --git a/compiler-rt/lib/orc/unittests/CMakeLists.txt b/compiler-rt/lib/orc/unittests/CMakeLists.txt
index 32038dbecf19a..3b492196dd620 100644
--- a/compiler-rt/lib/orc/unittests/CMakeLists.txt
+++ b/compiler-rt/lib/orc/unittests/CMakeLists.txt
@@ -52,7 +52,7 @@ else()
   append_list_if(COMPILER_RT_HAS_LIBEXECINFO -lexecinfo ORC_UNITTEST_LINK_FLAGS)
 endif()
 
-set(ORC_DEPS llvm_gtest orc)
+set(ORC_DEPS gtest orc)
 # ORC uses C++ standard library headers.
 if (TARGET cxx-headers OR HAVE_LIBCXX)
   set(ORC_DEPS cxx-headers)

diff  --git a/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt b/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
index 826bdc3d7c8a2..f536df885abcf 100644
--- a/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
+++ b/compiler-rt/lib/sanitizer_common/tests/CMakeLists.txt
@@ -163,7 +163,7 @@ macro(add_sanitizer_tests_for_arch arch)
     RUNTIME "${SANITIZER_COMMON_LIB}"
     SOURCES ${SANITIZER_UNITTESTS} ${COMPILER_RT_GTEST_SOURCE} ${COMPILER_RT_GMOCK_SOURCE}
     COMPILE_DEPS ${SANITIZER_TEST_HEADERS}
-    DEPS llvm_gtest
+    DEPS gtest
     CFLAGS  ${SANITIZER_TEST_CFLAGS_COMMON} ${extra_flags}
     LINK_FLAGS ${SANITIZER_TEST_LINK_FLAGS_COMMON} ${TARGET_LINK_FLAGS} ${extra_flags})
 

diff  --git a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
index 7be58f424dd68..6d0936cbb5c1e 100644
--- a/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
+++ b/compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt
@@ -73,7 +73,7 @@ macro(add_scudo_unittest testname)
         "${testname}-${arch}-Test" ${arch}
         SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
         COMPILE_DEPS ${SCUDO_TEST_HEADERS}
-        DEPS llvm_gtest scudo_standalone
+        DEPS gtest scudo_standalone
         RUNTIME ${RUNTIME}
         CFLAGS ${SCUDO_UNITTEST_CFLAGS}
         LINK_FLAGS ${LINK_FLAGS})

diff  --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt
index 91702c913592b..0a49c238403f4 100644
--- a/compiler-rt/lib/tsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/tsan/tests/CMakeLists.txt
@@ -62,7 +62,7 @@ foreach (header ${TSAN_HEADERS})
   list(APPEND TSAN_RTL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../${header})
 endforeach()
 
-set(TSAN_DEPS llvm_gtest tsan)
+set(TSAN_DEPS gtest tsan)
 # TSan uses C++ standard library headers.
 if (TARGET cxx-headers OR HAVE_LIBCXX)
   set(TSAN_DEPS cxx-headers)

diff  --git a/compiler-rt/lib/xray/tests/CMakeLists.txt b/compiler-rt/lib/xray/tests/CMakeLists.txt
index 1d698391fe025..99884b05d77e4 100644
--- a/compiler-rt/lib/xray/tests/CMakeLists.txt
+++ b/compiler-rt/lib/xray/tests/CMakeLists.txt
@@ -102,7 +102,7 @@ macro(add_xray_unittest testname)
         ${XRAY_HEADERS} ${XRAY_ALL_SOURCE_FILES_ABS_PATHS}
         "test_helpers.h"
         RUNTIME "${XRAY_RUNTIME_LIBS}"
-        DEPS llvm_gtest xray llvm-xray LLVMXRay LLVMTestingSupport
+        DEPS gtest xray llvm-xray LLVMXRay LLVMTestingSupport
         CFLAGS ${XRAY_UNITTEST_CFLAGS}
         LINK_FLAGS ${TARGET_LINK_FLAGS} ${XRAY_UNITTEST_LINK_FLAGS}
         )

diff  --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index e6ebd26203a10..5caa79e8da477 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -148,12 +148,12 @@ if (FLANG_STANDALONE_BUILD)
   if (FLANG_INCLUDE_TESTS)
     set(UNITTEST_DIR ${LLVM_BUILD_MAIN_SRC_DIR}/utils/unittest)
     if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
-      if (NOT TARGET llvm_gtest)
-        add_library(llvm_gtest
+      if (NOT TARGET gtest)
+        add_library(gtest
           ${UNITTEST_DIR}/googletest/src/gtest-all.cc
           ${UNITTEST_DIR}/googlemock/src/gmock-all.cc
           )
-        target_include_directories(llvm_gtest
+        target_include_directories(gtest
           PUBLIC
           "${UNITTEST_DIR}/googletest/include"
           "${UNITTEST_DIR}/googlemock/include"
@@ -163,9 +163,9 @@ if (FLANG_STANDALONE_BUILD)
           "${UNITTEST_DIR}/googlemock"
           )
          find_package(Threads)
-         target_link_libraries(llvm_gtest PUBLIC Threads::Threads)
-        add_library(llvm_gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp)
-        target_link_libraries(gtest_main PUBLIC llvm_gtest)
+         target_link_libraries(gtest PUBLIC Threads::Threads)
+        add_library(gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp)
+        target_link_libraries(gtest_main PUBLIC gtest)
       endif()
       set(FLANG_GTEST_AVAIL 1)
     else()
@@ -467,7 +467,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     PATTERN "config.h" EXCLUDE
     PATTERN ".git"     EXCLUDE
     PATTERN "CMakeFiles" EXCLUDE)
-
+    
   install(DIRECTORY ${FLANG_INCLUDE_DIR}/flang
     DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
     COMPONENT flang-headers

diff  --git a/libc/benchmarks/CMakeLists.txt b/libc/benchmarks/CMakeLists.txt
index 0e9ec5a1f790c..54f70c4b033e9 100644
--- a/libc/benchmarks/CMakeLists.txt
+++ b/libc/benchmarks/CMakeLists.txt
@@ -25,8 +25,8 @@ function(add_libc_benchmark_unittest target_name)
   )
   target_link_libraries(${target_name}
     PRIVATE
-    llvm_gtest_main
-    llvm_gtest
+    gtest_main
+    gtest
     ${LIBC_BENCHMARKS_UNITTEST_DEPENDS}
   )
   llvm_update_compile_flags(${target_name})

diff  --git a/libc/test/utils/tools/CMakeLists.txt b/libc/test/utils/tools/CMakeLists.txt
index d685f27754cd4..0e343f154eac5 100644
--- a/libc/test/utils/tools/CMakeLists.txt
+++ b/libc/test/utils/tools/CMakeLists.txt
@@ -16,15 +16,15 @@ function(add_libc_tool_unittest target_name)
   )
   target_link_libraries(${target_name}
     PRIVATE
-    llvm_gtest_main
-    llvm_gtest
+    gtest_main
+    gtest
     ${LIBC_TOOL_UNITTEST_DEPENDS}
   )
 
   add_custom_command(
     TARGET ${target_name}
     POST_BUILD
-    COMMAND $<TARGET_FILE:${target_name}>
+    COMMAND $<TARGET_FILE:${target_name}> 
             ${LIBC_TOOL_UNITTEST_ARGS}
   )
   add_dependencies(libc-tool-unittests ${target_name})

diff  --git a/lldb/unittests/CMakeLists.txt b/lldb/unittests/CMakeLists.txt
index 79afbbf1f8f54..e7b0f1c17d6d1 100644
--- a/lldb/unittests/CMakeLists.txt
+++ b/lldb/unittests/CMakeLists.txt
@@ -20,7 +20,7 @@ endif ()
 if (LLDB_BUILT_STANDALONE)
   # Build the gtest library needed for unittests, if we have LLVM sources
   # handy.
-  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET llvm_gtest)
+  if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest AND NOT TARGET gtest)
     add_subdirectory(${LLVM_MAIN_SRC_DIR}/utils/unittest utils/unittest)
   endif()
   # LLVMTestingSupport library is needed for Process/gdb-remote.

diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 6827970254201..37bc98f9e021e 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1502,7 +1502,7 @@ function(add_unittest test_suite test_name)
   # libpthreads overrides some standard library symbols, so main
   # executable must be linked with it in order to provide consistent
   # API for all shared libaries loaded by this executable.
-  target_link_libraries(${test_name} PRIVATE llvm_gtest_main llvm_gtest ${LLVM_PTHREAD_LIB})
+  target_link_libraries(${test_name} PRIVATE gtest_main gtest ${LLVM_PTHREAD_LIB})
 
   add_dependencies(${test_suite} ${test_name})
   get_target_property(test_suite_folder ${test_suite} FOLDER)

diff  --git a/llvm/lib/Testing/Support/CMakeLists.txt b/llvm/lib/Testing/Support/CMakeLists.txt
index 81774eb171caa..1830ea88bb3fa 100644
--- a/llvm/lib/Testing/Support/CMakeLists.txt
+++ b/llvm/lib/Testing/Support/CMakeLists.txt
@@ -12,7 +12,7 @@ add_llvm_library(LLVMTestingSupport
   Support
   )
 
-target_link_libraries(LLVMTestingSupport PRIVATE llvm_gtest)
+target_link_libraries(LLVMTestingSupport PRIVATE gtest)
 
 # This is to avoid the error in gtest-death-test-internal.h
 # (150,16): error: 'Create' overrides a member function but

diff  --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index b99cb377e75a7..11391fa7ed89a 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -480,8 +480,8 @@ if(runtimes)
         obj2yaml
         sancov
         sanstats
-        llvm_gtest_main
-        llvm_gtest
+        gtest_main
+        gtest
       )
     foreach(target ${test_targets} ${SUB_CHECK_TARGETS})
       add_dependencies(${target} ${RUNTIMES_TEST_DEPENDS})

diff  --git a/llvm/unittests/Support/CommandLineInit/CMakeLists.txt b/llvm/unittests/Support/CommandLineInit/CMakeLists.txt
index 1889c8fba9a7a..a69182f646980 100644
--- a/llvm/unittests/Support/CommandLineInit/CMakeLists.txt
+++ b/llvm/unittests/Support/CommandLineInit/CMakeLists.txt
@@ -26,7 +26,7 @@ add_llvm_executable(${test_name}
   IGNORE_EXTERNALIZE_DEBUGINFO NO_INSTALL_RPATH
   CommandLineInitTest.cpp)
 
-target_link_libraries(${test_name} PRIVATE llvm_gtest)
+target_link_libraries(${test_name} PRIVATE gtest)
 
 add_dependencies(${test_suite} ${test_name})
 

diff  --git a/llvm/utils/unittest/CMakeLists.txt b/llvm/utils/unittest/CMakeLists.txt
index 9dd7b5379f308..90037ae2e44bf 100644
--- a/llvm/utils/unittest/CMakeLists.txt
+++ b/llvm/utils/unittest/CMakeLists.txt
@@ -39,7 +39,7 @@ if (LLVM_PTHREAD_LIBRARY_PATH)
   list(APPEND LIBS pthread)
 endif()
 
-add_llvm_library(llvm_gtest
+add_llvm_library(gtest
   googletest/src/gtest-all.cc
   googlemock/src/gmock-all.cc
 
@@ -58,14 +58,14 @@ add_llvm_library(llvm_gtest
 # that warning here for any targets that link to gtest.
 if(CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
   add_definitions("-Wno-suggest-override")
-  set_target_properties(llvm_gtest PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-suggest-override")
+  set_target_properties(gtest PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-suggest-override")
 endif()
 
 if (NOT LLVM_ENABLE_THREADS)
-  target_compile_definitions(llvm_gtest PUBLIC GTEST_HAS_PTHREAD=0)
+  target_compile_definitions(gtest PUBLIC GTEST_HAS_PTHREAD=0)
 endif ()
 
-target_include_directories(llvm_gtest
+target_include_directories(gtest
   PUBLIC googletest/include googlemock/include
   PRIVATE googletest googlemock
   )
@@ -89,5 +89,5 @@ function (gtest_remove_dylib_from_link_interface target)
   endif()
 endfunction()
 
-gtest_remove_dylib_from_link_interface(llvm_gtest)
-gtest_remove_dylib_from_link_interface(llvm_gtest_main)
+gtest_remove_dylib_from_link_interface(gtest)
+gtest_remove_dylib_from_link_interface(gtest_main)

diff  --git a/llvm/utils/unittest/UnitTestMain/CMakeLists.txt b/llvm/utils/unittest/UnitTestMain/CMakeLists.txt
index 7a3ac8a0f43e6..32f0f25a60ffc 100644
--- a/llvm/utils/unittest/UnitTestMain/CMakeLists.txt
+++ b/llvm/utils/unittest/UnitTestMain/CMakeLists.txt
@@ -1,8 +1,8 @@
-add_llvm_library(llvm_gtest_main
+add_llvm_library(gtest_main
   TestMain.cpp
 
   LINK_LIBS
-  llvm_gtest
+  gtest
 
   LINK_COMPONENTS
   Support # Depends on llvm::cl


        


More information about the libc-commits mailing list