Commit 1556596d authored by Jordan Yates's avatar Jordan Yates Committed by Benjamin Cabé
Browse files

cmake: unittest: add `-t run` support

Add support to run unit tests directly from `west build`, for
environments where `west build -t run-test` (which runs the binary under
valgrind) is inappropriate or unavailable (WSL).

`west build -t run` also has the muscle-memory advantage of being the
same target name as the `native_sim` boards.

Signed-off-by: default avatarJordan Yates <jordan@embeint.com>
parent 03eb4791
Loading
Loading
Loading
Loading
+7 −0
Changes for cmake/modules/unittest.cmake: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -162,6 +162,13 @@ if(VALGRIND_PROGRAM)
    )
endif()

add_custom_target(run
  COMMAND
  $<TARGET_FILE:testbinary>
  DEPENDS testbinary
  WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
  )

add_custom_target(run-test
  COMMAND
  ${VALGRIND} ${VALGRIND_FLAGS}