Summary:
In order to get the bots running quicker I would like to be able to use ccache
with the test suite. This patch adds support for running the test suite using
ccache. To use ccache pass `--param=use_ccache=true` when running the test suite.
ccache will not cache any command that invokes ld, so the build step needs to be
split into two separate compile commands. The cost of splitting the build step
into two parts when not using ccache seems to be minimal. On my machine I saw a
difference of ~5 seconds on a 5 minute test suite run.
A full test suite run with ccache generates about 250MB of cached data.
I recorded the following times for running the test suite in the following configurations:
- no ccache: 340s
- initial ccache run: 380s
- rerun with ccache (no changes): 53s.
- rerun with ccache (<string> changed): 80s
- rerun with ccache (<cmath> changed): 169s
- rerun with ccache (<valarray> changed): 69s
Reviewers: mclow.lists, jroelofs, danalbert
Reviewed By: jroelofs
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6647
llvm-svn: 224603
It might be implicitly included by <pthread.h> (and that's why it worked
so far), but it's not guaranteed (for example, this is not the case with
newlib).
llvm-svn: 223661
Summary:
This patch probes the cxx compiler used during testing by getting it to dump its predefined macros. Based on the value of these macros the compiler name and compiler name + version are added to the available features.
There are three compiler names:
- `clang`
- `apple-clang`
- `gcc`.
The available features added are equivalent to:
- `'%s' % compiler_name`
- `'%s-%s.%s' % compiler_name, major_version, minor_version`
This information can be used to XFAIL tests on different compilers / versions.
Reviewers: mclow.lists, danalbert, jroelofs
Reviewed By: jroelofs
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6399
llvm-svn: 223593
Currently hacks must be used in to configure and build libc++ without threads
when using CMake. This patch adds CMake options to enable/disable building with
threads and a monotonic clock.
This patch also propagates the configuration information to lit so the tests
are properly configured as well.
llvm-svn: 223591
Summary: NaCl shouldn't include sysctl.h when trying to determine std:🧵:hardware_concurrency, it should instead use sysconf(_SC_NPROCESSORS_ONLN) through unistd.h. No test needs to be changed, since hardware_concurrency.pass.cpp already tests that std:🧵:hardware_concurrency > 0.
Test Plan: make check-libcxx
Reviewers: dschuff, danalbert
Subscribers: jfb, cfe-commits
Differential Revision: http://reviews.llvm.org/D6470
llvm-svn: 223128
Summary:
The NaCl sandbox doesn't allow opening files under /dev, but it offers an API which provides the same capabilities. This is the same random device emulation that nacl_io performs for POSIX support, but nacl_io is an optional library so libc++ can't assume that device emulation will be performed. Note that NaCl only supports /dev/urandom, not /dev/random.
This patch also cleans up some of the preprocessor #endif, and fixes the test for Win32 (it accepts any token, and would therefore never throw regardless of the token provided).
Test Plan: ninja check-libcxx
Reviewers: dschuff, mclow.lists, danalbert
Subscribers: jfb, cfe-commits
Differential Revision: http://reviews.llvm.org/D6442
llvm-svn: 223068
Summary:
I finally got around to merging the many, many changes to lit.cfg into
Android's libc++. This patch makes it simpler to actually use a custom
configuration and test format.
First, I've factored out _build, _run, and _clean methods from
_execute_test, since these are the likely parts that will need to be
overridden. This is likely a first step in the work jroelofs has been
doing with improving cross-compiling test execution.
Second, I've added a `configuration_variant` to the config. This
entry, if present, is a string that forms the prefix of the class that
is to be used to configure the test runner. For example, Android sets
`config.configuration_variant = 'Android'`, and this causes an object
of type `AndroidConfiguration` to be constructed.
As an example of how this will be used, see:
https://android-review.googlesource.com/#/c/116022/
Reviewers: jroelofs, mclow.lists, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6373
llvm-svn: 222698
The standard requires that nullptr_t can be reinterpret_cast to an integral type
at least the size of nullptr_t. There is no way to emulate this conversion in
the C++03 nullptr_t implementation. The test for this conversion has been moved
to a new test and marked XFAIL with c++03.
This recommits what was originally r222296.
llvm-svn: 222318
Wrap the original test in _LIBCPP_HAS_QUICK_EXIT so it only runs when we have
quick_exit and add two new tests that check that when _LIBCPP_HAS_QUICK_EXIT
is not defined then no definition of std::at_quick_exit or std::quick_exit are
available.
llvm-svn: 222298
Summary:
Currently we have 5 variables that are used to specify options for building libcxx
1. `LIBCXX_CXX_FEATURE_FLAGS`
2. `LIBCXX_CXX_WARNING_FLAGS`
3. `LIBCXX_CXX_REQUIRED_FLAGS`
4. `compile_flags` (in libcxx/lib)
5. `link_flags` (in libcxx/lib)
The first three all get put into `CMAKE_CXX_FLAGS`.
This changes the way flags are handled by only using 3 different options:
1. `LIBCXX_CXX_FLAGS` - general compile and link flags.
2. `LIBCXX_COMPILE_FLAGS` - compile only flags.
3. `LIBCXX_LINK_FLAGS` - link only flags.
This patch also removes the warning about `-nostdinc++` being unused during linking.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6277
llvm-svn: 222080
The second part of the test checks that std::terminate is called when a running
thread is move assigned to. Calling std::terminate prevents some of the destructors
to be called and ASAN fires on this.
llvm-svn: 222076
Since the initialization of the pointer happens across the libc library boundry
MSAN will not know the pointer was initialized. This fixes MSAN failures in
test/strings/string.conversions.
llvm-svn: 222052
Summary: The strstream function `str()` sets `freeze(true)`. When `freeze` is true the destructor is not allowed to free any dynamically allocated memory. The memory leak causes ASAN to fail on these tests. To ensure memory is deallocated `strstream.freeze(false)` is called at the end of the tests.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6261
llvm-svn: 222025
Summary:
The size of the vector is being increased by `__n` during the call to `__move_range` and not by 1.
This fixes a test failure in `containers/sequences/vector/vector.modifiers/insert_iter_size_value.pass.cpp` when using ASAN.
Reviewers: danalbert, kcc, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6264
llvm-svn: 222014
The test is split such that:
- max_size.pass.cpp tests that string::resize() fails to allocator for max_size
and max_size -1
- over_max_size.pass.cpp tests that string::resize() throws a length error for
max_size + 1
The test was split into two because max_size.pass.cpp cannot pass with
sanitizers but over_max_size.pass.cpp can.
llvm-svn: 221969
These tests fail for 2 reasons when using ASAN and MSAN.
1. If allocator_may_return_null=0 they will fail because null is returned
or an exception is thrown.
2. When allocator_may_return_null=1 the new_handler is still not called. This
results in an assertion failures.
llvm-svn: 221967
Summary:
http://llvm.org/bugs/show_bug.cgi?id=18345
Tuple's constructor and assignment operators for "tuple-like" types evaluates __make_tuple_types unnecessarily. In the case of a large array this can blow the template instantiation depth.
Ex:
```
#include <array>
#include <tuple>
#include <memory>
typedef std::array<int, 1256> array_t;
typedef std::tuple<array_t> tuple_t;
int main() {
array_t a;
tuple_t t(a); // broken
t = a; // broken
// make_shared uses tuple behind the scenes. This bug breaks this code.
std::make_shared<array_t>(a);
}
```
To prevent this from happening we delay the instantiation of `__make_tuple_types` until after we perform the length check. Currently `__make_tuple_types` is instantiated at the same time that the length check .
Test Plan: Two tests have been added. One for the "tuple-like" constructors and another for the "tuple-like" assignment operator.
Reviewers: mclow.lists, EricWF
Reviewed By: EricWF
Subscribers: K-ballo, cfe-commits
Differential Revision: http://reviews.llvm.org/D4467
llvm-svn: 220769
For targets that end it `redhat-linux` and `suse-linux` manually add the `-gnu`
section of the target since `linux-gnu` is needed in the testsuite.
This patch also moves the removal of minor and patchlevel numbers from OSX
triples to be handled when deducing the triple instead of when adding available
features.
llvm-svn: 220724
Summary: This fixes ODR violations in C++03 mode in test/localization/locale.stdcvt. The special case for linux was introduced in 2010 before clang always defined __char16_t and __char32_t.
Reviewers: mclow.lists, danalbert, jroelofs, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5930
llvm-svn: 220716
The comma operators in the test iterators give better error messages when they
are deleted as opposed to not defined. Delete these functions when possible.
llvm-svn: 220715
Summary:
An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected.
Modify all the test iterators to define operator comma.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5929
llvm-svn: 220706
Although the current method is valid up till python 3.3 (which is not supported)
this seems to be a clearer way of checking for linux and moves the tests towards
python 3 compatibility.
llvm-svn: 220534
Summary:
Pretty please? We now have a significant number of builders that test libc++. I really want those builders to be green.
Most of these failures are due to differences in locale data, including those in regex. I will continue working on fixing the locale and regex tests but there is no consensus on what the correct direction to go.
Since the builders display a list of XFAIL tests they are by no means hidden. It just means they are expected failures. Now unexpected failures won't get mixed in with well known and expected failures.
Reviewers: mclow.lists, jroelofs, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5941
llvm-svn: 220512
This essentially re-does r194825 and makes it possible to run clang
with libc++ without having to install it, even if you don't have any
version of libc++ installed in /usr/.
This behaviour broke in r210577/r211629, which fixed pr18681.
llvm-svn: 220489
Summary:
This patch is very closely related to D4859. Please see http://reviews.llvm.org/D4859 for more information.
This patch adds support for "fancy" pointers and allocators to promise and packaged_task. The changes made to support this are exactly the same as in D4859.
Test Plan: "fancy" pointer tests were added to each constructor affected by the change.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4862
llvm-svn: 220471
Summary:
This patch add support for "fancy pointers/allocators" as well as fixing support for shared_pointer and "minimal" allocators.
Fancy pointers are class types that meet the NullablePointer requirements. In our case they are created by fancy allocators. `support/min_allocator.h` is an archetype for these types.
There are three types of changes made in this patch:
1. `_Alloc::template rebind<T>::other` -> `__allocator_traits_rebind<_Alloc, T>::type`. This change was made because allocators don't need a rebind template. `__allocator_traits_rebind` is used instead of `allocator_traits::rebind` because use of `allocator_traits::rebind` requires a workaround for when template aliases are unavailable.
2. `a.deallocate(this, 1)` -> `a.deallocate(pointer_traits<self>::pointer_to(*this), 1)`. This change change is made because fancy pointers aren't always constructible from raw pointers.
3. `p.get()` -> `addressof(*p.get())`. Fancy pointers aren't actually a pointer. When we need a "real" pointer we take the address of dereferencing the fancy pointer. This should give us the actual raw pointer.
Test Plan: Tests were added using `support/min_allocator.h` to each affected shared_ptr overload and creation function. These tests can only be executed in C++11 or greater since min_allocator is only available then. A extra test was added for the non-variadic versions of allocate_shared.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4859
llvm-svn: 220469
Clang 3.6 no longer links the sanitizer runtime library dependancies when
-nodefaultlibs is used. This patch manually links in a missing dependancy.
llvm-svn: 220463
Summary:
This is the second attempt at allowing for the use of libraries that the linker cannot find. The first attempt used `CMAKE_LIBRARY_PATH` and `find_library` to select which ABI library should be used. There were a number of problems with this approach:
- `find_library` didn't work with cmake targets (ie in-tree libcxxabi build)
- It wasn't always possible to determine where `find_library` actually found your library.
- `target_link_libraries` inserted the path of the ABI library into libc++'s RPATH when `find_library` was used.
- Linking libc++ and it's ABI library is a special case. It's a lot easier to keep it simple.
After discussion with @cbergstrum a new approach was decided upon.
This patch achieve the same ends by simply using `LIBCXX_CXX_ABI_LIBRARY_PATH` to specify where to find the library (if the linker won't find it). When this variable is defined it is simply added as a library search path when linking libc++. It is a lot easier to duplicate this behavior in LIT. It also prevents libc++ from being linked with an RPATH.
Reviewers: mclow.lists, cbergstrom, chandlerc, danalbert
Reviewed By: chandlerc, danalbert
Subscribers: chandlerc, cfe-commits
Differential Revision: http://reviews.llvm.org/D5860
llvm-svn: 220157
When libcxx is built in-tree with libcxxabi it links against libcxxabi using
the name of the cmake target and not the actual library name. The cmake target
will not work with `find_library()`, so it needs special case handling.
llvm-svn: 220121
Summary:
This patch adds support for building/testing libc++ with an ABI library that the linker would not normally find.
- `CMAKE_LIBRARY_PATH` is used to specify the list of search directories.
- The ABI library is now found using `find_library` instead of assuming its along the linker's search path.
- `CMAKE_LIBRARY_PATH` is passed to our LIT config as `library_paths`.
- For each path in `library_paths` the following flags are added `-L<path> -Wl,-rpath -Wl,<path>`
Some changes in existing behavior were also added:
- `target_link_libraries` is now passed the ABI library file instead of the library name. Ex `target_link_libraries(cxx "/usr/lib/libc++abi.so")` vs `target_link_libraries(cxx "c++abi")`.
- `-Wl,-rpath -Wl,<path>` is now used on OSX to link to libc++ instead of env['DYLD_LIBRARY_PATH'] if `use_system_lib=False`.
Reviewers: mclow.lists, danalbert, EricWF
Reviewed By: EricWF
Subscribers: emaste, cfe-commits
Differential Revision: http://reviews.llvm.org/D5038
llvm-svn: 220118
Delay instantiation of `__numeric_type` within <cmath>,
don't instantiate it when the `is_arithmetic` conditions do not hold as it causes
errors with user-defined types with ambiguous conversions. Fixes PR21083.
llvm-svn: 219998
LLVM_USE_SANITIZER=Undefined support was added to the LLVM CMake configuration.
Update libc++'s handling of LLVM_USE_SANITIZER to support this as well.
llvm-svn: 219987
With clang, the header atomic requires __has_feature(cxx_atomic), which is only
true in c++11 mode. Because of this, when using modules in c++98 with libc++
compilation of the std module would fail without this change, PR21002.
(With gcc, only gcc4.7+ is needed, no c++11. But gcc doesn't have modules yet,
and the module.modulemap language can't express things like "this is only
required if the compiler is clang". If gcc gets module support, we'd probably
have a module.modulemap file for each compiler that libc++ supports?)
llvm-svn: 218372
Summary:
I changed the build so that each ABI header gets its own install rule. This gives us the flexibility to install different headers in different directories.
This also fixes the problem where libstdc++ bits/<header>'s were not being installed under a bits directory.
Test Plan: I tested this patch on linux against libstdc++ and libcxxabi.
Reviewers: danalbert, mclow.lists, jroelofs
Reviewed By: jroelofs
Subscribers: jhunold, cfe-commits
Differential Revision: http://reviews.llvm.org/D5454
llvm-svn: 218309
GCC 4.9 fails to inline these functions at -O1 because they are used
indirectly. Declare them as inline instead of always_inline. Discussion
in GCC bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63220
llvm-svn: 217961
These calls are allowed to fail spuriously.
29.6.5.25:
Remark: A weak compare-and-exchange operation may fail spuriously.
That is, even when the contents of memory referred to by expected
and object are equal, it may return false and store back to expected
the same memory contents that were originally there. [ Note: This
spurious failure enables implementation of compare and-exchange on a
broader class of machines, e.g., load-locked store-conditional
machines. A consequence of spurious failure is that nearly all uses
of weak compare-and-exchange will be in a loop.
To fix this, we replace any assert() that expects
std::atomic::compare_exchange_weak() to return true with a loop. If the
call does not return true within N runs (with N currently equal to 10),
then the test fails.
http://llvm.org/bugs/show_bug.cgi?id=20546
llvm-svn: 217319
If you're crazy enough to want this sort of thing, then add
-D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and
--param=additiona_features=libcpp-has-no-threads to your lit commnad line.
http://reviews.llvm.org/D3969
llvm-svn: 217271
This modifies the use_clang_verify parameter I added in r217009 to
only apply to tests that specifically ask for it via // USE_VERIFY.
This allows us to incrementally convert tests, but start enjoying the
benefits right away.
Suggested by Eric Fiselier in code review.
llvm-svn: 217017
Currently, failure tests work by checking that compilation exits 1.
This can lead to tests that fail for the wrong reason, so it'd be
preferable to convert them to check for specific errors.
This adds use_clang_verify parameter that runs failure tests using
clang's -verify flag. I'll convert some tests in subsequent commits,
and once all of the tests are converted we should key this on whether
cxx_under_test is clang.
I've also converted one of the unique.ptr tests, since it's the one
that motivated the idea of using clang -verify when possible in the
review of r216317.
llvm-svn: 217009
The way the standard currently specifies the default constructor for atomic<T>
requires T to be nothrow default constructible. This patch makes our test types
meet this requirement.
Note: The nothrow default constructible requirment is subject to the outcome of
LWG issue 1265.
llvm-svn: 216561
After discussing implementing more tests for this with @danalbert & @mclow, I
realized this change is not correct.
The C++ standard requires do_is() to behave as if it were a loop that checked
is(). Furthermore, it requires is() to check "The first form returns the result
of the expression (M & m) != 0; i.e., true if the character has the
characteristics specified"... which the reverted patch definitely does not
conform to. Even further, furthermore, this requires that ctype's mask be an
actual bitmask, unlike what android and newlib provide for _ctype_.
Fixing the original bug that instigated this patch remains TBD.
llvm-svn: 216508
Summary:
In order to gather more information about testsuite results these flags should be added to LIT's default args.
These new switches were recently added to LIT. It been more than two weeks since both switches were added.
I think its time we add these to our LIT flags.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5037
llvm-svn: 216315
The purely imperative format of the configuration performed in lit.cfg
was making merge conflicts with changes I have for Android an
unbelievable pain in the ass. I've moved all of the configuration into a
Configuration class, with each piece of configuration happening in a
different method. This way I can avoid merge conflicts, and any new
features that get added (as have been done with the sanitizers, the -std
flag, etc.) can be easily applied to Android as well.
Reviewers: mclow.lists, EricWF
Reviewed By: EricWF
Differential Revision: http://reviews.llvm.org/D4952
llvm-svn: 216196
This marks some of the localization test XFAIL on linux.
There has been some discussion on D4861 about doing this.
Please let me know if any of these tests for you on linux.
llvm-svn: 216151
This marks some of the localization test XFAIL on linux.
There has been some discussion on D4861 about doing this.
Please let me know if any of these tests for you on linux.
llvm-svn: 216150
This marks some of the localization test XFAIL on linux.
There has been some discussion on D4861 about doing this.
Please let me know if any of these tests for you on linux.
llvm-svn: 216148
Summary:
This patch adds support for // UNSUPPORTED: feature. If an excluded feature is found in the list of available features then the test is marked unsupported.
I hope to use this to mark test unsupported if the fail with msan on asan. As well as tests that fail in particular standard modes.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4950
llvm-svn: 215883
Summary:
Instead of having to update test results for different platforms it would be helpful to just supply links to buildbots that build+test libcxx.
For the FreeBSD bots Pawel Worach gave me the OK to link to them.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4947
llvm-svn: 215882
Summary:
This patch adds support for LLVM_USE_SANITIZER when being built in-tree and standalone.
This patch does the following things:
1. define the LLVM_USE_SANITIZER option to "" when being built standalone. This also helps show we support it.
2. Translate LLVM_USE_SANITIZER when standalone in a very similar way done in llvm/cmake/HandleLLVMOptions.cmake.
3. Add config.llvm_use_sanitizer to lit.site.cfg.in
4. Add code to translate config.llvm_use_sanitizer's value into the needed compile flags in lit.cfg.
Currently lit.cfg assumes that that the compiler supports '-fno-omit-frame-pointer' while CMakeLists.txt actually checks to see if its supported. We could pass this information to lit but I'm not sure its needed.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4949
llvm-svn: 215872
Summary:
This patch does two things:
CMake Update:
- Add compiler flag checks for -std=c++11 and -std=c++1y and remove check for -std=c++0x.
- Add configuration option LIBCXX_ENABLE_CXX1Y to prevent/allow -std=c++1y from being chosen as the std version. LIBCXX_ENABLE_CXX1Y is set to OFF by default.
- if LIBCXX_ENABLE_CXX1Y is enabled then set LIBCXX_STD_VERSION to c++1y and fail if the compiler does not support -std=c++1y
- If c++1y is not enabled then use c++11 and fail if the compiler does not support c++11.
Lit Update:
- Update lit.site.cfg.in to capture LIBCXX_STD_VERSION information as config.std.
- Remove mentions of has_cxx0X configuration option.
- Check for `--param std=X' passed to lit on the command line.
- Choose the std for the tests either from command line parameter or (if it doesn't exist) the lit.site.cfg.
Reviewers: mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: emaste, rnk, ajwong, danalbert, cfe-commits
Differential Revision: http://reviews.llvm.org/D4329
llvm-svn: 215802
Add initial support for using LIT to run the tests on FreeBSD.
More work may need to be done to add support for FreeBSD but this is a
good initial step.
llvm-svn: 215742
Turning off explicit template instantiation leads to a pretty
significant build time and code size cost. We're better off dealing
with ABI incompatibility issues that come up in a less heavy handed
way.
This reverts commit r189610.
llvm-svn: 215740
The build file was trying to use LIBCXX_VERSION, which isn't set
anywhere, and also forgot to split the 'compile_flags' list.
Differential Revision: http://reviews.llvm.org/D4860
llvm-svn: 215463
This patch removes the use of the "%c" specifier for getting/setting times.
The semantics of this specifier differ between linux and Mac. I don't believe
the use of this specifier was important to the test.
The following tests now pass on linux.
test/input.output/iostream.format/ext.manip/get_time.pass.cpp
test/input.output/iostream.format/ext.manip/put_time.pass.cpp
llvm-svn: 215417