Skip to content

Commit

Permalink
Add 'runner' option to ament_add_gmock / nose (#177)
Browse files Browse the repository at this point in the history
* Add 'runner' option to ament_add_gmock

Signed-off-by: Pete Baughman <pete.baughman@apex.ai>

* Give ament_add_nose ability to specify a different runner, too

Signed-off-by: Pete Baughman <pete.baughman@apex.ai>
  • Loading branch information
Peter Baughman authored and dirk-thomas committed Jun 11, 2019
1 parent 5918ede commit 996fc38
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion ament_cmake_gmock/cmake/ament_add_gmock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# :type target: string
# :param ARGN: the list of source files
# :type ARGN: list of strings
# :param RUNNER: the path to the test runner script (default: see ament_add_test).
# :type RUNNER: string
# :param TIMEOUT: the test timeout in seconds,
# default defined by ``ament_add_test()``
# :type TIMEOUT: integer
Expand Down Expand Up @@ -54,7 +56,7 @@ endmacro()
function(_ament_add_gmock target)
cmake_parse_arguments(ARG
"SKIP_LINKING_MAIN_LIBRARIES;SKIP_TEST"
"TIMEOUT;WORKING_DIRECTORY"
"RUNNER;TIMEOUT;WORKING_DIRECTORY"
"APPEND_ENV;APPEND_LIBRARY_DIRS;ENV"
${ARGN})
if(NOT ARG_UNPARSED_ARGUMENTS)
Expand Down Expand Up @@ -88,6 +90,9 @@ function(_ament_add_gmock target)
if(ARG_SKIP_TEST)
set(ARG_SKIP_TEST "SKIP_TEST")
endif()
if(ARG_RUNNER)
set(ARG_RUNNER "RUNNER" ${ARG_RUNNER})
endif()
if(ARG_TIMEOUT)
set(ARG_TIMEOUT "TIMEOUT" ${ARG_TIMEOUT})
endif()
Expand All @@ -100,6 +105,7 @@ function(_ament_add_gmock target)
COMMAND ${cmd}
OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_gmock/${target}.txt"
RESULT_FILE "${result_file}"
${ARG_RUNNER}
${ARG_ENV}
${ARG_APPEND_ENV}
${ARG_APPEND_LIBRARY_DIRS}
Expand Down
8 changes: 7 additions & 1 deletion ament_cmake_nose/cmake/ament_add_nose_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
# :param PYTHON_EXECUTABLE: absolute path to the executable used to run the test,
# default to the CMake variable with the same name returned by FindPythonInterp
# :type PYTHON_EXECUTABLE: string
# :param RUNNER: the path to the test runner script (default: see ament_add_test).
# :type RUNNER: string
# :param TIMEOUT: the test timeout in seconds,
# default defined by ``ament_add_test()``
# :type TIMEOUT: integer
Expand Down Expand Up @@ -52,7 +54,7 @@ endmacro()
function(_ament_add_nose_test testname path)
cmake_parse_arguments(ARG
"SKIP_TEST"
"PYTHON_EXECUTABLE;TIMEOUT;WORKING_DIRECTORY"
"PYTHON_EXECUTABLE;RUNNER;TIMEOUT;WORKING_DIRECTORY"
"APPEND_ENV;APPEND_LIBRARY_DIRS;ENV"
${ARGN})
if(ARG_UNPARSED_ARGUMENTS)
Expand Down Expand Up @@ -105,6 +107,9 @@ function(_ament_add_nose_test testname path)
if(ARG_APPEND_LIBRARY_DIRS)
set(ARG_APPEND_LIBRARY_DIRS "APPEND_LIBRARY_DIRS" ${ARG_APPEND_LIBRARY_DIRS})
endif()
if(ARG_RUNNER)
set(ARG_RUNNER "RUNNER" ${ARG_RUNNER})
endif()
if(ARG_TIMEOUT)
set(ARG_TIMEOUT "TIMEOUT" "${ARG_TIMEOUT}")
endif()
Expand All @@ -120,6 +125,7 @@ function(_ament_add_nose_test testname path)
COMMAND ${cmd}
OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_nose/${testname}.txt"
RESULT_FILE "${result_file}"
${ARG_RUNNER}
${ARG_SKIP_TEST}
${ARG_ENV}
${ARG_APPEND_ENV}
Expand Down

0 comments on commit 996fc38

Please sign in to comment.