Changeset View
Changeset View
Standalone View
Standalone View
build_files/cmake/Modules/GTestAddTests.cmake
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | macro(add_command NAME) | ||||
| endif() | endif() | ||||
| # Unsets macro local variables to prevent leakage outside of this macro. | # Unsets macro local variables to prevent leakage outside of this macro. | ||||
| unset(_args) | unset(_args) | ||||
| unset(_script_len) | unset(_script_len) | ||||
| endmacro() | endmacro() | ||||
| function(gtest_discover_tests_impl) | function(gtest_discover_tests_impl) | ||||
| # BLENDER: Add Environment variables argument. | |||||
| cmake_parse_arguments( | cmake_parse_arguments( | ||||
| "" | "" | ||||
| "" | "" | ||||
| "NO_PRETTY_TYPES;NO_PRETTY_VALUES;TEST_EXECUTABLE;TEST_EXECUTOR;TEST_WORKING_DIR;TEST_PREFIX;TEST_SUFFIX;TEST_LIST;CTEST_FILE;TEST_DISCOVERY_TIMEOUT;TEST_XML_OUTPUT_DIR" | "NO_PRETTY_TYPES;NO_PRETTY_VALUES;TEST_EXECUTABLE;TEST_EXECUTOR;TEST_WORKING_DIR;TEST_PREFIX;TEST_SUFFIX;TEST_LIST;CTEST_FILE;TEST_DISCOVERY_TIMEOUT;TEST_XML_OUTPUT_DIR;TEST_ENV_VARS" | ||||
| "TEST_EXTRA_ARGS;TEST_PROPERTIES" | "TEST_EXTRA_ARGS;TEST_PROPERTIES" | ||||
| ${ARGN} | ${ARGN} | ||||
| ) | ) | ||||
| set(prefix "${_TEST_PREFIX}") | set(prefix "${_TEST_PREFIX}") | ||||
| set(suffix "${_TEST_SUFFIX}") | set(suffix "${_TEST_SUFFIX}") | ||||
| set(extra_args ${_TEST_EXTRA_ARGS}) | set(extra_args ${_TEST_EXTRA_ARGS}) | ||||
| set(properties ${_TEST_PROPERTIES}) | set(properties ${_TEST_PROPERTIES}) | ||||
| # BLENDER: Add Environment variables argument. | |||||
sergey: Not sure why stating "BLENDER" brings value here.
Same applies to cases below. | |||||
Done Inline ActionsThat's because the file is a modified copy of a standard GTest file. At the top it states: # Changes made to this script have been marked with "BLENDER". sybren: That's because the file is a modified copy of a standard GTest file. At the top it states:
```… | |||||
| set(environment_vars "${_TEST_ENV_VARS}") | |||||
| set(script) | set(script) | ||||
| set(suite) | set(suite) | ||||
| set(tests) | set(tests) | ||||
| set(tests_buffer) | set(tests_buffer) | ||||
| # Run test executable to get list of available tests | # Run test executable to get list of available tests | ||||
| if(NOT EXISTS "${_TEST_EXECUTABLE}") | if(NOT EXISTS "${_TEST_EXECUTABLE}") | ||||
| message(FATAL_ERROR | message(FATAL_ERROR | ||||
| ▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | if(NOT line MATCHES "gtest_main\\.cc") | ||||
| ${extra_args} | ${extra_args} | ||||
| ) | ) | ||||
| if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") | if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") | ||||
| add_command(set_tests_properties | add_command(set_tests_properties | ||||
| "${testname}" | "${testname}" | ||||
| PROPERTIES DISABLED TRUE | PROPERTIES DISABLED TRUE | ||||
| ) | ) | ||||
| endif() | endif() | ||||
| # BLENDER: Add Environment variables argument. | |||||
| add_command(set_tests_properties | add_command(set_tests_properties | ||||
| "${testname}" | "${testname}" | ||||
| PROPERTIES | PROPERTIES | ||||
| WORKING_DIRECTORY "${_TEST_WORKING_DIR}" | WORKING_DIRECTORY "${_TEST_WORKING_DIR}" | ||||
| SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]" | SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]" | ||||
| ${properties} | ENVIRONMENT "${environment_vars}" | ||||
| ) | ) | ||||
| list(APPEND tests_buffer "${testname}") | list(APPEND tests_buffer "${testname}") | ||||
| list(LENGTH tests_buffer tests_buffer_length) | list(LENGTH tests_buffer tests_buffer_length) | ||||
| if(${tests_buffer_length} GREATER "250") | if(${tests_buffer_length} GREATER "250") | ||||
| flush_tests_buffer() | flush_tests_buffer() | ||||
| endif() | endif() | ||||
| endif() | endif() | ||||
| endif() | endif() | ||||
| endforeach() | endforeach() | ||||
| # Create a list of all discovered tests, which users may use to e.g. set | # Create a list of all discovered tests, which users may use to e.g. set | ||||
| # properties on the tests | # properties on the tests | ||||
| flush_tests_buffer() | flush_tests_buffer() | ||||
| add_command(set ${_TEST_LIST} ${tests}) | add_command(set ${_TEST_LIST} ${tests}) | ||||
| # Write CTest script | # Write CTest script | ||||
| flush_script() | flush_script() | ||||
| endfunction() | endfunction() | ||||
| # BLENDER: Add Environment variables argument. | |||||
| if(CMAKE_SCRIPT_MODE_FILE) | if(CMAKE_SCRIPT_MODE_FILE) | ||||
| gtest_discover_tests_impl( | gtest_discover_tests_impl( | ||||
| NO_PRETTY_TYPES ${NO_PRETTY_TYPES} | NO_PRETTY_TYPES ${NO_PRETTY_TYPES} | ||||
| NO_PRETTY_VALUES ${NO_PRETTY_VALUES} | NO_PRETTY_VALUES ${NO_PRETTY_VALUES} | ||||
| TEST_EXECUTABLE ${TEST_EXECUTABLE} | TEST_EXECUTABLE ${TEST_EXECUTABLE} | ||||
| TEST_EXECUTOR ${TEST_EXECUTOR} | TEST_EXECUTOR ${TEST_EXECUTOR} | ||||
| TEST_WORKING_DIR ${TEST_WORKING_DIR} | TEST_WORKING_DIR ${TEST_WORKING_DIR} | ||||
| TEST_PREFIX ${TEST_PREFIX} | TEST_PREFIX ${TEST_PREFIX} | ||||
| TEST_SUFFIX ${TEST_SUFFIX} | TEST_SUFFIX ${TEST_SUFFIX} | ||||
| TEST_LIST ${TEST_LIST} | TEST_LIST ${TEST_LIST} | ||||
| CTEST_FILE ${CTEST_FILE} | CTEST_FILE ${CTEST_FILE} | ||||
| TEST_DISCOVERY_TIMEOUT ${TEST_DISCOVERY_TIMEOUT} | TEST_DISCOVERY_TIMEOUT ${TEST_DISCOVERY_TIMEOUT} | ||||
| TEST_XML_OUTPUT_DIR ${TEST_XML_OUTPUT_DIR} | TEST_XML_OUTPUT_DIR ${TEST_XML_OUTPUT_DIR} | ||||
| TEST_EXTRA_ARGS ${TEST_EXTRA_ARGS} | TEST_EXTRA_ARGS ${TEST_EXTRA_ARGS} | ||||
| TEST_PROPERTIES ${TEST_PROPERTIES} | TEST_PROPERTIES ${TEST_PROPERTIES} | ||||
| TEST_ENV_VARS ${TEST_ENV_VARS} | |||||
| ) | ) | ||||
| endif() | endif() | ||||
Not sure why stating "BLENDER" brings value here.
Same applies to cases below.