Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage fails with wrong number of lines #842

Closed
Jonathan34 opened this issue Apr 21, 2016 · 15 comments
Closed

Coverage fails with wrong number of lines #842

Jonathan34 opened this issue Apr 21, 2016 · 15 comments
Assignees
Milestone

Comments

@Jonathan34
Copy link

Jonathan34 commented Apr 21, 2016

Hi,

Following up on #840, i have changed my configuration to debug to see how optimization could affect the coverage.

I have deleted and recreated the project in SonarQube.
During the POST step in SonarQube, i have an exception:
`
2016-04-21T18:40:32.1475520Z 13:40:32.085 DEBUG - Saving '7' coverage measures for file 'C:\TFS\Builds\Agent404_01\1\s\Acidizing\View\AcidizingCoiledTubingView.cpp'
2016-04-21T18:40:32.1475520Z 13:40:32.085 ERROR - Saving cov measure 'coverage_line_hits_data' = 'null' failed
2016-04-21T18:40:32.1475520Z 13:40:32.085 ERROR - Obtained 'coverage_line_hits_data' = '8=0;9=0;10=0;11=0;14=0;15=0;16=0;31=0' failed
2016-04-21T18:40:32.1475520Z 13:40:32.085 ERROR - Ctype : 'UT_COVERAGE' Exception 'Can't create measure for line 31 for file 'C:/TFS/Builds/Agent404_01/1/s/aaa/View/MyClass.cpp' with 17 lines'
2016-04-21T18:40:32.1475520Z 13:40:32.100 INFO - Analysis report generated in C:\TFS\Builds\Agent404_01\1.sonarqube\out.sonar\batch-report

...

2016-04-21T18:40:33.0694300Z ##[error]ERROR: Error during Sonar runner execution
2016-04-21T18:40:33.0694300Z ##[error]org.sonar.runner.impl.RunnerException: Unable to execute Sonar
2016-04-21T18:40:33.0694300Z ##[error]at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
2016-04-21T18:40:33.0694300Z ##[error]at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
2016-04-21T18:40:33.0694300Z ##[error]at java.security.AccessController.doPrivileged(Native Method)
2016-04-21T18:40:33.0694300Z ##[error]at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
2016-04-21T18:40:33.0694300Z ##[error]at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
2016-04-21T18:40:33.0694300Z ##[error]at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
2016-04-21T18:40:33.0850573Z ##[error]at org.sonar.runner.api.Runner.execute(Runner.java:100)
2016-04-21T18:40:33.0850573Z ##[error]at org.sonar.runner.Main.executeTask(Main.java:70)
2016-04-21T18:40:33.0850573Z ##[error]at org.sonar.runner.Main.execute(Main.java:59)
2016-04-21T18:40:33.0850573Z ##[error]at org.sonar.runner.Main.main(Main.java:53)
2016-04-21T18:40:33.0850573Z ##[error]Caused by: java.lang.IllegalStateException: Can't create measure for line 31 for file 'C:/TFS/Builds/Agent404_01/1/s/aaa/View/MyClass.cpp' with 17 lines
2016-04-21T18:40:33.0850573Z ##[error]at org.sonar.batch.sensor.coverage.CoverageExclusions.validateMaxLine(CoverageExclusions.java:158)
2016-04-21T18:40:33.0850573Z ##[error]at org.sonar.batch.sensor.coverage.CoverageExclusions.validate(CoverageExclusions.java:129)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.batch.deprecated.DeprecatedSensorContext.saveMeasure(DeprecatedSensorContext.java:204)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.plugins.cxx.coverage.CxxCoverageSensor.saveMeasures(CxxCoverageSensor.java:173)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.plugins.cxx.coverage.CxxCoverageSensor.analyse(CxxCoverageSensor.java:98)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:102)
2016-04-21T18:40:33.1006797Z ##[error]at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:185)
2016-04-21T18:40:33.1163069Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
2016-04-21T18:40:33.1163069Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
2016-04-21T18:40:33.1163069Z ##[error]at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:264)
2016-04-21T18:40:33.1163069Z ##[error]at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:259)
2016-04-21T18:40:33.1163069Z ##[error]at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
2016-04-21T18:40:33.1163069Z ##[error]at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:249)
2016-04-21T18:40:33.1319340Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
2016-04-21T18:40:33.1319340Z ##[error]at org.sonar.batch.scan.ProjectScanContainer.startComponents(ProjectScanContainer.java:127)
2016-04-21T18:40:33.1319340Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
2016-04-21T18:40:33.1319340Z ##[error]at org.sonar.batch.task.ScanTask.execute(ScanTask.java:55)
2016-04-21T18:40:33.1475572Z ##[error]at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
2016-04-21T18:40:33.1475572Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
2016-04-21T18:40:33.1475572Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:120)
2016-04-21T18:40:33.1475572Z ##[error]at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:122)
2016-04-21T18:40:33.1475572Z ##[error]at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
2016-04-21T18:40:33.1475572Z ##[error]at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
2016-04-21T18:40:33.1631829Z ##[error]at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
2016-04-21T18:40:33.1631829Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2016-04-21T18:40:33.1631829Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2016-04-21T18:40:33.1631829Z ##[error]at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2016-04-21T18:40:33.1631829Z ##[error]at java.lang.reflect.Method.invoke(Unknown Source)
2016-04-21T18:40:33.1631829Z ##[error]at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
2016-04-21T18:40:33.1631829Z ##[error]... 9 more
2016-04-21T18:40:33.1631829Z ##[error]ERROR:
2016-04-21T18:40:33.1788054Z ##[error]ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
2016-04-21T18:40:33.2881901Z Process returned exit code 1
2016-04-21T18:40:33.2881901Z ##[error]The SonarQube Scanner did not complete successfully
2016-04-21T18:40:33.3038072Z 13:40:33.194 Creating a summary markdown file...
2016-04-21T18:40:33.3038072Z ##[error]Post-processing failed. Exit code: 1
2016-04-21T18:40:33.6171780Z ##[error]Unexpected exit code received from batch file: 1`

As I only changed the configuration from Release to Debug, i assume this is a bug...?

@guwirth
Copy link
Collaborator

guwirth commented May 1, 2016

build environment #840:

  • TFS 2015 Update 1 as build server and TFSVC (using the pre and post step of the sonar msbuild runner)
  • SonarQube 5.4 / SQL Server 11.00.5343 / Java 1.8.0.77
  • Sonar cxx 0.95
  • VS 2013 / Google Test / vscoveragexml
  • Windows environement everywhere

@jmecosta
Copy link
Member

jmecosta commented May 1, 2016

I would expect release builds to cause more issues than debug. Optimization
usually causes symbols and source not to match. Perhaps the debug
configuration has also some optimizations? But this is not totally
unexpected. Anyway imo this should cause a exception and you should try to
setup the raw data in a way that matches the source code.

On Sun, 1 May 2016 19:21 Günter Wirth, [email protected] wrote:

build environment #840
#840:

  • TFS 2015 Update 1 as build server and TFSVC (using the pre and post
    step of the sonar msbuild runner)
  • SonarQube 5.4 / SQL Server 11.00.5343 / Java 1.8.0.77
  • Sonar cxx 0.95
  • VS 2013 / Google Test / vscoveragexml
  • Windows environement everywhere


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#842 (comment)

@guwirth
Copy link
Collaborator

guwirth commented May 1, 2016

https://github.com/SonarOpenCommunity/sonar-cxx/blob/master/sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/coverage/CxxCoverageSensor.java#L187

ERROR - Ctype : 'UT_COVERAGE' Exception 'Can't create measure for line 31 for file 'C:/TFS/Builds/Agent404_01/1/s/aaa/View/MyClass.cpp' with 17 lines'

Is throwing an exception because coverage should be assigned to line 31 whereas file has only 17 lines. There is an ongoing discussion how to handle this case #758:

@jmecosta
Copy link
Member

jmecosta commented May 1, 2016

@guwirth just to illustrate my point, this is a very good example of data completely messing up your project. Is not that its off by one line. Its almost double the size of the file. so the results of the coverage are totally not to be trusted

@guwirth
Copy link
Collaborator

guwirth commented May 1, 2016

@jmecosta my and @Bertk 's opinion: better partial right data as no data. The main benefit of such a tool is a fast feedback loop. But as already stated in #758 we should introduce a strict and resume mode to make all happy.

@balegoff
Copy link

Hi,

We are having the same UT_COVERAGE exception due to wrong line number.
I know you guys are working on the behavior of sonar cxx when this happens, but does anyone have a clue why gcovr is doing it wrong ?

I must precise we recently upgraded sonar cxx from 0.9.4 RC2 to 0.9.5 and SonarQube from 5.2 to 5.6.
Before upgrading we didn't have this issue.

Thanks.

@KevinArturia
Copy link

Hi, same problem here. Did you make a decision on the strict/resume mode?

@Djoules
Copy link

Djoules commented Jul 21, 2016

Hey guys,

I also have the same issue. Any news ?

Thanks.

@guwirth
Copy link
Collaborator

guwirth commented Jul 22, 2016

@Djoules I'm sorry no news. Focus is still on removing deprecated APIs ...

@Jonathan34
Copy link
Author

Hi,

Do you have any estimate on when this would be fixed...?

I am now using the standard SonarQueb default step with gtest trx tests results and .coverage(xml) coverage... and I still have this issue and it is preventing a full analysis... and i do not see any workaround.
Hope something will happen very soon as this is obviously a blocker issue.

@Bertk
Copy link
Contributor

Bertk commented Aug 6, 2016

Hi,
looks like the MS coverage tooling has a severe issue with C++ sources (see http://stackoverflow.com/questions/35611255/visual-studio-2015-code-coverage-wrong-file).
I do not know whether this was improved with VS2015 Update 3.
Regards
Bert

@guwirth
Copy link
Collaborator

guwirth commented Aug 6, 2016

@Jonathan34 it's sommer vacation time. I expect no solution before end of August

@guwirth
Copy link
Collaborator

guwirth commented Oct 7, 2016

Closed with #959

@guwirth guwirth closed this as completed Oct 7, 2016
@sgaikwad
Copy link

sgaikwad commented Jun 6, 2017

any updates on the issue?

@guwirth
Copy link
Collaborator

guwirth commented Jun 6, 2017

@sgaikwad See above, closed with #959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

8 participants