Commit Graph

171 Commits

Author SHA1 Message Date
Evan Wilde
9036dbc326 FreeBSD: TSan: Disable Race condition tests
There are a couple of known race conditions that seem to be stemming
from the concurrency runtime, triggering test failures in the TSan
tests.

rdar://158355890
2025-08-25 16:29:44 -07:00
Evan Wilde
cc4f323b71 FreeBSD: TSan: main thread finished with ignores enabled
Disabling several TSan tests that are failing due to a bug in the thread
sanitizer. TSan appears to be setting the thread to ignored in the
`thr_exit` interceptor, and then immediately checking that the thread
isn't being ignored, and dying.

```
ThreadSanitizer: main thread finished with ignores enabled
  One of the following ignores was not ended (in order of probability)
```

rdar://158450231
2025-08-25 15:18:20 -07:00
Evan Wilde
292601826f FreeBSD: ASAN hang on aarch64
ASAN hangs on aarch64 FreeBSD. Disabling until we have a chance to dig
through it.
2025-07-23 15:06:38 -07:00
Evan Wilde
79f7b638eb FreeBSD: Testing: pthread handling
Fixing pthread usage in tsan and tsan-inout tests. pthreads are imported
as opaque pointers on FreeBDS, and thus need to be kept in an optional
pthread_t, like on Apple platforms.

Unlike on macOS, pthread_join is not annotated with nullability
annotations and thus takes an optional opaque pointer, so we don't need
to unwrap it.
2025-07-16 11:16:41 -07:00
Stefan Gränitz
76243a25db [windows][toolchain] Build sanitizers and builtins standalone for all SDKs (#78861)
Unified builds of compiler-rt together with LLVM failed for the Android SDKs. It got too complicated to redirect the way LLVM would configure the nested build-trees. Standalone builds slightly increase build time, but they turned out much simpler and we end up with less duplication of definitions.
2025-01-28 22:08:07 +01:00
Hiroshi Yamauchi
32832dd1e1 Revert "[windows][toolchain] Enable builtins and sanitizers"
Revert https://github.com/swiftlang/swift/pull/77770

To fix CI https://ci-external.swift.org/job/swift-main-windows-toolchain-arm64/785/consoleText
2024-12-06 14:22:30 -08:00
Stefan Gränitz
2f7116a36f Disable tests newly included with asan_runtime available, but not supported on Windows yet 2024-12-03 18:41:49 +01:00
Meghana Gupta
2b337a3379 Disable test Sanitizers/asan/recover.swift 2024-04-09 12:57:55 -07:00
swift-ci
c1bb2a4d89 Merge remote-tracking branch 'origin/main' into rebranch 2023-10-11 21:35:37 -07:00
Yuta Saito
e52b155a9c [test] Disable multithreading tests on threading_none 2023-10-11 18:14:43 +00:00
Evan Wilde
bf4dadc0c0 Fix scudo test
Scudo crashes when it trips. Pass the `--crash` flag to `not` to handle
it properly.
2023-08-23 15:36:24 -07:00
Konrad `ktoso` Malawski
34f8da366a re-enable tsan test: async_taskgroup_next 2023-08-09 08:44:11 +09:00
Alastair Houghton
ee5efff5b1 [Threading][TSan] Update after review comments.
* Use the longer name ThreadSanitizer rather than TSan for the new files.
* Don't implement `tsan::consume` at all for now.
* Do the `tsan::release` for `ulock_unlock()` at the head of the function,
  not at the tail.
* Add a comment to test/Sanitizers/tsan/once.swift to explain the test a
  little more clearly.

rdar://110665213
2023-06-19 15:32:50 +01:00
Alastair Houghton
41f46ec085 [Threading][TSan] Fix TSan errors from lazy init on Linux.
Move the TSan functionality from Concurrency into Threading.  Use it
in the Linux `ulock` implementation so that TSan knows about `ulock`
and will tolerate the newer `swift_once` implementation that uses it.

rdar://110665213
2023-06-19 15:32:50 +01:00
Julian Lettner
0ce8bfaaec [Sanitizers] Remove obsolete LIT substitution (#65420)
Co-authored-by: Julian Lettner <julian.lettner@apple.com>
2023-04-27 10:41:10 -07:00
Adrian Prantl
9657c89345 Relax test.
The real fix here is to make sure the . operator actually gets its own source
location. Right now, it depends on what code is being inlined from the stdlib
thus the failure with the debug stdlib only. We can relax the test further in
the short term.

rdar://108132971
2023-04-17 08:48:36 -07:00
Kavon Farvardin
8b143886a5 disable flaky Sanitizers/symbolication.swift
In some CI configurations, namely

oss-swift_tools-RA_stdlib-RD_test-simulator
oss-swift_tools-RA_stdlib-RDA_test-simulator

we're seeing failures.
2023-04-10 17:34:25 -07:00
Adrian Prantl
158772c2ab Rebase SILScope generation on top of ASTScope.
This patch replaces the stateful generation of SILScope information in
SILGenFunction with data derived from the ASTScope hierarchy, which should be
100% in sync with the scopes needed for local variables. The goal is to
eliminate the surprising effects that the stack of cleanup operations can have
on the current state of SILBuilder leading to a fully deterministic (in the
sense of: predictible by a human) association of SILDebugScopes with
SILInstructions. The patch also eliminates the need to many workarounds. There
are still some accomodations for several Sema transformation passes such as
ResultBuilders, which don't correctly update the source locations when moving
around nodes. If these were implemented as macros, this problem would disappear.

This necessary rewrite of the macro scope handling included in this patch also
adds proper support nested macro expansions.

This fixes

rdar://88274783

and either fixes or at least partially addresses the following:

rdar://89252827
rdar://105186946
rdar://105757810
rdar://105997826
rdar://105102288
2023-04-04 15:20:11 -07:00
Alexis Laferrière
cff5822679 [Test] Disabling tsan tests under iOS 2022-12-14 16:09:32 -08:00
Julian Lettner
24a4b12f2e [Sanitizer] Deflake TSan test (#61166)
This test does:
```
race()
print("Done!")

// CHECK: ThreadSanitizer: data race
// CHECK: Done!
```

We see some recent cases where the output of the test binary on iOS
devices was:
```
Done!
==================
WARNING: ThreadSanitizer: data race
…
```

So apparently the TSan report output is not guaranteed to be printed
before "Done!".  Maybe this is because we print "Done!" on stdout and
the sanitizer report on stderr?

The remaining question is: what changed that we are seeing this issue
now, but not previously?

rdar://99713724

Co-authored-by: Julian Lettner <julian.lettner@apple.com>
2022-09-19 17:03:34 -07:00
Mike Ash
9c849e431c [Concurrency] Fix memory ordering around task cancellation.
Load task status with an acquire when canceling a task, to synchronize with the store-release that comes when updating a task's status.

Add explicit TSan calls in cancellation, as well as withStatusRecordLock and addStatusRecord, to avoid TSan complaining about data races when canceling a task.

Add a test that checks for TSan-reported data races when canceling a task.

rdar://93892417
2022-09-14 13:39:55 -04:00
Anthony Latsis
5534019db4 Gardening: Migrate test suite to GH issues: Sanitizers 2022-09-02 06:12:45 +03:00
Duo Wang
72e0ac2819 [tests] fix missing codesign in test files 2022-07-28 13:59:44 -07:00
swift-ci
72bd6d3277 Merge pull request #58585 from jsoref/spelling-test-sanitizers
spelling: unpredictable
2022-07-23 01:03:59 -07:00
Yuta Saito
687dca9d60 [Threading][test] disable threaded lit tests under threading_none 2022-07-07 01:57:38 +00:00
Butta
3933fc0006 [android][test] Fix several tests on the Android CI
- #58975 switched many tests from XFAIL on linux to linux-gnu, so seven
  fail on the Android CI and two natively. They are now explicitly excluded.
- #39605 added several C++ Interop tests, 11 of which fail on the Android CI,
  so disable them for now.
- #42478 removed the @noescape attribute for the non-Android
  SIL/clang-function-types tests, so I remove it for Android too.
- My pull #40779 moved the Swift pointer tags to the second byte, so
  SILOptimizer/concat_string_literals.64 will need to be updated for that,
  disabled it for now.
- Compiler-rt moved the directory in which it places those libraries for
  Android, llvm/llvm-project@a68ccba, so lit.cfg is updated for that.
2022-06-09 14:35:41 +05:30
Ben Barham
c163e0fe5e [Tests] Make OS features consistent
lit.py currently allows any substring of `target_triple` to be used as a
feature in REQUIRES/UNSUPPORTED/XFAIL. This results in various forms of
the OS spread across the tests and is also somewhat confusing since they
aren't actually listed in the available features.

Modify all OS-related features to use the `OS=` version that Swift adds
instead. We can later remove `config.target_triple` so that these don't
the non-OS versions don't work in the first place.
2022-05-20 19:51:23 -07:00
Josh Soref
2e7c396b21 spelling: unpredictable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-01 04:32:22 -04:00
Julian Lettner
8a886d8d2c Re-enable sanitizer tests broken due to buggy atos (#58408)
There was a regression in atos, but now a new-enough Xcode version that
includes the fixed atos is now available on Swift CI bots.  We can
re-enable the tests.

Radar-Id: rdar://problem/85471075

Co-authored-by: Julian Lettner <julian.lettner@apple.com>
2022-04-29 11:00:43 -07:00
Rokhini Prabhu
67ccb52a54 Disable test which is showing crasher when run with tsan 2022-04-20 16:53:23 -07:00
Rintaro Ishizaki
cbd1c7d295 [Tests] Disable a flaky test
rdar://76542113
2022-02-07 09:45:41 -08:00
Philip Turner
973f5d215d [Concurrency] Disable flaky test (#40875) 2022-02-03 09:19:53 -08:00
Andrew Trick
3bde13b938 Conditionally disable tsan/racy_async_let_fibonacci.swift
On arm64e, this test generates incorrect output.

rdar://86825277
2022-01-05 21:30:07 -08:00
Evan Wilde
a53c727e90 Disable availability checking on failing tests
We won't look for async functions that can't be used due to availability
unless the availability checking is disabled. Need to disable the
availability checking due to the minimum deploy target being too low for
concurrency.
2021-12-20 13:06:35 -08:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Ben Langmuir
3786b0920a [test] Disable test/Sanitizers/tsan/async_let_fibonacci.swift
This test is failing non-deterministically in CI, so disable until we
fix it.
2021-09-23 09:22:29 -07:00
Julian Lettner
16c1eb37b8 Re-enable TSan versions of async_let_fibonacci.swift test (#39319)
The two TSan versions of the
`test/Concurrency/Runtime/async_let_fibonacci.swift` were disabled for
different reasons:
[1] Swift Concurrency work broke the test and it was never re-enabled.
[2] Regression in atos required test to be disabled.  Re-enablement was
    blocked on Swift CI upgrading to an Xcode that contains the fixed
    version of atos.

While the TSan versions of the test was not running they fell out of
sync with the original test and then started failing for different
(trivial) reasons once re-enabled.

Please help us keep these tests running by:
* Not landing work that makes them fail (and deferring the fix to a
  later point), if at all possible.  Breaking sanitizers should be a
  "blocker".
* Keeping them in sync with the original tests.

Radar-Id: rdar://83162880

[1] rdar://76446550 (Re-enable test: Sanitizers/tsan/async_let_fibonacci.swift)
[2] rdar://80274830 ([Swift CI] Sanitizer report symbolication fails due to regression in atos)

Co-authored-by: Julian Lettner <julian.lettner@apple.com>
2021-09-16 17:37:59 +02:00
Nate Cook
feece9da70 Revert "[Swift CI] Re-enable sanitizer symbolication tests (#38489)" (#39320)
This reverts commit 680fb6ac40.
2021-09-15 14:45:18 -05:00
Julian Lettner
680fb6ac40 [Swift CI] Re-enable sanitizer symbolication tests (#38489)
We updated the Swift CI nodes to a version of Xcode that includes the
fix for a regression in atos that broke sanitizer report symbolication.

Regression: rdar://79151503 (If atos is handed a dSYM, it should find the binary rather than erring)
Fix:        rdar://80345994 (Regression: atos -p <pid> exits immediately)

Radar-Id: rdar://80274830

Co-authored-by: Julian Lettner <julian.lettner@apple.com>
2021-09-15 14:50:55 +02:00
Arnold Schwaighofer
ef0bb9932d Re-enable remote_run tests that were disabled
The underlying issue was supposedly fixed a while ago.
2021-08-03 13:51:15 -07:00
Doug Gregor
eeeea49764 Remove -enable-experimental-concurrency almost everywhere. 2021-07-26 21:24:43 -07:00
Doug Gregor
1e2012d816 Disable availability checking in tests that use concurrency 2021-07-20 12:46:26 -07:00
Julian Lettner
4af32360ca [CI] Disable tests that depend on symbolication
After upgrading the OS and Xcode on the CI nodes sanitizer report
symbolication fails because we fail to start atos.  This might be a
sandboxing issue.

Radar-Id: rdar://80274830
2021-07-07 13:54:37 -07:00
OneUpWallStreet
25df5d2c48 Fixed some common grammatical errors in the comments. (#38248) 2021-07-05 01:00:48 -07:00
Julian Lettner
558a0cc605 Add tsan_release edge on task creation (#38074)
* Synchronize both versions of actor_counters.swift test

* Synchronize on Job address

Make sure to synchronize on Job address (AsyncTasks are Jobs, but not
all Jobs are AsyncTasks).

* Add fprintf debug output for TSan acquire/release

* Add tsan_release edge on task creation

without this, we are getting false data races between when a task
is created and immediately scheduled on a different thread.

False positive for `Sanitizers/tsan/actor_counters.swift` test:
```
WARNING: ThreadSanitizer: data race (pid=81452)
  Read of size 8 at 0x7b2000000560 by thread T5:
    #0 Counter.next() <null>:2 (a.out:x86_64+0x1000047f8)
    #1 (1) suspend resume partial function for worker(identity:counters:numIterations:) <null>:2 (a.out:x86_64+0x100005961)
    #2 swift::runJobInEstablishedExecutorContext(swift::Job*) <null>:2 (libswift_Concurrency.dylib:x86_64+0x280ef)

  Previous write of size 8 at 0x7b2000000560 by main thread:
    #0 Counter.init(maxCount:) <null>:2 (a.out:x86_64+0x1000046af)
    #1 Counter.__allocating_init(maxCount:) <null>:2 (a.out:x86_64+0x100004619)
    #2 runTest(numCounters:numWorkers:numIterations:) <null>:2 (a.out:x86_64+0x100006d2e)
    #3 swift::runJobInEstablishedExecutorContext(swift::Job*) <null>:2 (libswift_Concurrency.dylib:x86_64+0x280ef)
    #4 main <null>:2 (a.out:x86_64+0x10000a175)
```

New edge with this change:
```
[4357150208] allocate task 0x7b3800000000, parent = 0x0
[4357150208] creating task 0x7b3800000000 with parent 0x0
[4357150208] tsan_release on 0x7b3800000000    <<< new release edge
[139088221442048] tsan_acquire on 0x7b3800000000
[139088221442048] trying to switch from executor 0x0 to 0x7ff85e2d9a00
[139088221442048] switch failed, task 0x7b3800000000 enqueued on executor 0x7ff85e2d9a00
[139088221442048] enqueue job 0x7b3800000000 on executor 0x7ff85e2d9a00
[139088221442048] tsan_release on 0x7b3800000000
[139088221442048] tsan_release on 0x7b3800000000
[4357150208] tsan_acquire on 0x7b3800000000
counters: 1, workers: 1, iterations: 1
[4357150208] allocate task 0x7b3c00000000, parent = 0x0
[4357150208] creating task 0x7b3c00000000 with parent 0x0
[4357150208] tsan_release on 0x7b3c00000000    <<< new release edge
[139088221442048] tsan_acquire on 0x7b3c00000000
[4357150208] task 0x7b3800000000 waiting on task 0x7b3c00000000, going to sleep
[4357150208] tsan_release on 0x7b3800000000
[4357150208] tsan_release on 0x7b3800000000
[139088221442048] getting current executor 0x0
[139088221442048] tsan_release on 0x7b3c00000000
...
```

rdar://78932849

* Add static_cast<Job *>()

* Move TSan release edge to swift_task_enqueueGlobal()

Move the TSan release edge from `swift_task_create_commonImpl()` to
`swift_task_enqueueGlobalImpl()`.  Task creation itself is not an event
that needs synchronization, but rather that task creation "happens
before" execution of that task on another thread.

This edge is usually added when the task is scheduled via
`swift_task_enqueue()` (which then usually calls
`swift_task_enqueueGlobal()`).  However, not all task scheduling goes
through the `swift_task_enqueue()` funnel as some places call the more
specific `swift_task_enqueueGlobal()` directly.  So let's annotate this
function (duplicate edges aren't harmful) to ensure we cover all
schedule events, including newly-created tasks (our original problem
here).

rdar://78932849

Co-authored-by: Julian Lettner <julian.lettner@apple.com>
2021-06-25 18:40:53 -07:00
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00
Ben Langmuir
30c957b05c Disable test/Sanitizers/tsan/async_taskgroup_next.swift
Segfaulted in CI

rdar://78264164
2021-05-20 10:10:24 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
Konrad `ktoso` Malawski
ba615029c7 [Concurrency] Store child record when async let child task spawned 2021-04-19 10:06:23 +09:00
Doug Gregor
4e306bb8ab Revert "[Test] Disable failing concurrency tests on Linux."
This reverts commit 766bf78eea.
2021-04-14 23:33:51 -07:00