diff --git a/tools/cmake/mbed-run-greentea-test.in.cmake b/tools/cmake/mbed-run-greentea-test.in.cmake index 21d34d3..65c343c 100644 --- a/tools/cmake/mbed-run-greentea-test.in.cmake +++ b/tools/cmake/mbed-run-greentea-test.in.cmake @@ -1,6 +1,7 @@ # This file is configured by CMake to create the script used to execute each Greentea test. # First flash the target using its configured Mbed OS upload method +# ----------------------------------------------------------------------- execute_process( # Note: we don't use cmake --build because that performs a reconfigure of the build system each time COMMAND @CMAKE_MAKE_PROGRAM@ flash-@MBED_GREENTEA_TEST_NAME@ @@ -8,7 +9,15 @@ COMMAND_ERROR_IS_FATAL ANY) # Then run and communicate with the test +# ----------------------------------------------------------------------- +set(MBEDHTRUN_ARGS --skip-flashing @MBED_HTRUN_ARGUMENTS@) # filled in by configure script + +# Print out command +string(REPLACE ";" " " MBEDHTRUN_ARGS_FOR_DISPLAY "${MBEDHTRUN_ARGS}") +message("Executing: mbedhtrun ${MBEDHTRUN_ARGS_FOR_DISPLAY}") + +# Note: For this command, we need to survive mbedhtrun not being on the PATH, so we import the package and call the main function using "python -c" execute_process( - COMMAND mbedhtrun --skip-flashing -f @MBED_GREENTEA_TEST_IMAGE_NAME@ @MBED_HTRUN_ARGUMENTS@ + COMMAND @Python3_EXECUTABLE@ -c "import mbed_host_tests.mbedhtrun; mbed_host_tests.mbedhtrun.main()" ${MBEDHTRUN_ARGS} WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@" COMMAND_ERROR_IS_FATAL ANY) \ No newline at end of file diff --git a/tools/cmake/mbed_greentea.cmake b/tools/cmake/mbed_greentea.cmake index 7805292..ad73128 100644 --- a/tools/cmake/mbed_greentea.cmake +++ b/tools/cmake/mbed_greentea.cmake @@ -103,12 +103,6 @@ mbed_set_post_build(${MBED_GREENTEA_TEST_NAME}) - if(NOT ${MBED_OUTPUT_EXT} STREQUAL "") - set(MBED_GREENTEA_TEST_IMAGE_NAME "${MBED_GREENTEA_TEST_NAME}.${MBED_OUTPUT_EXT}") - else() - set(MBED_GREENTEA_TEST_IMAGE_NAME "${MBED_GREENTEA_TEST_NAME}.bin") - endif() - # User can set this cache variable to supply extra arguments to greentea. # such as: -d to set the drive path list(APPEND MBED_HTRUN_ARGUMENTS -p ${MBED_GREENTEA_SERIAL_PORT}) @@ -139,13 +133,6 @@ endif() - list(APPEND CONFIG_DEFS_COPY ${MBED_CONFIG_DEFINITIONS}) - list(FILTER CONFIG_DEFS_COPY INCLUDE REGEX "MBED_CONF_PLATFORM_STDIO_BAUD_RATE") - if(NOT ${CONFIG_DEFS_COPY} STREQUAL "") - string(REGEX MATCH "[0-9]*$" BAUD_RATE ${CONFIG_DEFS_COPY}) - list(APPEND MBED_HTRUN_ARGUMENTS "--baud-rate=${BAUD_RATE}") - endif() - # Configure the CMake script which runs the test. # We have to use a helper script in order to run both the flashing and htrun in one test configure_file(