On 10/27/2015 08:48 PM, David Malcolm wrote:
The following patch kit adds a unit tests framework for gcc,
as a new subdirectory below gcc/testsuite.

So, as a general comment I think this would be a very good thing to have, and from a quick look through the tests they look pretty sensible.

Like previous versions of the patch kit it uses the Google Test
framework, since I've had good experiences with it:
   http://code.google.com/p/googletest/
and like v2 of the kit it embeds a two-file copy of v1.7 of
the kit, to avoid adding extra dependencies (one .h file and one
.c file).

How much of this are you actually using? How much effort would be involved in removing the extra prerequisite? Is it just the EXPECT_TRUE etc. macros?

v1 of the kit was structured as a frontend, v2 of the kit as
a plugin that was built as if it were a frontend.  Both of
these approaches were problematic, so this version
of the patch kit simply builds as a test case within the
plugin.exp suites.

This is the part I'm least certain about, for two reasons:
 * They are more like source files than tests, and I think I'd prefer
   to have them alongside the source, in gcc/ rather than in the
   testsuite. This way people are invariable going to fail to notice
   them when they grep for something.
 * This uses a plugin into whatever compiler was built, but sometimes
   you can't really set up unit tests that way because what you want
   to test depends on target specifics. What I've often wanted is a
   special test target that gets built with a special machine
   description that has whatever patterns are needed to replicate
   tricky situations in reload or other optimization passes.

The tests you have so far are focused mostly on high-level gimple/tree tests where this limitation is probably not showing up very much, but I think it would be better to have something that allows us to have more in-depth tests.


Bernd

Reply via email to