Skip to content

Commit f317dbc

Browse files
author
Jamie Smith
authored
Print the command when a greentea test is being run. Also fix mbedhtrun not being on PATH causing all tests to pass! (#51)
* Print the command when a greentea test is being run. Also fix mbedhtrun not being on PATH causing all tests to pass! * Also remove useless -f argument to mbedhtrun (not used with --skip-flashing)
1 parent 7e5066d commit f317dbc

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# This file is configured by CMake to create the script used to execute each Greentea test.
22

33
# First flash the target using its configured Mbed OS upload method
4+
# -----------------------------------------------------------------------
45
execute_process(
56
# Note: we don't use cmake --build because that performs a reconfigure of the build system each time
67
COMMAND @CMAKE_MAKE_PROGRAM@ flash-@MBED_GREENTEA_TEST_NAME@
78
WORKING_DIRECTORY @CMAKE_BINARY_DIR@
89
COMMAND_ERROR_IS_FATAL ANY)
910

1011
# Then run and communicate with the test
12+
# -----------------------------------------------------------------------
13+
set(MBEDHTRUN_ARGS --skip-flashing @MBED_HTRUN_ARGUMENTS@) # filled in by configure script
14+
15+
# Print out command
16+
string(REPLACE ";" " " MBEDHTRUN_ARGS_FOR_DISPLAY "${MBEDHTRUN_ARGS}")
17+
message("Executing: mbedhtrun ${MBEDHTRUN_ARGS_FOR_DISPLAY}")
18+
19+
# 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"
1120
execute_process(
12-
COMMAND mbedhtrun --skip-flashing -f @MBED_GREENTEA_TEST_IMAGE_NAME@ @MBED_HTRUN_ARGUMENTS@
21+
COMMAND @Python3_EXECUTABLE@ -c "import mbed_host_tests.mbedhtrun; mbed_host_tests.mbedhtrun.main()" ${MBEDHTRUN_ARGS}
1322
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@"
1423
COMMAND_ERROR_IS_FATAL ANY)

tools/cmake/mbed_greentea.cmake

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,6 @@ function(mbed_greentea_add_test)
103103

104104
mbed_set_post_build(${MBED_GREENTEA_TEST_NAME})
105105

106-
if(NOT ${MBED_OUTPUT_EXT} STREQUAL "")
107-
set(MBED_GREENTEA_TEST_IMAGE_NAME "${MBED_GREENTEA_TEST_NAME}.${MBED_OUTPUT_EXT}")
108-
else()
109-
set(MBED_GREENTEA_TEST_IMAGE_NAME "${MBED_GREENTEA_TEST_NAME}.bin")
110-
endif()
111-
112106
# User can set this cache variable to supply extra arguments to greentea.
113107
# such as: -d to set the drive path
114108
list(APPEND MBED_HTRUN_ARGUMENTS -p ${MBED_GREENTEA_SERIAL_PORT})
@@ -139,13 +133,6 @@ function(mbed_greentea_add_test)
139133
endif()
140134

141135

142-
list(APPEND CONFIG_DEFS_COPY ${MBED_CONFIG_DEFINITIONS})
143-
list(FILTER CONFIG_DEFS_COPY INCLUDE REGEX "MBED_CONF_PLATFORM_STDIO_BAUD_RATE")
144-
if(NOT ${CONFIG_DEFS_COPY} STREQUAL "")
145-
string(REGEX MATCH "[0-9]*$" BAUD_RATE ${CONFIG_DEFS_COPY})
146-
list(APPEND MBED_HTRUN_ARGUMENTS "--baud-rate=${BAUD_RATE}")
147-
endif()
148-
149136
# Configure the CMake script which runs the test.
150137
# We have to use a helper script in order to run both the flashing and htrun in one test
151138
configure_file(

0 commit comments

Comments
 (0)