Skip to content

Commit c31ed73

Browse files
authored
Merge pull request #77026 from kubamracek/embedded-deps-no-asserts
[Concurrency] Add a no_asserts version of the Embedded Concurrency dependency checking
2 parents 44bea05 + a826d5a commit c31ed73

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

test/embedded/dependencies-concurrency-custom-executor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// DEP: _abort
1717
// DEP: _clock_gettime
1818
// DEP: _exit
19-
// DEP: _fprintf
2019
// DEP: _free
2120
// DEP: _malloc
2221
// DEP: _memmove
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -target %target-cpu-apple-macos14 -disable-availability-checking -parse-as-library -enable-experimental-feature Embedded %s -c -o %t/a.o -Osize
3+
// RUN: %target-clang -x c -std=c11 -I %swift_obj_root/include -c %S/Inputs/executor.c -o %t/executor.o -Oz -DNDEBUG -DDEBUG_EXECUTOR=0
4+
// RUN: %target-clang %t/a.o %t/executor.o -o %t/a.out %swift_obj_root/lib/swift/embedded/%target-cpu-apple-macos/libswift_Concurrency.a -dead_strip
5+
6+
// RUN: grep DEP\: %s | sed 's#// DEP\: ##' | sort > %t/allowed-dependencies.txt
7+
8+
// RUN: %llvm-nm --undefined-only --format=just-symbols %t/a.out | sort | tee %t/actual-dependencies.txt
9+
10+
// Fail if there is any entry in actual-dependencies.txt that's not in allowed-dependencies.txt
11+
// RUN: test -z "`comm -13 %t/allowed-dependencies.txt %t/actual-dependencies.txt`"
12+
13+
// DEP: ___stack_chk_fail
14+
// DEP: ___stack_chk_guard
15+
// DEP: _abort
16+
// DEP: _clock_gettime
17+
// DEP: _exit
18+
// DEP: _free
19+
// DEP: _malloc
20+
// DEP: _memmove
21+
// DEP: _memset
22+
// DEP: _memset_s
23+
// DEP: _nanosleep
24+
// DEP: _posix_memalign
25+
// DEP: _putchar
26+
// DEP: _puts
27+
// DEP: _strlen
28+
// DEP: _vprintf
29+
// DEP: _vsnprintf
30+
31+
// RUN: %target-run %t/a.out | %FileCheck %s
32+
33+
// REQUIRES: swift_in_compiler
34+
// REQUIRES: swift_stdlib_no_asserts
35+
// REQUIRES: executable_test
36+
// REQUIRES: optimized_stdlib
37+
// REQUIRES: OS=macosx
38+
39+
import _Concurrency
40+
41+
public func test() async -> Int {
42+
print("test")
43+
let t = Task {
44+
print("return 42")
45+
return 42
46+
}
47+
print("await")
48+
let v = await t.value
49+
print("return")
50+
return v
51+
}
52+
53+
@main
54+
struct Main {
55+
static func main() async {
56+
print("main")
57+
// CHECK: main
58+
let t = Task {
59+
print("task")
60+
let x = await test()
61+
print(x == 42 ? "42" : "???")
62+
}
63+
print("after task")
64+
await t.value
65+
// CHECK: after task
66+
// CHECK: task
67+
// CHECK: test
68+
// CHECK: await
69+
// CHECK: return 42
70+
// CHECK: return
71+
// CHECK: 42
72+
}
73+
}

0 commit comments

Comments
 (0)