[LLVMdev] DejaGnu test-suite coverage

Duncan Sands baldrick at free.fr
Wed May 28 02:33:12 PDT 2008


Hi,

> > I think he means the lines like:
> >
> >     switch (Opcode) {
> >
> > default: assert(0 && "Unknown load!");
> >
> >
> > where the default case is never executed.
> >
> I would personally appreciate expected to fail tests that ensure the
> assertions actually catch the bad inputs that they were designed to catch,
> there by executing those lines. I realize that many couldn't be tested in
> this manner (they assert on malformed data in the middle, which should be
> caught much earlier). Anyways, I'm gonna go prod the generated files, and
> see if I can capture at least some of that code.

I don't think assertions should be used to catch malformed input.  Assertions
should be used to check that impossible things aren't happening, not possible
things.  The right way to handle malformed input IMHO is to output a message
and explicitly abort, whether assertions are enabled or not.

In short it should be impossible to get test coverage for assertions because
by definition they should be impossible to reach.

Ciao,

Duncan.



More information about the llvm-dev mailing list