Re: Code Coverage for C and Python

Ganesh Kathiresan via NumPy-Discussion <[email protected]> Mon, 16 Mar 2026 09:18:09 +0530
Newsgroups gmane.comp.python.numeric.general
Message-ID <CABCnkd=ZOT0=KyhVbBtygGKmYZp7eaPmaPsZgQq2LLKuw3BBbA@mail.gmail.com>
--===============2395860267940754409==
Content-Type: multipart/alternative; boundary="0000000000000266a4064d1c1787"

--0000000000000266a4064d1c1787
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

>
> There are currently two tools in the `tools` directory, I am not clear on
> how useful they are


This is outdated today (or rather there is an easier way) and needs to be
replaced with `spin test --gcov`. This generated .gcda and .gcno files
which are later used by gcovr to generate HTML reports.

Thanks,
Ganesh

On Fri, Mar 13, 2026 at 11:50=E2=80=AFPM Charles R Harris <charlesr.harris@=
gmail.com>
wrote:

>
>
> On Wed, Mar 11, 2026 at 6:20=E2=80=AFAM Ganesh Kathiresan via NumPy-Discu=
ssion <
> [email protected]> wrote:
>
>> Hi all,
>>
>> I wanted to get a wider feedback on adding a code coverage CI for C and
>> Python. Prototype PR Link: https://github.com/numpy/numpy/pull/30911
>>
>> *Why add this CI:*
>> - diff-cover provides a way to see coverage only on the changed files,
>> which is good for big PRs to understand the UT compared to the main bran=
ch.
>> - With the new GH actions-upload (v7), we can get a clickable link to th=
e
>> report in a single file. For now the PR implements a MD file format as H=
TML
>> file leads to ~250MB file
>>
>> *Why not to add this CI:*
>> - Today code coverage and dead code can be calculated locally by
>> following this: https://numpy.org/doc/stable/dev/index.html#test-coverag=
e.
>> So there is not much value in running this for every PR
>>
>> Please let us know your thoughts on having this new CI action.
>>
>>
> Code coverage fixes might be a good use case for AI. I'd rather see a too=
l
> that could cover various things and be used to generate "problems" that
> need to be solved. There are currently two tools in the `tools` directory=
,
> I am not clear on how useful they are -- the C one uses valgrind -- but I=
'd
> suggest something like a spin tool to generate code coverage reports
> independently of CI.
>
> Chuck
>

--0000000000000266a4064d1c1787
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There ar=
e currently two tools in the `tools` directory, I am not clear on how usefu=
l they are</blockquote><div><br></div><div>This is outdated today (or rathe=
r there is an easier way) and needs to be replaced with `<span style=3D"fon=
t-family:monospace">spin test --gcov`</span>. This generated <span style=3D=
"font-family:monospace">.gcda</span> and <span style=3D"font-family:monospa=
ce">.gcno</span> files which are later used by <span style=3D"font-family:m=
onospace">gcovr</span> to generate HTML reports.=C2=A0</div><div><br></div>=
<div>Thanks,</div><div>Ganesh</div></div><br><div class=3D"gmail_quote gmai=
l_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Mar 13, 20=
26 at 11:50=E2=80=AFPM Charles R Harris &lt;<a href=3D"mailto:charlesr.harr=
[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"><b=
r></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr=
">On Wed, Mar 11, 2026 at 6:20=E2=80=AFAM Ganesh Kathiresan via NumPy-Discu=
ssion &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex"><div dir=3D"ltr"><div>Hi all,</div><div><br></di=
v><div>I wanted to get a wider feedback on adding a code coverage CI for C =
and Python. Prototype PR Link:=C2=A0<a href=3D"https://github.com/numpy/num=
py/pull/30911" target=3D"_blank">https://github.com/numpy/numpy/pull/30911<=
/a></div><div><br></div><div><b>Why add this CI:</b></div><div>- diff-cover=
 provides a way to see coverage only on the changed files, which is good fo=
r big PRs to understand=C2=A0the UT compared to the main branch.</div><div>=
- With the new GH actions-upload (v7), we can get a clickable link to the r=
eport in a single file. For now the PR implements=C2=A0a MD file format as =
HTML file leads to ~250MB file</div><div><br></div><div><b>Why not to add t=
his CI:</b></div><div>- Today code coverage and dead code can be calculated=
 locally by following this:=C2=A0<a href=3D"https://numpy.org/doc/stable/de=
v/index.html#test-coverage" target=3D"_blank">https://numpy.org/doc/stable/=
dev/index.html#test-coverage</a>. So there is not much value in running thi=
s for every PR</div><div><br></div><div>Please let us know your thoughts on=
 having this new CI action.</div><div><br></div></div></blockquote><div><br=
></div><div>Code coverage fixes might be a good use case for AI. I&#39;d ra=
ther see a tool that could cover various things and be used to generate &qu=
ot;problems&quot; that need to be solved. There are currently two tools in =
the `tools` directory, I am not clear on how useful they are -- the C one u=
ses valgrind -- but I&#39;d suggest something like a spin tool to generate =
code coverage reports independently of CI.</div><div><br></div><div>Chuck=
=C2=A0</div></div></div>
</blockquote></div>

--0000000000000266a4064d1c1787--

--===============2395860267940754409==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]

--===============2395860267940754409==--