digitalmars.D - Cumulative code coverage?
- H. S. Teoh (12/12) Mar 21 2018 Is it possible to get cumulative code coverage using dmd? I.e.,
- Seb (8/18) Mar 21 2018 Yes, either set dmd_coverSetMerge(true) or pass --DRT-covopt
- H. S. Teoh (8/14) Mar 21 2018 [...]
- H. S. Teoh (9/10) Mar 21 2018 [...]
- Petar Kirov [ZombineDev] (3/11) Mar 21 2018 I think you're looking for: "Controlling the Coverage Analyser"
- H. S. Teoh (8/19) Mar 22 2018 Ah, thanks! That's exactly what I was looking for.
Is it possible to get cumulative code coverage using dmd? I.e., accumulate code coverage stats over a series of runs from an external test suite. Currently, it seems that compiling with -cov will just overwrite the *.lst files from previous runs. Do I have to merge the .lst files externally? I'm currently writing an external test suite for one of my projects, and obviously, each individual test isn't going to cover the entire code. So the idea is to write a series of tests that cumulatively test all code paths. T -- "Holy war is an oxymoron." -- Lazarus Long
Mar 21 2018
On Wednesday, 21 March 2018 at 16:39:48 UTC, H. S. Teoh wrote:Is it possible to get cumulative code coverage using dmd? I.e., accumulate code coverage stats over a series of runs from an external test suite. Currently, it seems that compiling with -cov will just overwrite the *.lst files from previous runs. Do I have to merge the .lst files externally? I'm currently writing an external test suite for one of my projects, and obviously, each individual test isn't going to cover the entire code. So the idea is to write a series of tests that cumulatively test all code paths. TYes, either set dmd_coverSetMerge(true) or pass --DRT-covopt "merge:1" to your program. You can also set the environment variable DRT_COVOPT, but I think you need to enable this by setting rt_envvars_enabled to true before. https://dlang.org/phobos/core_runtime.html#.dmd_coverSetMerge https://dlang.org/changelog/2.078.0.html#covopts
Mar 21 2018
On Wed, Mar 21, 2018 at 05:34:58PM +0000, Seb via Digitalmars-d wrote:On Wednesday, 21 March 2018 at 16:39:48 UTC, H. S. Teoh wrote:[...]Is it possible to get cumulative code coverage using dmd? I.e., accumulate code coverage stats over a series of runs from an external test suite.Yes, either set dmd_coverSetMerge(true) or pass --DRT-covopt "merge:1" to your program.[...] Cool, passing --DRT-covopt="merge:1" did the trick. Thanks! T -- Bare foot: (n.) A device for locating thumb tacks on the floor.
Mar 21 2018
On Wed, Mar 21, 2018 at 12:35:08PM -0700, H. S. Teoh via Digitalmars-d wrote: [...]Cool, passing --DRT-covopt="merge:1" did the trick.[...] Speaking of which, are the --DRT-* options documented anywhere?? I don't even know where to begin to look, besides in the druntime code itself. T -- Unix was not designed to stop people from doing stupid things, because that would also stop them from doing clever things. -- Doug Gwyn
Mar 21 2018
On Wednesday, 21 March 2018 at 19:44:19 UTC, H. S. Teoh wrote:On Wed, Mar 21, 2018 at 12:35:08PM -0700, H. S. Teoh via Digitalmars-d wrote: [...]I think you're looking for: "Controlling the Coverage Analyser" under https://dlang.org/articles/code_coverage.html.Cool, passing --DRT-covopt="merge:1" did the trick.[...] Speaking of which, are the --DRT-* options documented anywhere?? I don't even know where to begin to look, besides in the druntime code itself. T
Mar 21 2018
On Thu, Mar 22, 2018 at 06:31:21AM +0000, Petar via Digitalmars-d wrote:On Wednesday, 21 March 2018 at 19:44:19 UTC, H. S. Teoh wrote:[...]On Wed, Mar 21, 2018 at 12:35:08PM -0700, H. S. Teoh via Digitalmars-d wrote: [...]Cool, passing --DRT-covopt="merge:1" did the trick.[...] Speaking of which, are the --DRT-* options documented anywhere?? I don't even know where to begin to look, besides in the druntime code itself.I think you're looking for: "Controlling the Coverage Analyser" under https://dlang.org/articles/code_coverage.html.Ah, thanks! That's exactly what I was looking for. Still, it would be nice to have a list of all --DRT-* options (not necessarily related to coverage) somewhere, just for reference. T -- If you want to solve a problem, you need to address its root cause, not just its symptoms. Otherwise it's like treating cancer with Tylenol...
Mar 22 2018