Skip to content

Commit 0c4e561

Browse files
authored
Merge pull request #82399 from swiftlang/maxd/embedded-wasm-tests
These tests still require a manual `lit.py` invocation for Wasm, which will be added as a separate CMake target in a future PR.
2 parents 3a8bf75 + ca3d6bc commit 0c4e561

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+97
-60
lines changed

test/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,18 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB_CROSS_COMPILING)
611611
"${CMAKE_CURRENT_BINARY_DIR}${VARIANT_SUFFIX}/lit.site.cfg"
612612
"test${VARIANT_SUFFIX}.lit.site.cfg")
613613
swift_generate_lit_swift_features_cfg("${CMAKE_CURRENT_BINARY_DIR}${VARIANT_SUFFIX}/lit.swift-features.cfg")
614+
615+
set(VARIANT_SUFFIX "-embedded-wasi")
616+
set(VARIANT_TRIPLE "wasm32-unknown-wasip1")
617+
set(VARIANT_EXTERNAL_EMBEDDED_PLATFORM FALSE)
618+
set(VARIANT_EXTERNAL_EMBEDDED_DEVICE)
619+
set(SWIFT_TEST_RESULTS_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/swift-test-results/${VARIANT_TRIPLE}")
620+
swift_configure_lit_site_cfg(
621+
"${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in"
622+
"${CMAKE_CURRENT_BINARY_DIR}${VARIANT_SUFFIX}/lit.site.cfg"
623+
"test${VARIANT_SUFFIX}.lit.site.cfg")
624+
swift_generate_lit_swift_features_cfg("${CMAKE_CURRENT_BINARY_DIR}${VARIANT_SUFFIX}/lit.swift-features.cfg")
625+
message(STATUS "SWIFT_LIT_ARGS is ${SWIFT_LIT_ARGS}")
614626
endif()
615627

616628
# Add shortcuts for the default variant.

test/embedded/array-builtins-exec.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -parse-as-library -enable-experimental-feature Embedded -enable-builtin-module -c -o %t/main.o
3-
// RUN: %target-clang %t/main.o -o %t/a.out -dead_strip
4-
// RUN: %target-run %t/a.out | %FileCheck %s
2+
// RUN: %target-run-simple-swift(-parse-as-library -enable-experimental-feature Embedded -wmo -enable-builtin-module) | %FileCheck %s
53

64
// REQUIRES: swift_in_compiler
75
// REQUIRES: executable_test
@@ -41,7 +39,7 @@ func exerciseArrayValueWitnesses<T>(_ value: T) {
4139

4240
(buf + 0).initialize(to: value)
4341
(buf + 1).initialize(to: value)
44-
42+
4543
Builtin.copyArray(T.self, (buf + 2)._rawValue, buf._rawValue, 2._builtinWordValue)
4644
Builtin.takeArrayBackToFront(T.self, (buf + 1)._rawValue, buf._rawValue, 4._builtinWordValue)
4745
Builtin.takeArrayFrontToBack(T.self, buf._rawValue, (buf + 1)._rawValue, 4._builtinWordValue)

test/embedded/basic-modules-generics-no-stdlib.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public func main() {
5252
protocolBoundFunc(GenericType<Bool>(Bool()))
5353
}
5454

55-
// CHECK: define {{.*}}i32 @main(i32 %0, ptr %1)
55+
// CHECK: define {{.*}}i32 @{{_*}}main{{.*}}(i32 %0, ptr %1)
5656
// CHECK: define {{.*}}void @"$e4Main4BoolVACycfC"()
5757
// CHECK: define {{.*}}void @"$e4Main4mainyyF"()
5858
// CHECK: define {{.*}}void @"$e8MyModule14nonGenericFuncyyF"()

test/embedded/basic-modules-no-stdlib.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public func main() {
3838
moduleMain()
3939
}
4040

41-
// CHECK: define {{.*}}@main{{.*}} {
41+
// CHECK: define {{.*}}@{{_*}}main{{.*}} {
4242
// CHECK: define {{.*}}void @"$e4Main4mainyyF"{{.*}} {
4343
// CHECK: define {{.*}}void @"$e8MyModule10moduleMainyyF"{{.*}} {
4444
// CHECK: define {{.*}}void @"$e8MyModule8ConcreteVACycfC"{{.*}} {

test/embedded/builtin-float.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// RUN: %target-swift-frontend -target armv7em-none-none-eabi -emit-ir %t/Main.swift -enable-experimental-feature Embedded -module-cache-path %t/ModuleCache -Xcc -I%t/include
66

7+
// UNSUPPORTED: OS=wasi
78
// REQUIRES: swift_in_compiler
89
// REQUIRES: optimized_stdlib
910
// REQUIRES: CODEGENERATOR=ARM

test/embedded/classes-arrays.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend %s -parse-as-library -enable-experimental-feature Embedded -c -o %t/main.o
3-
// RUN: %target-clang %t/main.o -o %t/a.out -dead_strip
4-
// RUN: %target-run %t/a.out | %FileCheck %s
2+
// RUN: %target-run-simple-swift(-parse-as-library -enable-experimental-feature Embedded -wmo) | %FileCheck %s
53

64
// REQUIRES: swift_in_compiler
75
// REQUIRES: executable_test
@@ -56,7 +54,7 @@ struct Main {
5654
// CHECK: MySubSubClass.foo
5755
}
5856
print("")
59-
57+
6058
print("5") // CHECK: 5
6159
objects = []
6260
// CHECK: MyClass.deinit

test/embedded/classes-generic-no-stdlib.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-swift-emit-sil %s -parse-stdlib -enable-experimental-feature Embedded -target arm64e-apple-none -wmo | %FileCheck %s --check-prefix CHECK-SIL
22
// RUN: %target-swift-emit-ir %s -parse-stdlib -enable-experimental-feature Embedded -target arm64e-apple-none -wmo | %FileCheck %s --check-prefix CHECK-IR
33

4+
// UNSUPPORTED: OS=wasi
45
// REQUIRES: swift_in_compiler
56
// REQUIRES: swift_feature_Embedded
67

test/embedded/classes-multi-module.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -c -I%t -parse-as-library %t/MyModule.swift -o %t/MyModule.o -emit-module -emit-module-path %t/MyModule.swiftmodule -emit-empty-object-file
55
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -c -I%t %t/Main.swift -o %t/Main.o
6-
// RUN: %target-clang %t/Main.o %t/MyModule.o -o %t/a.out
6+
// RUN: %target-clang %target-clang-resource-dir-opt %t/Main.o %t/MyModule.o -o %t/a.out
77
// RUN: %target-run %t/a.out | %FileCheck %s
88

99
// REQUIRES: executable_test
@@ -28,7 +28,7 @@ class X<T: BinaryInteger> {
2828
var x: T
2929

3030
init(x: T) { self.x = x }
31-
31+
3232
func bar() {
3333
print(x)
3434
}

test/embedded/classes-optional.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend %s -enable-experimental-feature Embedded -c -o %t/main.o
3-
// RUN: %target-clang %t/main.o -o %t/a.out -dead_strip
3+
// RUN: %target-clang %target-clang-resource-dir-opt %t/main.o -o %t/a.out -dead_strip
44
// RUN: %target-run %t/a.out | %FileCheck %s
55

66
// REQUIRES: swift_in_compiler

test/embedded/classes-stack-promotion.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass=function-signature-opts %s -parse-as-library -enable-experimental-feature Embedded -module-name main -emit-irgen | %FileCheck %s --check-prefix CHECK-IR
33
// RUN: %target-swift-frontend -O -Xllvm -sil-disable-pass=function-signature-opts %s -parse-as-library -enable-experimental-feature Embedded -c -o %t/main.o
4-
// RUN: %target-clang %t/main.o -o %t/a.out -dead_strip
4+
// RUN: %target-clang %target-clang-resource-dir-opt %t/main.o -o %t/a.out -dead_strip
55
// RUN: %target-run %t/a.out | %FileCheck %s
66

77
// REQUIRES: swift_in_compiler
@@ -77,7 +77,7 @@ struct Main {
7777
// CHECK-IR-NEXT: ret void
7878
// CHECK-IR-NEXT: }
7979

80-
// CHECK-IR: define {{.*}}@main
80+
// CHECK-IR: define {{.*}}@{{_*}}main
8181
// CHECK-IR-NEXT: entry:
8282
// CHECK-IR-NEXT: alloca %T4main10MySubClassC
8383
// CHECK-IR-NEXT: alloca %T4main12MyFinalClassC

0 commit comments

Comments
 (0)