DMD does not seem to generate the code coverage report file if the program is not run from the same directory as the source file. The documentation does not mention this as a desired behavior, so it seems to be a bug, but maybe it is a safeguard?

For instance, this works:

    ~/test$ dmd -cov test.d && ./test
    ~/test$ ls *.lst
    test.lst

This does not output the coverage listing:

    ~/test/sub$ dmd -cov test.d
    ~/test/sub$ cd ..
    ~/test$ ./sub/test.d
    ~/test$ find . -name '*.lst'
    ~/test$

This attempt at a workaround works, but produces unhelpful listing filenames:

    ~/test/sub2$ dmd -cov ../sub1/test.d -of../sub1/test
    ~/test/sub2$ ../sub1/test
    ~/test/sub2$ ls *.lst
    zsh: no matches found: *.lst
    ~/test/sub2$ find . -name '*.lst'
    ./..-sub1-test.lst

So even either:

1) the safeguard is intended (but apparently not documented, which should be fixed), but the output path should to be tweaked for this latter corner case;

2) this is all a bug, and the coverage listing is missing when it shouldn't.

I just wanted to clarify which. I can open a bug report after clarifying.

In the future, should I just file bug reports and ask any questions there (if in doubt about the issue being a bug at all, etc.), or do you prefer if I ask here in the forums first? (it may be helpful for those lurking, but which don't read the bug reports?)

Reply via email to