Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
to a Python script, not an executable. If you were to pass in an
executable, such as the result of py2exe on lit.py, the build would
fall over.
With this patch, the CMake build assumes LIT_EXECUTABLE is an
executable. You can continue setting it to lit.py, but it will
now use its shebang to find a Python interpreter.
Differential Revision: http://reviews.llvm.org/D7315
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228005 91177308-0d34-0410-b5e6-96231b3b80d8
Before this patch, the CMake build assumed LIT_EXECUTABLE pointed
to a Python script, not an executable. If you were to pass in an
executable, such as the result of py2exe on lit.py, the build would
fall over.
With this patch, the CMake build assumes LIT_EXECUTABLE is an
executable. You can continue setting it to lit.py, but it will
now use its shebang to find a Python interpreter.
Differential Revision: http://reviews.llvm.org/D7315
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227994 91177308-0d34-0410-b5e6-96231b3b80d8
he following snippet doesn't build when using gcc and libc++:
#include <string>
void f(const std::string& s) { s.begin(); }
#include <vector>
void AppendTo(const std::vector<char>& v) { v.begin(); }
The problem is that __wrap_iter has a private constructor. It lists vector<>
and basic_string<> as friends, but gcc seems to ignore this for vector<> for
some reason. Declaring vector before the friend declaration in __wrap_iter is
enough to work around this problem, so do that. With this patch, I'm able to
build chromium/android with libc++. Without it, two translation units fail to
build. (iosfwd already provides a forward declaration of basic_string.)
As far as I can tell, this is due to a gcc bug, which I filed as
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64816.
Fixes PR22355.
http://reviews.llvm.org/D7201
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@227226 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
This patch allows the use of LIT's ShTest format in the libc++ test suite. ShTests have the suffix '.sh.cpp'. It also introduces a series of other changes. These changes are:
- More functionality including parsing test metadata has been moved into LIT.
- LibcxxTestFormat now supports multi-part suffixes.
- the `CXXCompiler` functionality has been used to shrink the size of LibcxxTestFormat.
- The recursive loading of the site config has been turned into `libcxx.test.config.loadSiteConfig` so it can be used with libc++abi.
- Temporary files are now created in the build directory of libc++. This follows how it is down in ShTest.
- `not.py` was added as a utility executable that mirrors the functionality of LLVM's `not` executable.
- The first ShTest test was added under test/libcxx/double_include.sh.cpp
Reviewers: jroelofs, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D7073
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226844 91177308-0d34-0410-b5e6-96231b3b80d8
This patch addresses some comments on http://reviews.llvm.org/D7019.
- Move compiler.py to test/libcxx from test/libcxx/test.
- Make CXXCompiler.target None by default.
- Use `{}` instead of `dict()` to initialize an empty dict.
- Pass the -fsanitize options to both the compile and link commands.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226575 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
This adds a compiler utility class that handles generating compile commands and running them. Instead of having to pass the compiler path and 3 groups of flags between the configuration and the test format this allows us to just pass the compiler object.
Reviewers: danalbert, jroelofs
Reviewed By: jroelofs
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D7019
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226323 91177308-0d34-0410-b5e6-96231b3b80d8
When 'no_default_flags' is true only flags passed using '--param=compile_flags'
and '--param=link_flags' will be used when compiling the tests. This option
can be used to run the test suite against libstdc++ and helps with all
unusual test suite configurations.
NOTE: sanitizer flags are still added when '--param=use_sanitizer' is used even
if '--param=no_default_flags' is given.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@226322 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
I've moved the bulk of `lit.cfg` into `test/libcxx/testconfig.py` and
`test/libcxx/testformat.py`. All that remains in `lit.cfg` is the
logic to discover lit.site.cfg if lit.cfg was run directly, and the
logic for loading configuration variants.
The configuration variant flow has changed with this patch. Rather
than instantiating an object of type `<VARIANT>Configuration`, we now
instatiate an object of type `Configuration` that was loaded from the
module `<VARIANT>.testconfig.py`.
This has to be done on a per-project basis rather than in LIT itself
because LIT doesn't actually know where the real test directory is,
only where the site configuration is (which is usually in the output
directory). It's simple enough to do though, so it's fine to require
each project to do it themselves.
I also cleaned up all the pylint issues while I was here, which was
mostly just a matter of fixing long lines.
Reviewers: mclow.lists, jroelofs, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6881
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225532 91177308-0d34-0410-b5e6-96231b3b80d8
I had written the patch that added this test before the tests were
moved into tests/std, so the test ended up in the wrong directory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225300 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
Excerpt from [atomics.types.operations.req]/21:
> When only one memory_order argument is supplied, the value of
> success is order, and the value of failure is order except that a
> value of memory_order_acq_rel shall be replaced by the value
> memory_order_acquire and a value of memory_order_release shall be
> replaced by the value memory_order_relaxed.
Clean up some copy pasta while I'm here (someone added a return
statement to a void function).
Reviewers: EricWF, jroelofs, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6632
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@225280 91177308-0d34-0410-b5e6-96231b3b80d8
The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind
expressions always tries to deduce the return type for Fn(Args...) even when Fn
is not a nested bind expression. This can cause hard compile errors when the
instantation of Fn(Args...) is ill-formed. This patch prevents the instantation
of __invoke_of<Fn, Args...> unless Fn is actually a bind expression.
Bug reportand patch from Michel Morin.
http://llvm.org/bugs/show_bug.cgi?id=22003
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224753 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
MSAN and ASAN also replace new/delete which leads to a link error in these tests. Currently they are unsupported but I think it would be useful if these tests could run with sanitizers.
This patch creates a support header that consolidates the new/delete replacement functionality and checking.
When we are using sanitizers new and delete are no longer replaced and the checks always return true.
Reviewers: mclow.lists, danalbert, jroelofs, EricWF
Reviewed By: EricWF
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6562
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224741 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
In order to fully replace the testit script we need to update LIT so it provides the same functionality.
This patch adds a number of different configuration options to LIT to do that. It also adds documentation for all of the command line parameters that LIT supports.
Generic options added:
- `libcxx_headers`
- `libcxx_library`
- `compile_flags`
Generic options modified:
- `link_flags`: Changed from overriding the default args to adding extra args instead (to match compile flags)
- `use_sanitizer`: Renamed from `llvm_use_sanitizer`
Please see the added documentation for more information about the switches. As for the actual documentation I'm not sure if it should be kept in libc++ forever since it adds an undue maintenance burden, but I think it should be added for the time being while the changes are new. I'm verify unskilled with HTML so if the documentation needs any changes please let me know.
Hopefully this will kill testit.
Reviewers: jroelofs, mclow.lists, danalbert
Reviewed By: danalbert
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D5877
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224728 91177308-0d34-0410-b5e6-96231b3b80d8
Summary:
Currently to run tests in tree you need to symlink the lit.site.cfg file generated by the cmake build into the source tree, and teach your VCS to ignore it.
This allows the user to specify where to find the lit.site.cfg file two different ways:
* lit_site_config lit parameter
* LIT_SITE_CONFIG enviroment variable.
example usage:
```
lit -sv --param=libcxx_site_config=path/to/libcxx-build/test/lit.site.cfg path/to/tests
```
Or
```
export LIBCXX_SITE_CONFIG=path/to/libcxx-build/test/lit.site.cfg
lit -sv path/to/tests
```
The command line parameter will override the environment variable.
If neither options are present a warning is issued and the `lit.cfg` file is loaded directly.
Reviewers: mclow.lists, jroelofs, danalbert
Reviewed By: danalbert
Subscribers: ddunbar, cfe-commits
Differential Revision: http://reviews.llvm.org/D6255
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224671 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@224603 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223593 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223591 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@223068 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222698 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222318 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222298 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222076 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@222025 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221969 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221967 91177308-0d34-0410-b5e6-96231b3b80d8
tests that replace operator new/delete won't link when using ASAN and MSAN
because these sanitizers also replace new/delete.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221236 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220769 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220724 91177308-0d34-0410-b5e6-96231b3b80d8
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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220715 91177308-0d34-0410-b5e6-96231b3b80d8
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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220706 91177308-0d34-0410-b5e6-96231b3b80d8