This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Tue, 17 Dec 2002 18:35:00 -0500, Daniel Jacobowitz <drow@mvista.com> said:
> On Tue, Dec 17, 2002 at 03:28:17PM -0800, David Carlton wrote:

>> I've committed the following patches to delete the namespace
>> __gnu_test from the C++ testsuite files in which it occurs: it's
>> pointless, illegally-named, and turns those files into tests of
>> namespace support as well as tests of whatever they're trying to
>> test.

> I hardly agree.  These tests were taken from libstdc++ or the
> libstdc++ testsuite, weren't they?  They have to work with the
> namespace.

Geez - you were the one who complained about that namespace when I
originally made the patch that created m-static1.cc. :-)

Anyways: I don't know where they were taken from: there's no
indication in the files or the ChangeLogs that they were taken from
anywhere else.  They may be taken from libstdc++, but they certainly
don't depend on libstdc++: the tests are in standard C++, and most of
the tests don't involve the library at all.

> I'd rather you added simpler versions rather than changing what an
> existing test is testing.  That messes up test results history in
> general.

Removing the namespace doesn't change what gdb.sum looks like at all.
If I were to add simpler versions, they would change the current file

  namespace __gnu_test
  {
    <lots of stuff>
  }

  main ()
  {
    using namespace __gnu_test;

    <more stuff>
  }

to

  namespace __gnu_test
  {
    <lots of stuff>
  }

  <the exact same lots of stuff, trivially modified to prevent name clashes>

  main ()
  {
    using namespace __gnu_test;

    <more stuff>

    <the exact same more stuff, trivially modified to prevent name clashes>
  }

(Plus similar changes for the .exp file.)  I don't see what the point
of that is.

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.)

When concepts A and B interact in nontrivial ways, then you should
ideally have tests for A, B, and A+B: and, indeed, m-data.cc, say, has
tests for data members that don't involve templates as well as data
members that do involve templates.  But it previously didn't have any
tests that involved data members but that didn't involve namespaces;
that's bad.  After the patch, it doesn't have tests that involve both
data members and namespaces; that's also bad, but it's not as bad, and
namespace.exp goes a long way towards covering that gap.

Admittedly, namespaces are orthogonal enough to other C++ language
issues that we may eventually want all or almost all of the C++
testsuite files to include namespace tests as well.  But, in the mean
time, I'd rather have focused tests rather than vague tests.

David Carlton
carlton@math.stanford.edu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]