diff --git a/ci-scripts/cls_analysis.py b/ci-scripts/cls_analysis.py index 240a89dc16..46b32bf449 100644 --- a/ci-scripts/cls_analysis.py +++ b/ci-scripts/cls_analysis.py @@ -28,6 +28,23 @@ import json class Analysis(): + def _get_test_description(properties): + env_vars = None + for p in properties: + if p["name"] == "ENVIRONMENT": + env_vars = p["value"] # save for later if no custom property + if p["name"] == "TEST_DESCRIPTION": + return p["value"] + # if we came till here, it means there is no custom test property + # saved in JSON. See if we have a description in environment variables + if not env_vars: + return "" + for ev in env_vars: + name, value = ev.split("=", 1) + if name == "TEST_DESCRIPTION": + return value + return "" + def analyze_physim(result_junit, details_json, logPath): try: tree = ET.parse(result_junit) @@ -60,7 +77,7 @@ class Analysis(): for test in root: # for each test test_name = test.attrib["name"] test_exec = json_test_desc[test_name]["properties"][1]["value"][0] - desc = json_test_desc[test_name]["properties"][1]["value"][1] + desc = Analysis._get_test_description(json_test_desc[test_name]["properties"]) # get runtime and checks test_check = test.attrib["status"] == "run" time = round(float(test.attrib["time"]), 1) diff --git a/openair1/SIMULATION/tests/CMakeLists.txt b/openair1/SIMULATION/tests/CMakeLists.txt index d71df315bb..273142a1d7 100644 --- a/openair1/SIMULATION/tests/CMakeLists.txt +++ b/openair1/SIMULATION/tests/CMakeLists.txt @@ -1,3 +1,5 @@ +define_property(TEST PROPERTY TEST_DESCRIPTION BRIEF_DOCS "A human-readable description of this test") + # Define a macro to add tests for different physical simulators macro(add_physim_test test_name test_description test_exec) # catch all the arguments past the last expected arqument and store them in the options_list @@ -11,8 +13,12 @@ macro(add_physim_test test_name test_description test_exec) COMMAND_EXPAND_LISTS ) set_tests_properties(${test_name} PROPERTIES - LABELS "${test_exec}: ${test_description};${test_exec}" - ENVIRONMENT "LD_LIBRARY_PATH=." + LABELS "${test_exec}" + TEST_DESCRIPTION "${test_description}" + # pass test description also through environment variable: for cmake < 3.30, + # in JSON export, we cannot recover the description otherwise + # see also https://gitlab.kitware.com/cmake/cmake/-/issues/21490 + ENVIRONMENT "LD_LIBRARY_PATH=.;TEST_DESCRIPTION=${test_description}" ) add_dependencies(tests ${test_exec}) endmacro()