Re: [patch] delete namespace __gnu_test from C++ testsuite

David Carlton
2002-12-18T18:05:47Z

On 17 Dec 2002 16:08:00 -0800, David Carlton <carlton@math.Stanford.EDU> said:

> Basically, I don't like tests that test multiple concepts at once,
> as a general policy: if you have a test testing A and B then, when
> it fails, you only know that you screwed up A or B, but not which.
> (Exactly such a situation is what prompted me to remove these
> namespaces: I'm not doing it for theoretical reasons, but because
> it's already caused a practical problem for me once.)

Actually, I'm misremembering the situation. What actually happened is
that the tests in question were wrong. The .cc file looked like this,
among other things:

namespace __gnu_test
{
enum region { oriental, egyptian, greek, etruscan, roman };
}

Then, at some point, the .exp file asked GDB to print the value of a
variable whose type was that enum, as follows:

# simple object, enum
gdb_test "print test1.value" "\\$\[0-9\]* = egyptian" "simple object, enum"

But this isn't really correct: a more sensible thing to look for is
the value __gnu_test::egyptian: that's the canonical name of the enum
constant in question. Which is, in fact, what my branch did, causing
tests to go from PASS to FAIL when they should have been going from
FAIL to PASS!

Obviously it would be possible to fix the expected output for the
tests, but then there's the problem that the current GDB wouldn't get
them right (which isn't a big deal, in fact which is probably
desirable, we can KFAIL them) and the more important problem that
we're left without a test that tests GDB's ability to print out data
members whose values are enum constants.

So, for now, I'm a lot more interested in the latter issue, and
removing the __gnu_test seemed like the best way to fix it. But I'll
make sure I've filed a PR so that I add back tests to test this aspect
of namespace support properly.