3

I am looking for serious Fortran code-coverage tools. We are working on a large project with tens of thousands of lines of code and dozens and dozens of fortran files in fixed and free form. We use the ifort compiler. I have not been able to find tools that can provide in-depth introspection for projects of this scale.

My main need is to create multiple runs for different configurations/inputs for our project and really analyze how they are the same/different. This implies that the runs are saved into some sort of data-conscious format which can be queried and used.

A simple code coverage tool such as that provided by intel's codecov would not be sufficient. This merely indicates which lines are exercised and which are not. While this is useful information, I need to go a step further and compare two different code coverage runs programmatically.

I really had my hopes up with intel fortran, especially having become familiar with the various commands, etc. I thought I hit the gold nugget a few weeks ago when I saw that a differential coverage tool exists built-into ifort. Unfortunately it is poorly documented and I have asked questions in StackOverflow and the official Intel Fortran forum with little response. This indicates to me that the tool is not sufficiently developed and will most likely not fit our needs.

Therefore I appeal to the SO community. Fortran is ancient, no doubt about it, however there are enough legacy codes/projects out there to render thorough code introspection useful and indeed necessary. Has anyone else ever faced a similar problem with large, spaghetti like Fortran code project which need to be cleaned up and tested? What high level programmatic code coverage tools exist that can enable one to shoot problems down efficiently?

Thanks

user32882
  • 5,094
  • 5
  • 43
  • 82
  • Note that *Questions asking us to **recommend** or find a book, **tool, software library**, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam."* – Vladimir F Героям слава Oct 19 '17 at 08:13
  • what would be a better place to ask this question then please? – user32882 Oct 19 '17 at 08:25
  • Who knows, officially https://softwarerecs.stackexchange.com/ . Whether you will get an answer is another matter. Also whether such software even exists. – Vladimir F Героям слава Oct 19 '17 at 08:27
  • This doesn't have to be third-party software. I am also open to ideas for developing such capabilities using xml or python for example. I know theres no magic wand that can just do it for me – user32882 Oct 19 '17 at 08:36
  • Have you tried `gcov` with the GNU fortran compiler? I haven't used it even for C, but IIRC it's a coverage tool and might work. – Peter Cordes Oct 19 '17 at 08:39
  • I will delete the other one. I feel like Im getting better feedback here – user32882 Oct 19 '17 at 09:07
  • 2
    Mostly what you'll get here is bashing by SO folks that don't think recommendation questions belong here. I think the fact the SR exists just proves these questions belong somewhere, and hiding them at SR seems silly to me when they could just as well be here. Nontheless, those are the rules at present and I think you'd be better off with an SR version. – Ira Baxter Oct 19 '17 at 10:10
  • Since you don't have an SR version, I won't respond in detail. But you ask about the possibility of "hgh level toolsl" for coverage. See my company's line of test coverage tools: http://www.semanticdesigns.com/Products/TestCoverage/ What is shown there is Fortran coverage tool (not yet in production). The product line explicitly allows one to compare coverage runs, includuing the ability to compare one run to another to see where they intersect or where they differ, built into the UI. – Ira Baxter Oct 19 '17 at 10:15
  • 1
    The plusFort toolkit http://www.adeptscience.co.uk/products/fortran-tools/plusfort-with-spag/plusfort-version-6.html also has code coverage tools which may do what you want. Ira and I have had extended in-person conversations about the sad state of Fortran tooling, especially regarding analysis and refactoring. I'm slowly working on a manuscript on revitalizing legacy scientific code and would be interested in your use case. – arclight Oct 19 '17 at 16:22
  • 1
    Though the situation may be similar, it might be useful to ask [comp.lang.fortran](https://groups.google.com/forum/#!forum/comp.lang.fortran) also to get (potentially more) info. – roygvib Oct 19 '17 at 20:45

1 Answers1

1

To compare coverage for different runs, I would suggest outputting the coverage report for each run in separate XML-formatted files.

Both codecov (Intel) and gcov (GNU, needs an additional tool like gcovr) can produce XML-formatted coverage files. The exact workflow depends on the tool that you select.

Once you have XML files, you can then interface with standard coverage analysis tools. A tool such as pycobertura (github.com/aconrad/pycobertura) should fulfill your requirements of comparing the coverage given different executions. If you're testing the coverage for a unit testing suite, they can also be used to generate "coverage gutters".

T.Body
  • 41
  • 4