Commit Graph

366 Commits

Author SHA1 Message Date
Howard Hinnant 575e4e3650 Richard Smith: It was pointed out to me off-list that libc++'s non-compiler-builtin
implementation of std::is_polymorphic does this:

template <class _Tp> struct __is_polymorphic1 : public _Tp {};

... and that g++ rejects this if _Tp has an inaccessible virtual destructor
(because __is_polymorphic1<_Tp> would have a deleted virtual destructor
overriding _Tp's non-deleted destructor). Clang was failing to reject this;
I've fixed that in r178563, but that causes libc++'s corresponding test
case to fail with both clang and gcc when using the fallback
implementation. The fallback code also incorrectly rejects final types.

The attached patch fixes the fallback implementation of is_polymorphic; we
now use dynamic_cast's detection of polymorphic class types rather than
trying to determine if adding a virtual function makes the type larger:

  enable_if<sizeof((_Tp*)dynamic_cast<const volatile
void*>(declval<_Tp*>())) != 0, ...>

Two things of note here:
* the (_Tp*) cast is necessary to work around bugs in Clang and g++ where
we otherwise don't instantiate the dynamic_cast (filed as PR15656)
* the 'const volatile' is here to treat is_polymorphic<cv T> as true for a
polymorphic class type T -- my reading of the standard suggests this is
incorrect, but it matches our builtin __is_polymorphic and gcc

llvm-svn: 178576
2013-04-02 21:25:06 +00:00
Howard Hinnant 70e19bd31e Some debug test cases for list.
llvm-svn: 178565
2013-04-02 19:53:32 +00:00
Howard Hinnant cf1dc8d39e Test case was forming the wrong limits when size_t != unsigned long.
llvm-svn: 178370
2013-03-29 21:22:22 +00:00
Howard Hinnant 84718fde7a The 3rd test in shrink_to_fit.pass.cpp can't possibly pass if exceptions are disabled, so #ifdef'ing out the test.
llvm-svn: 178350
2013-03-29 17:20:04 +00:00
Daniel Dunbar 15eaebea15 Revert r178075, "Tighten up the iterator requirements ...", it breaks LLVM
bootstrap with libc++.

llvm-svn: 178116
2013-03-27 04:10:25 +00:00
Howard Hinnant 5a13d8dcea Tighten up the iterator requirements for the vector member templates. This is especially important for the constructors so that is_constructible<vector<T>, I, I> gives the right answer when T can not be constructed from *I. Test case included for this latter point.
llvm-svn: 178075
2013-03-26 21:40:54 +00:00
Howard Hinnant cd4a9fd301 Another vector debug mode test, and a static test on Allocator::value_type. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=15576.
llvm-svn: 178064
2013-03-26 19:04:56 +00:00
Howard Hinnant 1d8a5164b4 More vector debug tests.
llvm-svn: 178033
2013-03-26 15:45:56 +00:00
Marshall Clow a6d24cc19d Fixed race conditions in thread tests; exposed by UBSan
llvm-svn: 178029
2013-03-26 15:28:33 +00:00
Howard Hinnant ea95898f29 Simply debug mode tests per Dmitri Gribenko's suggestion.
llvm-svn: 178026
2013-03-26 14:28:25 +00:00
Howard Hinnant d9db9f90fb Need one more swap overload for swapping two lvalue vector<bool>::reference's.
llvm-svn: 178016
2013-03-26 13:48:57 +00:00
Howard Hinnant ea1bbbd135 Added debug tests for indexing, pop_back and both forms of erase. Added an improved error message for erasing a single element with end().
llvm-svn: 177929
2013-03-25 22:12:26 +00:00
Howard Hinnant b14037be89 Remove some erroneous code I was using to debug debug mode.
llvm-svn: 177908
2013-03-25 20:46:07 +00:00
Howard Hinnant 2d752fc2f9 Debug mode tests for vector::front and back.
llvm-svn: 177904
2013-03-25 20:31:25 +00:00
Howard Hinnant 35b3b54548 More vector::iterator debug mode tests. Run by adding to OPTIONS -D_LIBCPP_DEBUG2=1.
llvm-svn: 177897
2013-03-25 20:03:19 +00:00
Howard Hinnant 92bd7c0337 Debug mode: learning to crawl. I need to set up some tests that actually test that the debug mode is working, but that won't cause problems when debug mode isn't on. This is my first prototype of such a test. It should call std::terminate() because it's comparing iterators from different containers. And std::terminate() is rigged up to exit normally. If debug mode fails, and doesn't call terminate, then the program asserts. The test is a no-op if _LIBCPP_DEBUG2 is not defined or is defined to be 0.
llvm-svn: 177892
2013-03-25 19:29:35 +00:00
Howard Hinnant a60ae88db2 Marshall Clow found some divide-by-zero warnings with UBSan in rand's binomial_distribution test. This eliminates the divide-by-zeros and describes in comments the numerical difficulties the test is having. Each of the problematic tests are exploring edge cases of the distribution.
llvm-svn: 177826
2013-03-23 19:29:45 +00:00
Howard Hinnant 65a87ccdbf This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously.
llvm-svn: 177824
2013-03-23 17:27:16 +00:00
Howard Hinnant 7c5b88b134 Test cleanup with respect to use of deprecated tmpnam function. Also Windows port for these tests to use _tempnam. The bulk of this patch was donated anonymously. I've tested it on OS X and accept responsibility for it. If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know. Should be easy to fix in test/support/platform_support.h
llvm-svn: 177755
2013-03-22 20:05:40 +00:00
Marshall Clow 761b5cf087 Fix bug in test; found by AddressSanitizer
llvm-svn: 177464
2013-03-20 00:01:48 +00:00
Marshall Clow 1c00ce5070 Fix bug in test; found by AddressSanitizer
llvm-svn: 177355
2013-03-18 23:39:36 +00:00
Marshall Clow b56e8587af Removed raw references to __APPLE__; now just check to see if it is defined.
llvm-svn: 177297
2013-03-18 17:45:34 +00:00
Marshall Clow 91907cbe82 Removed raw references to _WIN32; now just check to see if it is defined.
llvm-svn: 177291
2013-03-18 17:04:29 +00:00
Howard Hinnant 7e4844b353 Parsing floating point numbers with very long precision was broken, and this patch fixes it. This fixes http://llvm.org/bugs/show_bug.cgi?id=15445.
llvm-svn: 176711
2013-03-08 19:06:24 +00:00
David Chisnall 8b6a4de64a Fix a bug in mutex_try_to_lock. This was previously trying to unlock a mutex that it didn't own, causing an assertion failure in mutex.cpp. The issue was that the unique_lock went out of scope, releasing the lock on m, then m.unlock() was called on an already-unlocked mutex.
This change removes the spurious m.unlock() call.  

If this test was previously passing for anyone with assertions enabled, then they should investigate bugs in their pthread implementation, as pthread_unlock() should not return 0 if the mutex is currently unlocked.

llvm-svn: 175506
2013-02-19 11:28:45 +00:00
Daniel Dunbar 62b943935d [tests] Add support for a link_flags lit parameter.
- This is useful for testing with custom ABI libraries.
 - Patch by Michael van der Westhuizen.

llvm-svn: 174997
2013-02-12 19:28:51 +00:00
Daniel Dunbar 496f1765a2 [tests] Another batch of timeout increases.
llvm-svn: 174902
2013-02-11 21:04:34 +00:00
Daniel Dunbar ceb47bb06d [tests] Another batch of timeout increases.
llvm-svn: 174726
2013-02-08 18:26:55 +00:00
Daniel Dunbar 76efb57666 [tests] Add back stdc macros I accidentally refactored out.
- Patch by Michael van der Westhuizen:
--
r174404 accidentally removed stdc format, limit and constant macros from the Linux test runner logic.  This small patch re-adds the macros.

Making this change fixes the following tests on Linux:
 - depr/depr.c.headers/inttypes_h.pass.cpp
 - depr/depr.c.headers/stdint_h.pass.cpp
 - input.output/file.streams/c.files/cinttypes.pass.cpp
 - language.support/cstdint/cstdint.syn/cstdint.pass.cpp
--

llvm-svn: 174722
2013-02-08 17:41:28 +00:00
Daniel Dunbar 577e696425 [tests] Increase a bunch of wait limits.
- Basically I just ran the thread tests many many times on a busy machine and
   bumped the timeouts whenever I hit a test failure.

 - This is obviously subpar, but is the best I can do without the tests being
   rewritten to not depend on arbitrary timeouts.

llvm-svn: 174721
2013-02-08 17:41:19 +00:00
Howard Hinnant 584a65befd Give a lot more timing latitude to some of the timing tests. Busy buildbots are hitting the timing limits too often.
llvm-svn: 174539
2013-02-06 20:25:56 +00:00
Daniel Dunbar 05abe9372b [tests] Infer the cxx_under_test (as clang++).
- This is a reasonable default, and makes testing just work with no required
   parameters.

 - Add notes on all of the inferred or default values.

llvm-svn: 174538
2013-02-06 20:24:23 +00:00
Daniel Dunbar 5178942ded [tests] Change test default to run against locally built library.
llvm-svn: 174528
2013-02-06 17:47:08 +00:00
Daniel Dunbar d2d614cd84 [tests] Enable use_system_lib support on Linux.
- Patch by Michael van der Westhuizen.

llvm-svn: 174527
2013-02-06 17:45:53 +00:00
Daniel Dunbar 434fb1f6d5 [tests] One last batch of XFAILs, for tests using new symbols added to libc++.
- As of this commit, the test suite should now fully pass on both darwin11 and
   darwin12 when testing against either a locally built libc++ or the system libc++.

llvm-svn: 174478
2013-02-06 00:59:06 +00:00
Daniel Dunbar ba65d61767 [tests] Accept XFAIL arguments that match any part of a feature.
llvm-svn: 174469
2013-02-06 00:04:52 +00:00
Daniel Dunbar 36860df355 [tests] XFAIL some locale tests that don't seem to work on any Darwin.
llvm-svn: 174459
2013-02-05 22:51:20 +00:00
Daniel Dunbar b6354a0767 [tests] If no explicit target triple is given, try to infer it.
llvm-svn: 174454
2013-02-05 22:28:03 +00:00
Daniel Dunbar a563f32c6a [tests] Mark another stream input expected failure (with system libc++).
llvm-svn: 174453
2013-02-05 22:21:52 +00:00
Daniel Dunbar d0f05fb1b7 [tests] Mark another stream input expected failure (with system libc++).
llvm-svn: 174452
2013-02-05 22:10:28 +00:00
Daniel Dunbar 5ce9a5358b [tests] Mark some string.conversions expected failures (with system libc++).
llvm-svn: 174451
2013-02-05 22:10:27 +00:00
Daniel Dunbar 1a7f7bc6bf [tests] XFAIL a few things that require libc (?) support missing on Darwin.
llvm-svn: 174450
2013-02-05 22:10:25 +00:00
Daniel Dunbar d15f013dc2 [tests] Mark some istream.unformatted expected failures (with system libc++).
llvm-svn: 174444
2013-02-05 21:43:32 +00:00
Daniel Dunbar 582c97defa [tests] Add an available feature that combines the triple and use_system_lib.
- This is so that we can easily write XFAIL markers for tests that are known
    to fail with versions of libc++ as were shipped with a particular triple.

llvm-svn: 174443
2013-02-05 21:43:30 +00:00
Daniel Dunbar f51f0319bb [tests] Add support for REQUIRES and XFAIL lines in libc++ tests.
- We parse up to the first non-empty non-comment (C++ style) line, otherwise
   the format and semantics match what is used for LLVM/Clang tests.

 - For now, the only interesting thing to test against is a user supplied
   target_triple test parameter.

llvm-svn: 174440
2013-02-05 21:03:25 +00:00
Daniel Dunbar 8495871807 [tests] Add a 'use_system_lib' parameter.
- This controls whether to execute against the locally built library or
   not. The default is currently True which maps to what was already being done
   by default.

 - I'd appreciate it if someone can implement the proper handling of this flag
   on linux, I no longer remember the details of its .so handling.

llvm-svn: 174404
2013-02-05 18:03:49 +00:00
Howard Hinnant d27745e4fb Make a few tests optimization-proof. These tests were failing under -O3 because the optimizer was eliminating the call to new.
llvm-svn: 172631
2013-01-16 17:56:06 +00:00
Howard Hinnant 980e7e7402 Make <cmath> classification macros work with integral types.
llvm-svn: 172461
2013-01-14 20:56:22 +00:00
Howard Hinnant 1afbabab32 Fix string conversions functions to throw out_of_range properly. Fixes http://llvm.org/bugs/show_bug.cgi?id=14919.
llvm-svn: 172447
2013-01-14 18:59:43 +00:00
Howard Hinnant 3778f27b23 Michael van der Westhuizen: Improve support for testing on Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14892.
llvm-svn: 172436
2013-01-14 17:12:54 +00:00