Open chriskloe opened 10 months ago
Did you approve the folders that are not in your Jenkins workspace?
This jobs workspace is d:\workdir\workspace\project so all the sources are inside the current workspace. You mean I have to approve d:\ and d:\workdir to make that work? Isn't this a security problem? In the same project I am using warnings-ng to scan for compiler warnings. There display of the sources is working properly.
Sorry, I should have read the error message better 🙈
The actual problem is: Source file 'workdir/workspace/project/source-root/folder/source.cpp' not found
It seems that OpenCpp coverage does not report files with absolute paths (or with correct relative paths).
There is that sources-tag at the top of the file. OpenCppCoverage seems to report the sources relative to that base - when you combine the parts in the right way (insert a path separator).
I see. It seems to be a chicken egg problem. These source directories are removed in the beginning since they are not part of the workspace and are not approved by an admin. But when the full path is concatenated it would be in the workspace again. In order to work the order of these checks need to be changed.
Given the error message I'm not fully convinced if the concatenation actually is done but the truth is in the source.... Interesting, some lines later in the output I found another interesting message:
[2023-10-19T16:15:37.446Z] [Coverage] Successfully processed file 'source-root\.output\win32vc19\test.dbg\TestCoverage.xml'
[2023-10-19T16:15:37.446Z] [Coverage] Resolving source code files...
[2023-10-19T16:15:37.446Z] [Coverage] Searching for source code files in 'D:/workdir/workspace/project/src/main/java'
[2023-10-19T16:15:37.446Z] [Coverage] -> finished resolving of absolute paths (found: 0, not found: 781)
[2023-10-19T16:15:41.859Z] [Coverage] Obtaining action of reference build
that 'src/main/java' for sure is not from me. In the last runs I tried it like this:
recordCoverage enabledForFailure: true, sourceDirectories: [[path: 'glob:source-root/**']], tools: [[parser: 'COBERTURA', pattern: 'source-root/.output/win32vc19/test*/**/*Coverage.xml"]]
Some more experimenting:
Some more experimenting:
- I tried sourceDirectories: [[path: '../../..']] with no success
- I added d:/, d:/workdir and d:/workdir/workspace to the section of the global settings titled "Warnings Plugin Global Settings - Source code directories" as well as the section of the security settings titled "Prism syntax highlighting - Permitted Source Code Directories" with no success
It is using the section of Prism syntax highlighting. Did you also try "D:/" or "D:\"? Maybe the Windows normalization does not work. What logging output do you see when you configure these values? The invalid ones should be printed.
BTW: did you already report a bug in OpenCppCoverage? From my understanding , they should either use relative paths from the workspace or absolute paths.
Did you approve the folders that are not in your Jenkins workspace?
@uhafner Where can this approval of folders be done actually?
In Jenkins global security:
Jenkins and plugins versions report
Source files not included from readCoverage step
`Jenkins: 2.414.2 OS: Windows Server 2016 - 10.0 Java: 11.0.6 - Azul Systems, Inc. (OpenJDK 64-Bit Server VM) --- JiraTestResultReporter:185.v749342e01ce4 Office-365-Connector:4.20.0 analysis-model-api:11.10.0 ansicolor:1.0.4 ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 authentication-tokens:1.53.v1c90fd9191a_b_ authorize-project:1.7.1 blueocean:1.27.8 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.8 blueocean-commons:1.27.8 blueocean-config:1.27.8 blueocean-core-js:1.27.8 blueocean-dashboard:1.27.8 blueocean-display-url:2.4.2 blueocean-events:1.27.8 blueocean-git-pipeline:1.27.8 blueocean-github-pipeline:1.27.8 blueocean-i18n:1.27.8 blueocean-jwt:1.27.8 blueocean-personalization:1.27.8 blueocean-pipeline-api-impl:1.27.8 blueocean-pipeline-editor:1.27.8 blueocean-pipeline-scm-api:1.27.8 blueocean-rest:1.27.8 blueocean-rest-impl:1.27.8 blueocean-web:1.27.8 bootstrap5-api:5.3.2-1 bouncycastle-api:2.29 branch-api:2.1128.v717130d4f816 build-failure-analyzer:2.4.2 build-name-setter:2.4.0 build-pipeline-plugin:1.5.8 build-time-blame:75.v44a_51cc97cdd-2.1.0 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-bitbucket-branch-source:848.v42c6a_317eda_e cloudbees-folder:6.848.ve3b_fd7839a_81 cmakebuilder:4.1.1 code-coverage-api:4.9.0 command-launcher:107.v773860566e2e commons-httpclient3-api:3.1-3 commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.10.0-78.v3e7b_ea_d5a_fe1 conditional-buildstep:1.4.3 copyartifact:722.v0662a_9b_e22a_c cppcheck:1.26 credentials:1293.vff276f713473 credentials-binding:636.v55f1275c7b_27 cvs:2.20-SNAPSHOT (private-99900263-sab51e) dashboard-view:2.495.v07e81500c3f2 data-tables-api:1.13.6-5 disk-usage:1.2 display-url-api:2.200.vb_9327d658781 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:572.v950f58993843 doxygen:178.v6ea_ef5f7dfdb dtkit-api:3.0.2 durable-task:523.va_a_22cf15d5e0 echarts-api:5.4.0-6 email-ext:2.102 extended-read-permission:53.v6499940139e5 external-monitor-job:215.v2e88e894db_f8 external-workspace-manager:1.3.1 favorite:2.4.3 font-awesome-api:6.4.2-1 forensics-api:2.3.0 git:5.2.0 git-client:4.5.0 git-forensics:2.0.0 git-server:99.va_0826a_b_cdfa_d github:1.37.3 github-api:1.316-451.v15738eef3414 github-branch-source:1741.va_3028eb_9fd21 gitlab-api:5.3.0-91.v1f9a_fda_d654f gitlab-branch-source:684.vea_fa_7c1e2fe3 gitlab-plugin:1.7.16 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.32 instance-identity:173.va_37c494ec4e5 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.2-350.v0c2f3f8fc595 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:73.vddf737284550 jenkins-design-language:1.27.8 jersey2-api:2.40-1 jira:3.11 jira-steps:2.0.165.v8846cf59f3db jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.18-1 job-dsl:1.85 job-restrictions:0.8 jobConfigHistory:1229.v3039470161a_d jquery:1.12.4-1 jquery3-api:3.7.1-1 jsch:0.2.8-65.v052c39de79b_2 junit:1240.vf9529b_881428 junit-attachments:167.vf1d139e316b_3 junit-realtime-test-reporter:135.vf92a_7fe68b_15 ldap:701.vf8619de9160a_ lockable-resources:1185.v0c528656ce04 mailer:463.vedf8358e006b_ mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.2.1 matrix-project:808.v5a_b_5f56d6966 maven-plugin:3.23 metrics:4.2.18-442.v02e107157925 metrics-diskusage:3.0.0 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ monitoring:1.95.0 msbuild:1.30 mstest:1.0.3 mstestrunner:1.5.0 node-iterator-api:49.v58a_8b_35f8363 nodelabelparameter:1.12.0 okhttp-api:4.11.0-157.v6852a_a_fa_ec11 pam-auth:1.10 parameterized-trigger:2.46 pipeline-build-step:505.v5f0844d8d126 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:689.veec561a_dee13 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2144.v077a_d1928a_40 pipeline-model-definition:2.2144.v077a_d1928a_40 pipeline-model-extensions:2.2144.v077a_d1928a_40 pipeline-rest-api:2.33 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40 pipeline-stage-view:2.33 pipeline-utility-steps:2.16.0 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.6.0 prism-api:1.29.0-8 pubsub-light:1.17 ranorex-integration:1.0.2 resource-disposer:0.23 robot:3.4.0 role-strategy:689.v731678c3e0eb_ run-condition:1.7 scm-api:676.v886669a_199a_a_ script-security:1275.v23895f409fb_d snakeyaml-api:2.2-111.vc6598e30cc65 sse-gateway:1.26 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.916.vd17b_43357ce4 sshd:3.312.v1c601b_c83b_0e structs:325.vcb_307d2a_2782 subversion:2.17.3 test-results-analyzer:0.4.0 timestamper:1.26 token-macro:384.vf35b_f26814ec trilead-api:2.84.v72119de229b_7 variant:60.v7290fc0eb_b_cd viewVC:1.7 vsphere-cloud:2.27 vstestrunner:1.0.8 warnings-ng:10.5.0 workflow-aggregator:596.v8c21c963d92d workflow-api:1283.v99c10937efcb_ workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3802.vd42b_fcf00b_a_c workflow-durable-task-step:1289.v4d3e7b_01546b_ workflow-job:1348.v32a_a_f150910e workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 xunit:3.1.3`What Operating System are you using (both controller, and any agents involved in the problem)?
Controller: Windows Server 2016 Agents: Windows 10
Reproduction steps
I am running googletests within opencppcoverage and want to import the reports in jenkins with the coverage plugin according to this instructions: https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/Jenkins.
Expected Results
Display of source code with marked covered lines in the display
Actual Results
Missing sources.
Anything else?
This is what the coverage.xml file created from opencppcoverage looks like (snapshots):
While reading the xml from the readCoverage step I'm getting this output on the console
Please excuse the several edits - I had some trouble to keep the format in the quotes.