summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/thread/thread.threads
Commit message (Collapse)AuthorAgeFilesLines
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-3120-0/+40
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* [libc++][test] Remove non-portable assumption that thread's constructor ↵Casey Carter2019-05-021-10/+19
| | | | | | | | | | | | | allocates with ::new Drive-by: * Fix potential race between check and update of `throw_one` in `operator new` * Fix latent bug in `operator delete`, which shouldn't decrement `outstanding_new` when passed a null pointer * Specifically catch the expected `bad_alloc` in `main` instead of `...` Differential Revision: https://reviews.llvm.org/D50860 llvm-svn: 359827
* Support tests in freestandingJF Bastien2019-02-0428-28/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1928-112/+84
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Repair thread-unsafe modifications of n_alive in F.pass.cppBilly Robert O'Neal III2018-10-191-4/+10
| | | | | | | | In this example, the ctor of G runs in the main thread in the expression G(), and also in the copy ctor of G() in the DECAY_COPY inside std::thread. The main thread destroys the G() instance at the semicolon, and the started thread destroys the G() after it returns. Thus there is a race between the threads on the n_alive variable. The fix is to join with the background thread before attempting to destroy the G in the main thread. llvm-svn: 344820
* Mork more tests as FLAKYEric Fiselier2018-10-011-0/+1
| | | | llvm-svn: 343435
* [libcxx] [test] Fix Clang -Wunused-local-typedef warnings.Stephan T. Lavavej2017-07-191-1/+0
| | | | | | Fix D34536. llvm-svn: 308534
* Fix or move tests with non-standard assumptionsEric Fiselier2017-05-122-70/+22
| | | | llvm-svn: 302862
* Mark test using <sys/time.h> as UNSUPPORTED on WindowsEric Fiselier2017-05-051-0/+3
| | | | llvm-svn: 302298
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-041-0/+10
| | | | | | | | | | | | | | | Libc++ is used as a system library on macOS and iOS (amongst others). In order for users to be able to compile a binary that is intended to be deployed to an older version of the platform, clang provides the availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_ that can be placed on declarations to describe the lifecycle of a symbol in the library. See docs/DesignDocs/AvailabilityMarkup.rst for more information. Differential Revision: https://reviews.llvm.org/D31739 llvm-svn: 302172
* Implement P0599: 'noexcept for hash functions'. Fix a couple of hash ↵Marshall Clow2017-03-231-0/+3
| | | | | | functions (optional<T> and unique_ptr<T>) which were mistakenly marked as 'noexcept'. Reviewed as https://reviews.llvm.org/D31234 llvm-svn: 298573
* Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCESEric Fiselier2017-03-032-6/+2
| | | | llvm-svn: 296854
* Implement P0513R0 - "Poisoning the Hash"Eric Fiselier2017-01-212-1/+28
| | | | | | | | | | | | | | | | | | | | | Summary: Exactly what the title says. This patch also adds a `std::hash<nullptr_t>` specialization in C++17, but it was not added by this paper and I can't find the actual paper that adds it. See http://wg21.link/P0513R0 for more info. If there are no comments in the next couple of days I'll commit this Reviewers: mclow.lists, K-ballo, EricWF Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D28938 llvm-svn: 292684
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-181-1/+1
| | | | | | No functional change, no code review. llvm-svn: 292434
* Fix unused parameters and variablesEric Fiselier2016-12-232-2/+2
| | | | llvm-svn: 290459
* Fix yet another dynamic exception specEric Fiselier2016-12-111-2/+2
| | | | llvm-svn: 289357
* [libcxx] Recover no-exceptions XFAILs - IAsiri Rathnayake2016-10-061-2/+5
| | | | | | | | | | | | | | | | First batch of changes to get some of these XFAILs working in the no-exceptions libc++ variant. Changed some XFAILs to UNSUPPORTED where the test is all about exception handling. In other cases, used the test macros TEST_THROW and TEST_HAS_NO_EXCEPTIONS to conditionally exclude those parts of the test that concerns exception handling behaviour. Reviewers: EricWF, mclow.lists Differential revision: https://reviews.llvm.org/D24562 llvm-svn: 283441
* Placate MSVC's unchecked malloc warning in thread tests.Eric Fiselier2016-06-221-1/+3
| | | | llvm-svn: 273385
* Move more _LIBCPP_VERSION tests to test/libcxx.Eric Fiselier2016-06-221-22/+0
| | | | llvm-svn: 273365
* Move native_handle thread tests to test/libcxxEric Fiselier2016-06-222-81/+0
| | | | llvm-svn: 273341
* Remove unused local var. Patch from STL@microsoft.comEric Fiselier2016-06-141-1/+1
| | | | llvm-svn: 272622
* Fix TEST_HAS_NO_EXCEPTIONS misspelling in the test suite.Eric Fiselier2016-06-021-1/+1
| | | | llvm-svn: 271501
* Mark LWG issue 2250 as completeEric Fiselier2016-06-022-0/+40
| | | | llvm-svn: 271475
* Remove trailing whitespace in test suite. Approved by Marshall Clow.Eric Fiselier2016-06-011-1/+1
| | | | llvm-svn: 271435
* [libcxx] Fix PR15638 - Only allocate in parent when starting a thread to ↵Eric Fiselier2016-04-201-15/+51
| | | | | | | | | | | | | | | | | | | | | prevent calling terminate. Summary: Hi, When creating a new thread libc++ performs at least 2 allocations. The first allocates a tuple of args and the functor that will be passed to the new thread. The second allocation is for the thread local storage needed internally by libc++. Currently the second allocation happens in the child thread, meaning that if it throws the program will terminate with an uncaught bad alloc. The solution to this is to allocate ALL memory in the parent thread and then pass it to the child. See https://llvm.org/bugs/show_bug.cgi?id=15638 Reviewers: mclow.lists, danalbert, jroelofs, EricWF Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13748 llvm-svn: 266851
* Make it possible to build a no-exceptions variant of libcxx.Asiri Rathnayake2015-11-101-0/+1
| | | | | | | | | | | | Fixes a small omission in libcxx that prevents libcxx being built when -DLIBCXX_ENABLE_EXCEPTIONS=0 is specified. This patch adds XFAILS to all those tests that are currently failing on the new -fno-exceptions library variant. Follow-up patches will update the tests (progressively) to cope with the new library variant. Change-Id: I4b801bd8d8e4fe7193df9e55f39f1f393a8ba81a llvm-svn: 252598
* Remove test_atomic.h headerEric Fiselier2015-08-191-3/+2
| | | | | | | Because <atomic> can now be used in C++03 there is no need for the test_atomic.h header. This commit removes the header and converts all usages to use <atomic> instead. llvm-svn: 245468
* Use TestAtomic instead of std::atomic so the test can run in C++03Eric Fiselier2015-08-191-2/+3
| | | | llvm-svn: 245415
* [libcxx] Add Atomic test helper and fix TSAN failures.Eric Fiselier2015-08-182-6/+6
| | | | | | | | | | | | | | | | | | | Summary: This patch attempts to fix the last 3 TSAN failures on the libc++ bot (http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-tsan/builds/143). This patch also adds a `Atomic` test type that can be used where `<atomic>` cannot. `wait.exception.pass.cpp` and `wait_for.exception.pass.cpp` were failing because the test replaced `std::terminate` with `std::exit`. `std::exit` would asynchronously run the TLS and static destructors and this would cause a race condition. See PR22606 and D8802 for more details. This is fixed by using `_Exit` to prevent cleanup. `notify_all_at_thread_exit.pass.cpp` exercises the same race condition but for different reasons. I fixed this test by manually joining the thread before beginning program termination. Reviewers: EricWF, mclow.lists Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D11046 llvm-svn: 245389
* Remove sanitizer XFAILs on a test.Eric Fiselier2015-07-281-7/+0
| | | | llvm-svn: 243499
* Fix a handful of tests that fail in C++03Eric Fiselier2015-07-281-7/+3
| | | | llvm-svn: 243392
* Get thread sleep_for test passing in C++03Eric Fiselier2015-05-271-2/+5
| | | | llvm-svn: 238273
* Fix race condition in thread test.Eric Fiselier2015-05-191-8/+25
| | | | llvm-svn: 237745
* Fix race conditions in test class used throughout the std::thread tests.Eric Fiselier2015-04-0210-15/+34
| | | | | | | | | | | The test class 'G' reads and writes to the same static variables in its constructor, destructor and call operator. When threads are constructed using `std::thread t((G()))` there is a race condition between the destruction of the temporary and the execution of `G::operator()()`. The fix is to simply create the input before creating the thread. llvm-svn: 233946
* Use generic feature name for sanitizers that replace new and deleteEric Fiselier2015-03-101-1/+1
| | | | llvm-svn: 231841
* libc++ implements its' hash objects as deriving from std::unary_function, ↵Marshall Clow2015-01-071-0/+2
| | | | | | and the tests test for that. STL @ MS pointed out that the standard doesn't requie these objects to derive from unary_function, and so the tests should not require that either. Change the tests to check for the embedded typedefs - which ARE required. No change to the library. llvm-svn: 225403
* Move test into test/std subdirectory.Eric Fiselier2014-12-2030-0/+1397
llvm-svn: 224658
OpenPOWER on IntegriCloud