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
This commit is contained in:
parent
b4999a1e2b
commit
336fd36fee
@ -138,20 +138,6 @@ if (gmock_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()
|
||||
|
||||
if (MINGW OR CYGWIN)
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
add_compile_options("-Wa,-mbig-obj")
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
add_test(NAME ${name}
|
||||
COMMAND ${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
|
||||
--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()
|
||||
|
Loading…
Reference in New Issue
Block a user