Repository navigation
Preserve CTest target identity in JUnit results - #1002
Conversation
Signed-off-by: 渠超胜 <[email protected]>
Signed-off-by: 渠超胜 <[email protected]>
|
A gentle first ping on this one. The branch has been unchanged since 09-12, it has no conflicts, and both checks pass; the only thing missing is a review. If the approach needs rework, or if this is not something you want in rolling, say so and I will adjust or drop it. |
Jenkins's JUnit plugin splits testcase classname on the last '.'
into (packageName, className), and the default report grouping is
by packageName. Prefixing puts the CTest target in front of the
package name, so every target becomes its own package and the
grouping under ${PROJECT_NAME} is lost.
Append the target to the class name instead, separated by two
underscores, so packageName stays the package. getFullName(), the
key used to look up the previous result, still changes with the
target, so failure age stays per-target.
Replace '.' with '_' in the target: add_launch_test() defaults
TARGET to the test file name, and a '.py' segment would introduce
another dot.
Signed-off-by: 渠超胜 <[email protected]>
b0e6b0c to
5b14988
Compare
|
Both fixed in 5b14988. The target now goes on the end of the class name, so it comes out as test_xml_output.TestHost__. I went with appending rather than putting it after <package_name>, because that doesn't actually help. getPackageName() splits classname on the last '.', so <package_name>.<test_name>. still leaves "test_xml_output.<test_name>" as the package name and ${PROJECT_NAME} doesn't group. Appending is the only one of the two that leaves the last dot where it is. Uniqueness is unaffected: getFullName() is classname + '.' + name, and that's the key getPreviousResult() resolves through getCase(), so age still tracks per CTest target. For the .py I normalized in the serializer rather than add_launch_test.cmake. _classname_suffix() replaces '.' with '_', so a default TARGET of test_foo.py becomes TestHost__test_foo_py. Stripping only the extension wouldn't be enough, the dot is what breaks the split, and junitxml.py is the one place that knows '.' is the package separator. Also renamed classname_prefix to classname_suffix, since it doesn't prefix any more. Added test_classname_suffix_keeps_package_grouping to pin the package name for every target spelling. |
Signed-off-by: William Woodall <[email protected]>
|
Pulls: #1002 |
|
Hi! thanks for taking a look at this. I have a question. This change needs to be made in all repositories with junit tests or just in this one? |
|
Just this one. The change is in launch_testing's JUnit serializer, so packages pick it up from the launch_testing they build against. Nothing to edit in the other repos, and anything pinned to an older launch_testing keeps the old classname until it bumps. add_launch_test() already knew the unique CTest target name, it just never reached the serializer. Distinct generated or parameterized tests ended up sharing a testcase.classname and collapsed into one entry in Jenkins history. |
Description
Pass the unique CTest target name from
add_launch_test()to the JUnit serializer and prefix each generatedtestcase.classnamewith it. This keeps distinct generated or parameterized launch tests from collapsing into the same Jenkins test history.Fixes ros2/ros2#1855
Related to osrf/buildfarm-tools#262
Testing
colcon buildforlaunch_testingandlaunch_testing_ament_cmakecolcon test: 99launch_testingtests passedcolcon test: 2launch_testing_ament_cmaketests passedtestcase.classnameGenerative AI
Codex was used to investigate the issue, implement the change, and run the tests.