This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: What does 'test' in testcases do?


On 10/20/2013 12:09 PM, Christopher Jefferson wrote:
I decided to try to trace the reason for adding:

bool test __attribute__((unused)) = true;

into tests. It seems to be from the following piece of code in
util/testsuite_hooks.h:

#ifdef _GLIBCXX_ASSERT
# include <cassert>
# define VERIFY(fn) assert(fn)
#else
# define VERIFY(fn) test &= bool(fn)
#endif

So, if we have assert we call it, else we do 'test &= bool(fn)'.

However, as far as I can see, no test does anything with 'test', so I
think this is ignoring any failing tests on any platform which does
not have 'assert'?
If I remember correctly, I didn't invent the thing, it wasn't about platforms missing assert, it was about allowing a different style of debugging, like build the very same test outside the testsuite with _GLIBCXX_ASSERT undefined and under the debugger look for test becoming false. This sort of thing. May make sense if you have many VERIFYs in a single function, etc, and people actually designs the testcases with this sort of idea in mind. That said, In the past a number of times people vaguely said that we could as well remove the machinery and have just plain asserts. It would be a pretty big patch ;) Maybe we can do it when Stage 1 reopens post 4.9. Note however, that I do *not* think the idea I tried to recollect above is completely stupid...

Paolo.


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