diff options
author | dmauro <dmauro@google.com> | 2020-11-11 17:52:39 (GMT) |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2020-11-12 18:32:03 (GMT) |
commit | 336fd36fee0e95a28a6f5f8ea77e36a2eb7c583e (patch) | |
tree | db62773c4bfb562bd100f300c49306e88cc9940e /googletest | |
parent | b4999a1e2ba8afad6f76e7bb2d16c9abaeb9411e (diff) | |
download | googletest-336fd36fee0e95a28a6f5f8ea77e36a2eb7c583e.zip googletest-336fd36fee0e95a28a6f5f8ea77e36a2eb7c583e.tar.gz googletest-336fd36fee0e95a28a6f5f8ea77e36a2eb7c583e.tar.bz2 |
Googletest export
Rollback change from
https://github.com/google/googletest/pull/1836. This change generates
a script on Windows to actually run each test, but the script itself
doesn't correctly report if the test passed.
This change will "break tests" that were already broken on Windows,
but weren't being reported as such.
PiperOrigin-RevId: 341850671
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/CMakeLists.txt | 14 | ||||
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 45 |
2 files changed, 9 insertions, 50 deletions
diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index cf63c60..5e546ec 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -184,20 +184,6 @@ if (gtest_build_tests) # 'make test' or ctest. enable_testing() - if (WIN32) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1" - CONTENT -"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\" -$env:Path = \"$project_bin;$env:Path\" -& $args") - elseif (MINGW OR CYGWIN) - file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1" - CONTENT -"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin) -$env:Path = \"$project_bin;$env:Path\" -& $args") - endif() - ############################################################ # C++ tests built with standard compiler flags. diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index b3e8b81..2a05f01 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -252,13 +252,7 @@ find_package(PythonInterp) # from the given source files with the given compiler flags. function(cxx_test_with_flags name cxx_flags libs) cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN}) - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND "powershell" "-Command" "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1" "$<TARGET_FILE:${name}>") - else() - add_test(NAME ${name} - COMMAND "$<TARGET_FILE:${name}>") - endif() + add_test(NAME ${name} COMMAND "$<TARGET_FILE:${name}>") endfunction() # cxx_test(name libs srcs...) @@ -282,45 +276,24 @@ function(py_test name) # Multi-configuration build generators as for Visual Studio save # output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug, # Release etc.), so we have to provide it here. - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> ${ARGN}) - else() - add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + add_test(NAME ${name} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG> ${ARGN}) - endif() else (CMAKE_CONFIGURATION_TYPES) # Single-configuration build generators like Makefile generators # don't have subdirs below CMAKE_CURRENT_BINARY_DIR. - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) - else() - add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) - endif() + add_test(NAME ${name} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) endif (CMAKE_CONFIGURATION_TYPES) else() # ${CMAKE_CURRENT_BINARY_DIR} is known at configuration time, so we can # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known # only at ctest runtime (by calling ctest -c <Configuration>), so # we have to escape $ to delay variable substitution here. - if (WIN32 OR MINGW) - add_test(NAME ${name} - COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) - else() - add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py - --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) - endif() + add_test(NAME ${name} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) endif() endif(PYTHONINTERP_FOUND) endfunction() |