Commit Graph

38 Commits

Author SHA1 Message Date
Allan Shortlidge
c02fc4724d Tests: Remove -disable-availability-checking from many Concurrency tests.
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests
for deployment to the minimum OS versions required for use of _Concurrency APIs.
2024-10-18 16:21:51 -07:00
Konrad `ktoso` Malawski
9f5a707a30 back to println tests 2023-05-24 18:03:46 +02:00
Kuba (Brecka) Mracek
7853184ed6 Enable running tests from test/Concurrency/ directory in freestanding/minimal presets (#61835)
* Enable running tests from test/Concurrency/ directory in freestanding/minimal presets

* Mark failing Concurrency tests as XFAIL/SKIP on freestanding/minimal
2022-11-04 09:07:27 -07: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
Doug Gregor
3ee09a2298 Switch concurrency runtime tests to "REQUIRES: concurrency_runtime"
Rather than blanket-disabling concurrency tests when we aren't using a
just-built concurrency library, enable them whenever we have a
suitable concurrency runtime, either just-built, in the OS, or via the
back-deployment libraries.
2021-09-13 12:34:20 -07:00
Konrad `ktoso` Malawski
f336404ae9 [Concurrency] TaskGroup children remove their records as they complete
If we didn't do this (and we didn't), the tasks get released as we
perform the next() impl, and move the value from the ready task to the
waiting task. Then, the ready task gets destroyed.

But as the task group exists, it performs a cancelAll() and that
iterates over all records. Those records were not removed previously
(!!!) which meant we were pointing at now deallocated tasks.

Previously this worked because we didn't deallocate the tasks, so they
leaked, but we didn't crash. With the memory leak fixed, this began to
crash since we'd attempt to cancel already destroyed tasks.

Solution:
- Remove task records whenever they complete a waiting task.
- This can ONLY be done by the "group owning task" itself, becuause
  the contract of ONLY this task being allowed to modify records. o
  It MUST NOT be done by the completing tasks as they complete, as it
  would race with the owning task modifying this linked list of child
  tasks in the group record.
2021-09-04 20:09:55 +09:00
Doug Gregor
9222bf2cf0 Make ThrowingTaskGroup.nextResult() non-throwing.
We erroneously marked this API as `throws`, even though it returns its
error via a `Result` instead. Remove the `throws` in a strange-looking
manner so that we maintain the existing ABI.

Fixes rdar://81585954.
2021-08-05 16:58:47 -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
Saleem Abdulrasool
21126b4277 test: enable some Concurrency tests on Windows
This enables a few Concurrency tests that should be passing on Windows
(at least do so locally).
2021-07-06 16:22:43 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
Nate Chandler
ff7c98123a [Test] Disabled several Concurrency tests for back_deployment_runtime.
rdar://76566598
2021-04-13 15:27:41 -07:00
Konrad `ktoso` Malawski
34f8e768b5 spawnDetached to detach, non-suspending group.spawn, spawnUnlessCancelled 2021-04-03 09:53:32 +09:00
Konrad `ktoso` Malawski
6e746304e1 [Concurrency] Update Task and Group APIs based on Review 1 2021-04-03 09:52:03 +09:00
Mike Ash
1173b737aa [Concurrency] Add availability to Concurrency APIs.
This allows programs to target older OSes while using Concurrency behind an availability check. When targeting older OSes, the symbols are weak-linked and the compiler will require the use of Concurrency features to be guarded by an availability check.

rdar://75850003
2021-04-01 10:42:08 -04:00
Karoy Lorentey
24aca4072a [test] Skip concurrency tests during back deployment testing
rdar://76038845
2021-03-30 22:35:38 -07:00
Konrad `ktoso` Malawski
2467f6aaea [Concurrency] Task.withGroup can be rethrows 2021-03-08 13:39:12 +09:00
Daniel Rodríguez Troitiño
6e9c5c96e7 [windows][test] Mark two tests that end up deadlocked as unsupported.
Two tests seems to end up deadlocked in the Windows CI machines. Mark
them as unsupported for the time being so the CI machines are useful
again.
2021-03-01 10:07:29 -08:00
Konrad `ktoso` Malawski
6e525d7469 Merge branch 'main' into wip-no-escape-group 2021-02-25 10:37:20 +09:00
Konrad `ktoso` Malawski
dd9a9a6436 [Concurrency] Task APIs use thread-local ActiveTask now 2021-02-24 19:19:44 +09:00
Konrad `ktoso` Malawski
de5fdcd2f8 [TaskGroup] fix missing retain in scheduling next() immediately on offer 2021-02-24 18:45:33 +09:00
Konrad `ktoso` Malawski
9a08475edf [TaskGroup] for now require macOS on a few tests 2021-02-22 20:42:53 +09:00
Konrad `ktoso` Malawski
9c0deafcbd [TaskGroup] simplify throw_recover test a little bit 2021-02-22 16:48:37 +09:00
Konrad `ktoso` Malawski
b33fae8656 import dispatch in tests, so they can run on linux as well 2021-02-22 13:26:38 +09:00
Konrad `ktoso` Malawski
07d6715d9f cleanup: remove all println debugging from task infra 2021-02-22 13:26:38 +09:00
Konrad `ktoso` Malawski
999758cc85 [Concurrency][TaskGroup] allow cancelAll be invoked from child tasks 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
efc7d8e627 [Concurrency] rearrange layout of AsyncTask now that task locals and groups coexist 2021-02-22 13:26:33 +09:00
Konrad `ktoso` Malawski
b1e5c4a2c4 test cleanups, additional test to check we dont cancel other groups 2021-02-22 13:26:28 +09:00
Konrad `ktoso` Malawski
a55ebff942 [Concurrency] deprecate not implemented Task functions, until they're implemented 2021-02-12 16:33:16 +09:00
Konrad `ktoso` Malawski
08de933288 [Concurrency] Task revisions 3
- introduce UnsafeCurrentTask
- implement Hashable, Equatable on tasks
- assume we'll have a way to get a task from sync context
- Task.Handle now has a Failure type as well
- Task.Handle.getResult
2021-02-12 09:06:17 +09:00
3405691582
574006a592 [test] Mark taskgroup tests XFAIL like Linux.
The pr #35755 changed these tests from `REQUIRES: OS=macosx` to using
`XFAIL: linux`, which suggests other platforms supporting concurrency
must affirmatively mark these failing tests XFAIL as well.

This is distinct from #35759, since ideally that pr will be cherrypicked
over to the 5.4 branch and including these changes there would cause a
prospective cherrypick to diverge.
2021-02-05 11:32:34 -05:00
Nate Chandler
73c9733779 [Test] Reenabled Concurrency/Runtime tests on arm64e. 2021-02-03 19:21:59 -08:00
Nate Chandler
798f86981f [Test] Replaced runAsyncAndBlock with async @main.
The last outstanding usage is in

    Concurrency/Runtime/checked_continuation.swift
2021-01-28 17:14:55 -08:00
Konrad `ktoso` Malawski
80ee936a72 Revert "[Concurrency] isCanceled spelling to follow guidance" 2021-01-23 07:27:34 +09:00
Konrad `ktoso` Malawski
8b37455774 [Concurrency] isCanceled spelling to follow guidance 2021-01-22 12:09:19 +09:00
Doug Gregor
3c38ffe0ea [Concurrency] await try -> try await
The `try await` ordering is both easier to read and indicates the order
of operations better, because the suspension point occurs first and
then one can observe a thrown error.
2020-12-23 13:21:59 -08:00
Konrad `ktoso` Malawski
b267778bf1 Rebased to use new global executor 2020-12-17 06:05:13 +09:00
Konrad `ktoso` Malawski
7b37554096 [Concurrency] Initial TaskGroup implementation working 2020-12-17 06:05:13 +09:00