April 06, 2017
https://issues.dlang.org/show_bug.cgi?id=17300

          Issue ID: 17300
           Summary: Enable setting code coverage options on the command
                    line
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody@puremagic.com
          Reporter: jrdemail2000-dlang@yahoo.com

The core.runtime functions dmd_coverSetMerge, dmd_coverSourcePath, and dmd_coverDestPath are quite use when generating code coverage reports. This is especially true when generating reports involving multiple runs, multiple executable sharing code, etc.

The main downside is that they are only available from the source code being compiled. It would be much more flexible to have a run-time configurable setting. One use case is with unit tests run directly as result of a compiler build line. Another is building an executable with code coverage turned on, then running the executable multiple times for tests.

One solution might be to use "--DRT-<option>" command line arguments, similar to those used to set GC options on the command line. (See https://dlang.org/spec/garbage.html#gc_config). These are nice because they are processed and removed prior to any other command line argument processing.

--