This is the mail archive of the
mailing list for the GCC project.
Re: tests for GCC internal functions
On 08/16/2017 09:20 AM, David Malcolm wrote:
On Wed, 2017-08-16 at 16:51 +0200, Marek Polacek wrote:
On Wed, Aug 16, 2017 at 08:46:20AM -0600, Martin Sebor wrote:
Is there a setup for writing and running as part of the test
suite unit tests that exercise internal GCC functions like
error and warning? I ask because of a couple of bugs that
were recently reported for the %s directive in GCC's
diagnostics (81859 and 81586) that were only caught by running
valgrind on GCC, but that could have been caught by GCC's own
tests for these APIs if they existed.
I can't find any except some in the gcc.dg/plugin directory
(though they weren't written to exercise the functions but
rather the plugin interface). Would adding a plugin for
this sort of thing be the right way to do it?
Isn't -fself-test the thing you're looking for?
Indeed; looking at those bugs, it looks like you want to be adding
to/extending the selftests near end of pretty-print.c (that way you can
easily re-run them under valgrind via "make selftest-valgrind");
probably in selftest::test_pp_format, which already has a little
coverage for %s.
You're both right, thanks! It didn't occur to me to look in
the file I'm changing where there already are a bunch of self
tests for the pretty printer.