summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan
Commit message (Collapse)AuthorAgeFilesLines
* [TSan] Pacify flaky test on DarwinJulian Lettner2019-12-111-7/+18
| | | | | | | | | | | This flaky test that I added really gives our CI a lot of headaches. Although I was never able to reproduce this locally, it sporadically hangs/fails on our bots. I decided to silently pass the test whenever we are unable to setup the proper test condition after 10 retries. This is of course suboptimal and a last recourse. Please let me know if you know how to test this better. rdar://57844626
* [compiler-rt] [test] Disable ASLR on ASAN/MSAN/TSAN tests on NetBSDMichał Górny2019-12-061-0/+3
| | | | | | | | Use a new %run wrapper for ASAN/MSAN/TSAN tests that calls paxctl in order to disable ASLR on the test executables. This makes it possible to test sanitizers on systems where ASLR is enabled by default. Differential Revision: https://reviews.llvm.org/D70958
* Rename `tsan/race_range_pc.cc` to `test/tsan/race_range_pc.cpp`.Dan Liew2019-12-031-0/+0
| | | | The old suffix was preventing it from being executed by default.
* [TSan] Make `mach_vm_allocate.c` test less flakyJulian Lettner2019-11-211-5/+8
| | | | rdar://57365733
* [CMake] Fix the value of `config.target_cflags` for non-macOS Apple ↵Dan Liew2019-10-011-29/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platforms. Attempt #3. The main problem here is that `-*-version_min=` was not being passed to the compiler when building test cases. This can cause problems when testing on devices running older OSs because Clang would previously assume the minimum deployment target is the the latest OS in the SDK which could be much newer than what the device is running. Previously the generated value looked like this: `-arch arm64 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` With this change it now looks like: `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` This mirrors the setting of config.target_cflags on macOS. This change is made for ASan, LibFuzzer, TSan, and UBSan. To implement this a new `get_test_cflags_for_apple_platform()` function has been added that when given an Apple platform name and architecture returns a string containing the C compiler flags to use when building tests. This also calls a new helper function `is_valid_apple_platform()` that validates Apple platform names. This is the third attempt at landing the patch. The first attempt (r359305) had to be reverted (r359327) due to a buildbot failure. The problem was that calling `get_test_cflags_for_apple_platform()` can trigger a CMake error if the provided architecture is not supported by the current CMake configuration. Previously, this could be triggered by passing `-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were generating test configurations for a list of architectures without checking if the relevant Sanitizer actually supported that architecture. We now intersect the list of architectures for an Apple platform with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer name) to iterate through the correct list of architectures. The second attempt (r363633) had to be reverted (r363779) due to a build failure. The failed build was using a modified Apple toolchain where the iOS simulator SDK was missing. This exposed a bug in the existing UBSan test generation code where it was assumed that `COMPILER_RT_ENABLE_IOS` implied that the toolchain supported both iOS and the iOS simulator. This is not true. This has been fixed by using the list `SANITIZER_COMMON_SUPPORTED_OS` for the list of supported Apple platforms for UBSan. For consistency with the other Sanitizers we also now intersect the list of architectures with UBSAN_SUPPORTED_ARCH. rdar://problem/50124489 Differential Revision: https://reviews.llvm.org/D61242 llvm-svn: 373405
* [TSAN] Add read/write range interface functions with PCJoachim Protze2019-09-241-0/+40
| | | | | | | | | | Adding annotation function variants __tsan_write_range_pc and __tsan_read_range_pc to annotate ranged access to memory while providing a program counter for the access. Differential Revision: https://reviews.llvm.org/D66885 llvm-svn: 372730
* Remove NOLINTs from compiler-rtVitaly Buka2019-09-113-16/+22
| | | | llvm-svn: 371687
* Update compiler-rt cpplint.pyVitaly Buka2019-09-111-4/+4
| | | | | | https://github.com/cpplint/cpplint/commit/adb3500107f409ac5491188ae652ac3f4d03d9d3 llvm-svn: 371675
* Remove xfail NetBSD mark from ignored-interceptors-mmap.cppKamil Rytarowski2019-09-101-1/+0
| | | | | | This test now passes. llvm-svn: 371574
* [TSan] Add AnnotateIgnoreReadsBegin declaration to tsan/test.hJulian Lettner2019-09-096-31/+5
| | | | | | | | | | | | Declare the family of AnnotateIgnore[Read,Write][Begin,End] TSan annotations in compiler-rt/test/tsan/test.h so that we don't have to declare them separately in every test that needs them. Replace usages. Leave usages that explicitly test the annotation mechanism: thread_end_with_ignore.cpp thread_end_with_ignore3.cpp llvm-svn: 371446
* [TSan] Add interceptors for mach_vm_[de]allocateJulian Lettner2019-09-091-0/+73
| | | | | | | | | | | | I verified that the test is red without the interceptors. rdar://40334350 Reviewed By: kubamracek, vitalybuka Differential Revision: https://reviews.llvm.org/D66616 llvm-svn: 371439
* [TSan] Add interceptors for os_unfair_lockJulian Lettner2019-08-161-0/+30
| | | | llvm-svn: 369164
* [TSan] Fix test failing on LinuxJulian Lettner2019-08-131-1/+1
| | | | llvm-svn: 368641
* [TSAN] Fix tsan on FreeBSD after D54889Alexander Richardson2019-08-061-1/+1
| | | | | | | | | | | | | | | | | | Summary: It appears that since https://reviews.llvm.org/D54889, BackgroundThread() crashes immediately because cur_thread()-> will return a null pointer which is then dereferenced. I'm not sure why I only see this issue on FreeBSD and not Linux since it should also be unintialized on other platforms. Reviewers: yuri, dvyukov, dim, emaste Subscribers: kubamracek, krytarowski, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D65705 llvm-svn: 368103
* compiler-rt: Remove .cc from all lit config filesNico Weber2019-08-051-1/+1
| | | | | | All cc files have been renamed to cpp now. llvm-svn: 367911
* compiler-rt: Rename .cc file in test/tsan to .cppFangrui Song2019-08-02235-47/+47
| | | | | | Like r367463, but for test/tsan. llvm-svn: 367656
* compiler-rt: Rename .cc file in lib/tsan/rtl to .cppNico Weber2019-08-013-3/+3
| | | | | | Like r367463, but for tsan/rtl. llvm-svn: 367564
* compiler-rt: Rename .cc file in lib/sanitizer_common to .cppNico Weber2019-07-311-1/+1
| | | | | | | | | | | See https://reviews.llvm.org/D58620 for discussion, and for the commands I ran. In addition I also ran for f in $(svn diff | diffstat | grep .cc | cut -f 2 -d ' '); do rg $f . ; done and manually updated (many) references to renamed files found by that. llvm-svn: 367463
* [TSan] Enable fiber tests on iOS simulatorJulian Lettner2019-07-225-5/+5
| | | | | | | | | These tests *do not* work on device, but they *do* work in the simulator. rdar://53403778 llvm-svn: 366738
* XFAIL a few failing TSan-fiber tests for iOSJulian Lettner2019-07-055-0/+5
| | | | llvm-svn: 365254
* [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*Reid Kleckner2019-06-278-12/+12
| | | | | | | | | | | | | These lit configuration files are really Python source code. Using the .py file extension helps editors and tools use the correct language mode. LLVM and Clang already use this convention for lit configuration, this change simply applies it to all of compiler-rt. Reviewers: vitalybuka, dberris Differential Revision: https://reviews.llvm.org/D63658 llvm-svn: 364591
* Revert r363633 "[CMake] Fix the value of `config.target_cflags` for ↵Hans Wennborg2019-06-191-42/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | non-macOS Apple platforms. Attempt #2." This caused Chromium's clang package to stop building, see comment on https://reviews.llvm.org/D61242 for details. > Summary: > The main problem here is that `-*-version_min=` was not being passed to > the compiler when building test cases. This can cause problems when > testing on devices running older OSs because Clang would previously > assume the minimum deployment target is the the latest OS in the SDK > which could be much newer than what the device is running. > > Previously the generated value looked like this: > > `-arch arm64 -isysroot > <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` > > With this change it now looks like: > > `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot > <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` > > This mirrors the setting of `config.target_cflags` on macOS. > > This change is made for ASan, LibFuzzer, TSan, and UBSan. > > To implement this a new `get_test_cflags_for_apple_platform()` function > has been added that when given an Apple platform name and architecture > returns a string containing the C compiler flags to use when building > tests. This also calls a new helper function `is_valid_apple_platform()` > that validates Apple platform names. > > This is the second attempt at landing the patch. The first attempt (r359305) > had to be reverted (r359327) due to a buildbot failure. The problem was > that calling `get_test_cflags_for_apple_platform()` can trigger a CMake > error if the provided architecture is not supported by the current > CMake configuration. Previously, this could be triggered by passing > `-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were > generating test configurations for a list of architectures without > checking if the relevant Sanitizer actually supported that architecture. > We now intersect the list of architectures for an Apple platform > with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer > name) to iterate through the correct list of architectures. > > rdar://problem/50124489 > > Reviewers: kubamracek, yln, vsk, juliehockett, phosek > > Subscribers: mgorny, javed.absar, kristof.beyls, #sanitizers, llvm-commits > > Tags: #llvm, #sanitizers > > Differential Revision: https://reviews.llvm.org/D61242 llvm-svn: 363779
* [CMake] Fix the value of `config.target_cflags` for non-macOS Apple ↵Dan Liew2019-06-171-28/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platforms. Attempt #2. Summary: The main problem here is that `-*-version_min=` was not being passed to the compiler when building test cases. This can cause problems when testing on devices running older OSs because Clang would previously assume the minimum deployment target is the the latest OS in the SDK which could be much newer than what the device is running. Previously the generated value looked like this: `-arch arm64 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` With this change it now looks like: `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` This mirrors the setting of `config.target_cflags` on macOS. This change is made for ASan, LibFuzzer, TSan, and UBSan. To implement this a new `get_test_cflags_for_apple_platform()` function has been added that when given an Apple platform name and architecture returns a string containing the C compiler flags to use when building tests. This also calls a new helper function `is_valid_apple_platform()` that validates Apple platform names. This is the second attempt at landing the patch. The first attempt (r359305) had to be reverted (r359327) due to a buildbot failure. The problem was that calling `get_test_cflags_for_apple_platform()` can trigger a CMake error if the provided architecture is not supported by the current CMake configuration. Previously, this could be triggered by passing `-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were generating test configurations for a list of architectures without checking if the relevant Sanitizer actually supported that architecture. We now intersect the list of architectures for an Apple platform with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer name) to iterate through the correct list of architectures. rdar://problem/50124489 Reviewers: kubamracek, yln, vsk, juliehockett, phosek Subscribers: mgorny, javed.absar, kristof.beyls, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D61242 llvm-svn: 363633
* [TSan][libdispatch] Use FileCheck's --implicit-check-not=...Julian Lettner2019-05-1618-37/+18
| | | | | | | | | | | | | | | | | | | | | | | Use FileCheck's --implicit-check-not='ThreadSanitizer' which increases the strictness of our tests a bit. NFC. ``` CHECK: start CHECK-NOT: ThreadSanitizer CHECK: done ``` With --implicit-check-not, the above is turned into: ``` CHECK-NOT: ThreadSanitizer CHECK: start CHECK-NOT: ThreadSanitizer CHECK: done CHECK-NOT: ThreadSanitizer ``` llvm-svn: 360927
* [TSan][libdispatch] Enable test that supposedly deadlocks on botJulian Lettner2019-05-091-2/+0
| | | | | | | | Re-enable test that was disabled because it deadlocks when running on the bot, but was never enabled again. Can't reproduce deadlock locally so trying to investigate by re-enabling test. llvm-svn: 360388
* [tsan] Fix and re-enable user_malloc.cc testVitaly Buka2019-05-011-9/+9
| | | | | | | | | | | | | | Summary: no_sanitize_thread is not enough as it still puts some tsan instrumentation Reviewers: eugenis Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D61393 llvm-svn: 359731
* Revert "[CMake] Fix the value of `config.target_cflags` for non-macOS Apple"Dan Liew2019-04-261-10/+2
| | | | | | | | | | | | | | | | | | | | | This reverts commit 1bcdbd68616dc7f8debe126caafef7a7242a0e6b. It's been reported that some bots are failing with this change with CMake error like: ``` CMake Error at /b/s/w/ir/k/llvm-project/compiler-rt/cmake/config-ix.cmake:177 (message): Unsupported architecture: arm64 Call Stack (most recent call first): /b/s/w/ir/k/llvm-project/compiler-rt/cmake/config-ix.cmake:216 (get_target_flags_for_arch) /b/s/w/ir/k/llvm-project/compiler-rt/test/tsan/CMakeLists.txt:78 (get_test_cflags_for_apple_platform) ``` I'm reverting the patch now to unbreak builds. I will investigate properly when time permits. rdar://problem/50124489 llvm-svn: 359327
* [CMake] Fix the value of `config.target_cflags` for non-macOS AppleDan Liew2019-04-261-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platforms. The main problem here is that `-*-version_min=` was not being passed to the compiler when building test cases. This can cause problems when testing on devices running older OSs because Clang would previously assume the minimum deployment target is the the latest OS in the SDK which could be much newer than what the device is running. Previously the generated value looked like this: `-arch arm64 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` With this change it now looks like: `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk` This mirrors the setting of `config.target_cflags` on macOS. This change is made for ASan, LibFuzzer, TSan, and UBSan. To implement this a new `get_test_cflags_for_apple_platform()` function has been added that when given an Apple platform name and architecture returns a string containing the C compiler flags to use when building tests. This also calls a new helper function `is_valid_apple_platform()` that validates Apple platform names. rdar://problem/50124489 Differential Revision: https://reviews.llvm.org/D58578 llvm-svn: 359305
* [TSan] Support fiber API on macOSJulian Lettner2019-04-207-15/+21
| | | | | | | | | | | | | | Committing on behalf of Yuri Per (yuri). Reviewers: dvyukov, kubamracek, yln Reviewed By: kubamracek Authored By: yuri Differential Revision: https://reviews.llvm.org/D58110 llvm-svn: 358802
* [TSan][libdispatch] Port gcd-sync-block-copy.mm to C++Julian Lettner2019-04-162-3/+52
| | | | | | | | | | | | | | | | | | | | | | | Summary: Apparently, it makes a difference on where a block lives depending on if it's passed "inline" versus assigned and then passed via a variable. Both tests in this commit now give a signal, if `Block_copy` is used in `dispatch_sync`. Since these tests use different mechanisms (Objective-C retain versus C++ copy constructor) as proxies to observe if the block was copied, we should keep both of them. Commit, that first avoided the unnecessary copy: faef7d034a9ec6cb757137adce8e8670ec6c2d7b Subscribers: kubamracek, #sanitizers, llvm-commits Tags: #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60639 llvm-svn: 358469
* [TSan][libdispatch] Move libdispatch tests out of Darwin folderJulian Lettner2019-04-1223-6/+8
| | | | | | | The libdispatch tests are now not tied to Darwin anymore. Move them to their own platform-independent folder. llvm-svn: 358316
* [TSan][libdispatch] Don't link against FoundationJulian Lettner2019-04-126-13/+22
| | | | | | | Now that our tests don't depend on Foundation anymore, don't link it in. llvm-svn: 358309
* [TSan][libdispatch] Replace NSTemporaryDirectory in testsJulian Lettner2019-04-126-13/+8
| | | | | | | | | | | | | After this change, most tests don't have a dependency on Foundation. Note: To hold the file name `tempnam` allocates a new buffer. We leak this buffer (omit the free), but I don't think we need to care. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60591 llvm-svn: 358308
* [TSan][libdispatch] Fix failing testJulian Lettner2019-04-121-0/+1
| | | | | | | | | The ThreadSanitizer-x86_64-iossim configuration (different SDK) seems to require an additional #include. rdar://49856637 llvm-svn: 358300
* [TSan][libdispatch] Delete old testsJulian Lettner2019-04-112-69/+0
| | | | | | | | | | In a previous commit, I re-enabled the ported variants of these 2 tests: tsan/Darwin/gcd-data.mm -> tsan/libdispatch/data.c tsan/Darwin/gcd-source-serial.mm -> tsan/libdispatch/source-serial.c So now we can delete the Darwin-only version. llvm-svn: 358235
* [TSan][libdispatch] Re-enable disabled testsJulian Lettner2019-04-112-6/+0
| | | | | | | | I re-activated "broad strokes suppressions" (ignore_noninstrumented_modules=1) in my last commit. Re-enable tests that only fail on our bots to check if they work now. llvm-svn: 358209
* [TSan][libdispatch] Turn ignore_noninstrumented_modules=1 back on for DarwinJulian Lettner2019-04-111-0/+3
| | | | llvm-svn: 358208
* [TSan][libdispatch] Replace usage of NSMutableData with stack arrayJulian Lettner2019-04-115-10/+10
| | | | | | | | Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60477 llvm-svn: 358205
* [TSan][libdispatch] Change test to have two simultaneous timersJulian Lettner2019-04-111-1/+1
| | | | | | | | | | | Change test semantics by waiting for both timer callbacks at the end instead of serializing operations: start/wait timer 1 then 2. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60476 llvm-svn: 358204
* [TSan][libdispatch] Replace CFRunLoop with dispatch_semaphore, pt. 2Julian Lettner2019-04-1111-83/+97
| | | | | | | | Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D60475 llvm-svn: 358203
* [TSan][libdispatch] Replace CFRunLoop with dispatch_semaphore, pt. 1Julian Lettner2019-04-096-53/+54
| | | | | | | | | | | | Remove the dependency on Foundation so we can start running those tests on other platforms. Rename/move of tests will be done in a separate commit. Reviewed By: kubamracek, dvyukov Differential Revision: https://reviews.llvm.org/D60347 llvm-svn: 358023
* [TSan][libdispatch] Remove Darwin-only version of fully-ported testsJulian Lettner2019-04-0610-428/+0
| | | | | | | Remove 10 tests that already have a copy in tsan/libdispatch, without dependencies on Darwin-specifis. llvm-svn: 357832
* [TSan][libdispatch] Make test work on Linux, pt. 2Julian Lettner2019-04-051-2/+2
| | | | llvm-svn: 357741
* [TSan][libdispatch] Make test work on LinuxJulian Lettner2019-04-041-3/+4
| | | | llvm-svn: 357729
* [TSan][libdispatch] Stricter checks via `--implicit-check-not`Julian Lettner2019-04-047-16/+8
| | | | | | | | `--implicit-check-not='ThreadSanitizer'` checks in the entire output while `// CHECK-NOT: ThreadSanitizer` only checks after (before) the previous (next) match. llvm-svn: 357727
* [TSan][libdispatch] Specify libdispatch header dir for lit testsJulian Lettner2019-04-041-5/+6
| | | | | | | | | Specify libdispatch header dir (include path) for lit tests. This is the last missing piece in order to run the libdispatch tests on Linux even when libdispatch is installed in a custom path instead of a default (system) location. llvm-svn: 357707
* [NFC][TSan][libdispatch] Better CMake variable namesJulian Lettner2019-04-041-2/+2
| | | | llvm-svn: 357664
* Fix typos in tests. NFC.Xing GUO2019-04-031-1/+1
| | | | | | | | | | | | | | Reviewers: Higuoxing Reviewed By: Higuoxing Subscribers: kubamracek, cfe-commits, #sanitizers, llvm-commits Tags: #clang, #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D60183 llvm-svn: 357577
* [NFC][TSan][libdispatch] Cleanup testJulian Lettner2019-04-021-6/+6
| | | | llvm-svn: 357530
* [NFC] Test is C++, not CJulian Lettner2019-04-021-0/+0
| | | | llvm-svn: 357524
OpenPOWER on IntegriCloud