Skip to content

Uppercase file paths in Xunit reports are changed to lowercase on case sensitive operating systems #2302

@jnicol31

Description

@jnicol31

Describe the bug
Our tests sources are located in a subdirectory <subcomponent>/TESTS/<test_dir>.
However, the Xunit sensor expects them to be in <subcomponent>/tests/<test_dir>
In the end, tests fail to be mapped with their test sources, leading to poor information on the UI.

Example:

<testcase result="fail" name="test_something" filename="somecomponent/TESTS/sometest/tst_something.cpp">

In the logs:

INFO: Processing xUnit report '/home/jenkins/workspace/.../branch/build/report/test_report_something.xml'
WARN: Cannot find the file '/home/jenkins/workspace/.../branch/somecomponent/tests/sometest/tst_something.cpp' in project 'TestProject' with baseDir '/home/jenkins/workspace/.../branch/', skipping

To Reproduce
Steps to reproduce the behavior:

  1. Move your tests source to an uppercase directory
  2. Set your sonar.tests property accordingly
  3. Update some tests so that they fail or are skipped
  4. Launch the tests and the SQ analysis
  5. Watch the logs to find: WARN: Cannot find the file '<lower cased path>' in projetc <project> with baseDir ...

Expected behavior

  • No errror in logs.
  • The failed tests and their source are shown in the UI

Desktop:

  • OS: Linux
  • SonarQube version: 9.2.1.49989
  • cxx plugin version: 2.0.6 (build 2921)
  • sonar-scanner version: 4.6.2.2472-linux

Additional context
The issue seems to be in cxx-sensors/src/main/java/org/sonar/cxx/sensors/tests/xunit/XunitReportParser.java, line 132: why is the resolved path converted to lower case ? (commit 2c2ecbd)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions