We have a continuous integration pipeline setup in GitLab to test our MPI based Fortran code. It has two stages, a build stage and test stage. The test stage is split into several jobs that are executed simultaneously. I am now trying to configure the testing setup so we also get the overall coverage percentage on the code based on the test suite. The paths to where the code is built and each of the test jobs will differ since the respective job directories are given specific ID. I am encountering two issues:
1) I am not able to use the executable built in the build stage to work when running the tests. I compile the code with "-prof-gen=srcpos -prof-src-root-cwd", thinking that the option -prof-src-root-cwd should make the executable relocatable but I can see that .dyn files are written to the directory where I built the code not where I test. Instead I have to compile the code in each separate test job. I came across this issue: https://community.intel.com/t5/Intel-Fortran-Compiler/Set-code-coverage-dyn-files-to-go-to-a-different-directory/td-p/1140391. I tried issuing the command
where NEW_SRC_ROOT is the absolute path to the per-job created directory containing the full repository and executable. I also tried using a relative path.
2) To combine the coverage data from the separately run tests, I have added a third job stage, where I collect the .dpi files created in each of the test jobs. I run:
profmerge -a pgopti_*.dpi codecov -txtlcov
where pgopti_*.dpi are the .dpi files created from each of the test jobs (I manually append a $JOB_ID string to each of the .dpi files). the codecov executable requires a .spi file, so I use one of the .spi files generated from the test jobs. But it appears that depending on which of the .spi files I use, I get the coverage of that specific set of tests, not the grand total sum of all the tests.
I suspect that both issues are rooted in the fact that the instrumented code I generate is not relocatable, and therefore the combined test coverage results are not either. The .spi file appears to be linked to a specific build directory and when gathering coverage data, only the data for a specific .spi file is included in the coverage.
I am running with version ifort (IFORT) 22.214.171.124 20190416
Thank you in advance for any help.