All of lore.kernel.org
 help / color / mirror / Atom feed
* [SPDK] FYI running coverage tests locally
@ 2018-07-06 22:28 Luse, Paul E
  0 siblings, 0 replies; only message in thread
From: Luse, Paul E @ 2018-07-06 22:28 UTC (permalink / raw)
  To: spdk

[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]

Hopefully everyone adding new code is using this feature (local coverage) as it was enabled about a year ago but recently with some directory structure changes it may not be intuitive how to run it now so I wanted to take a second to share.

Unit tests are super important for the community as they help protect against future regressions when someone else (other than the initial author) makes changes without fully understanding how those changes may affect "non-obvious" things in the code base.  Making sure your unit tests cover all applicable code is one of the ways that's accomplished (with proper assertions to check and make sure functional code is always behaving per design).

Code coverage is collected in CI via running various types of tests but locally, when developing unit tests, everyone should be running coverage *locally* as well to make sure that the code they are adding is sufficiently covered with unit tests where it makes sense (IMHO it makes sense everywhere).  So here you go:

1) make sure you configure your build accordingly:
              ./configure --enable-debug --enable-coverage --enable-asan
              make clean
              make

2) from the root of your repo run the unit tests (or from the /test/unit directory) run the script below.  The "ut_coverage" dir will be created off of the repo root regardless of where you invoke the script from though.
              ./test/unit/unittest.sh

And that's it!  You can open up "ut_coverage/index.html" with any browser and get a graphical file by file, line by line, color coded view of where you are missing code coverage in your new file.

For those looking for something cool to do to get your feet wet in SPDK, you can run this coverage report on master and see where there are lots of opportunities to add test code :)

-Paul




[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 4782 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-06 22:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 22:28 [SPDK] FYI running coverage tests locally Luse, Paul E

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.