zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.97k stars 6.68k forks source link

support user-provided ports in puncover target #30678

Open pabigot opened 3 years ago

pabigot commented 3 years ago

The puncover report custom target hard-codes a list of arguments. It would be nice to be able to specify the port on which the server will run, so that we can simultaneously interact with multiple builds to assess their differences.

My cmake-fu is not up to this. It could be something like

--- a/cmake/reports/CMakeLists.txt
+++ b/cmake/reports/CMakeLists.txt
@@ -22,6 +22,10 @@ endforeach()
 find_program(PUNCOVER puncover)

 if(NOT ${PUNCOVER} STREQUAL PUNCOVER-NOTFOUND)
+  unset($PUNCOVER_ARGS)
+  if(DEFINED $ENV{PUNCOVER_PORT})
+    list(APPEND PUNCOVER_ARGS --port $ENV{PUNCOVER_PORT})
+  endif()
   add_custom_target(
     puncover
     ${PUNCOVER}
@@ -29,6 +33,7 @@ if(NOT ${PUNCOVER} STREQUAL PUNCOVER-NOTFOUND)
     --gcc_tools_base ${CROSS_COMPILE}
     --src_root       ${ZEPHYR_BASE}
     --build_dir      ${CMAKE_BINARY_DIR}
+    ${PUNCOVER_ARGS}
     DEPENDS ${logical_target_for_zephyr_elf}
             $<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

which doesn't work.

katyo commented 3 years ago

@pabigot @nashif I also have a problem with puncover default port (see https://github.com/HBehrens/puncover/issues/44) So it will be nice to get ability to set port manually from cmd-line or via env-var.