Skip to content

Commit 417af9d

Browse files
Merge pull request swiftlang#248 from kateinoigakukun/katei/unsupported-tests
[WASM] Disable unsupported test suite on WASM
2 parents a430d8d + d498cb2 commit 417af9d

31 files changed

+64
-16
lines changed

test/AutolinkExtract/empty.swift

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
// CHECK-elf: -lswiftCore
77
// CHECK-coff: -lswiftCore
8+
// CHECK-wasm: -lswiftCore

test/AutolinkExtract/empty_archive.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@
77

88
// CHECK-elf: -lswiftCore
99
// CHECK-coff: -lswiftCore
10+
// CHECK-wasm: -lswiftCore

test/AutolinkExtract/import.swift

+3
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
// CHECK-coff-DAG: -lswiftCore
1212
// CHECK-coff-DAG: -lempty
1313

14+
// CHECK-wasm-DAG: -lswiftCore
15+
// CHECK-wasm-DAG: -lempty
16+
1417
import empty

test/ClangImporter/clang_builtins.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
44
import Darwin
5-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
5+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
66
import Glibc
77
#elseif os(Windows)
88
import MSVCRT

test/IRGen/builtin_math.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
44
import Darwin
5-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
5+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
66
import Glibc
77
#elseif os(Windows)
88
import MSVCRT

test/IRGen/sanitize_coverage.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,indirect-calls %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_INDIRECT_CALLS
88
// RUN: %target-swift-frontend -emit-ir -sanitize=address -sanitize-coverage=edge,8bit-counters %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_8BIT_COUNTERS
99
// RUN: %target-swift-frontend -emit-ir -sanitize=fuzzer %s | %FileCheck %s -check-prefix=SANCOV -check-prefix=SANCOV_TRACE_CMP
10+
// UNSUPPORTED: wasm
1011

1112
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
1213
import Darwin

test/Interpreter/dynamicReplacement_property_observer.swift

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// REQUIRES: executable_test
99

1010
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic
11+
// UNSUPPORTED: wasm
1112

1213
@_private(sourceFile: "dynamic_replacement_property_observer_orig.swift") import TestDidWillSet
1314

test/Interpreter/dynamic_replacement.swift

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949

5050
// REQUIRES: executable_test
51+
// UNSUPPORTED: wasm
5152

5253
import Module1
5354

test/Interpreter/dynamic_replacement_chaining.swift

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
// This test flips the chaining flag.
2222
// UNSUPPORTED: swift_test_mode_optimize_none_with_implicit_dynamic
23+
// UNSUPPORTED: wasm
2324

2425
import A
2526

test/Interpreter/dynamic_replacement_without_previous_calls.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %target-run %t/main %t/%target-library-name(Module1) %t/%target-library-name(Module2)
77

88
// REQUIRES: executable_test
9+
// UNSUPPORTED: wasm
910

1011
import Module1
1112

test/lit.cfg

+6-10
Original file line numberDiff line numberDiff line change
@@ -1320,27 +1320,23 @@ elif run_os == 'wasi':
13201320

13211321
# Exclude test cases that use objc-interop because clang doesn't support it
13221322
# with WebAssembly binary file yet.
1323-
testfiles = glob.glob(os.path.join(config.test_source_root, "**", "*.swift"))
1324-
13251323
def use_objc_interop(path):
13261324
with open(path) as f:
13271325
return '-enable-objc-interop' in f.read()
13281326
def lldb_related_test(path):
13291327
with open(path) as f:
13301328
return 'lldb-moduleimport-test' in f.read()
13311329

1332-
import fnmatch
1333-
def disabled_filenames(path, filename_pat):
1330+
def disabled_filenames(path):
13341331
matches = []
13351332
for root, dirnames, filenames in os.walk(path):
1336-
for filename in fnmatch.filter(filenames, filename_pat):
1333+
for filename in filenames:
13371334
filepath = os.path.join(root, filename)
1338-
if not use_objc_interop(filepath): continue
1339-
if not lldb_related_test(filepath): continue
1340-
matches.append(filename)
1335+
if use_objc_interop(filepath) or lldb_related_test(filepath):
1336+
matches.append(os.path.basename(filepath))
13411337
return matches
13421338

1343-
config.excludes += disabled_filenames(config.test_source_root, "*.swift")
1339+
config.excludes += disabled_filenames(config.test_source_root)
13441340

13451341
config.target_swift_autolink_extract = inferSwiftBinary("swift-autolink-extract")
13461342

@@ -1369,7 +1365,7 @@ elif run_os == 'wasi':
13691365
config.swift_test_options, config.swift_frontend_test_options)
13701366
subst_target_swift_frontend_mock_sdk = config.target_swift_frontend
13711367
subst_target_swift_frontend_mock_sdk_after = ""
1372-
config.target_run = 'wasmtime'
1368+
config.target_run = 'wasmtime --'
13731369
if 'interpret' in lit_config.params:
13741370
use_interpreter_for_simple_runs()
13751371
config.target_sil_opt = (

test/stdlib/Character.swift

+2
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ UnicodeScalarTests.test("UInt8(ascii: UnicodeScalar)") {
369369
}
370370
}
371371

372+
#if !os(WASI)
372373
UnicodeScalarTests.test("UInt8(ascii: UnicodeScalar)/non-ASCII should trap")
373374
.skip(.custom(
374375
{ _isFastAssertConfiguration() },
@@ -378,6 +379,7 @@ UnicodeScalarTests.test("UInt8(ascii: UnicodeScalar)/non-ASCII should trap")
378379
expectCrashLater()
379380
_blackHole(UInt8(ascii: us))
380381
}
382+
#endif
381383

382384
UnicodeScalarTests.test("UInt32(_: UnicodeScalar),UInt64(_: UnicodeScalar)") {
383385
for us in baseScalars {

test/stdlib/CharacterTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-run %t/a.out_Debug
88
// RUN: %target-run %t/a.out_Release
99
// REQUIRES: executable_test
10+
// UNSUPPORTED: OS=wasi
1011

1112
import StdlibUnittest
1213

test/stdlib/DictionaryTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-run %t/a.out_Debug
88
// RUN: %target-run %t/a.out_Release
99
// REQUIRES: executable_test
10+
// UNSUPPORTED: OS=wasi
1011

1112
import StdlibUnittest
1213

test/stdlib/FloatingPointIR.swift

+3
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ func testConstantFoldFloatLiterals() {
4949

5050
// s390x: call swiftcc void @"$s15FloatingPointIR13acceptFloat32yySfF{{.*}}"(float 1.000000e+00)
5151
// s390x: call swiftcc void @"$s15FloatingPointIR13acceptFloat64yySdF{{.*}}"(double 1.000000e+00)
52+
53+
// wasm32: call swiftcc void @"$s15FloatingPointIR13acceptFloat32yySfF{{.*}}"(float 1.000000e+00)
54+
// wasm32: call swiftcc void @"$s15FloatingPointIR13acceptFloat64yySdF{{.*}}"(double 1.000000e+00)

test/stdlib/IntervalTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// RUN: %target-run %t/a.out_Debug
1919
// RUN: %target-run %t/a.out_Release
2020
// REQUIRES: executable_test
21+
// UNSUPPORTED: OS=wasi
2122

2223
import StdlibUnittest
2324

test/stdlib/KeyPath.swift

+2
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,15 @@ keyPath.test("optional force-unwrapping") {
422422
expectTrue(value.questionableCanary === newCanary)
423423
}
424424

425+
#if !os(WASI)
425426
keyPath.test("optional force-unwrapping trap") {
426427
let origin_x = \TestOptional.origin!.x
427428
var value = TestOptional(origin: nil)
428429

429430
expectCrashLater()
430431
_ = value[keyPath: origin_x]
431432
}
433+
#endif
432434

433435
struct TestOptional2 {
434436
var optional: TestOptional?

test/stdlib/NumericParsing.swift.gyb

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ tests.test("${Self}/success") {
107107
% end
108108
}
109109

110+
#if !os(WASI)
110111
tests.test("${Self}/radixTooLow") {
111112
${Self}("0", radix: 2)
112113
expectCrashLater()
@@ -119,6 +120,7 @@ tests.test("${Self}/radixTooHigh") {
119120
expectCrashLater()
120121
let y = ${Self}("0", radix: maxRadix + 1)
121122
}
123+
#endif
122124

123125
% end
124126

test/stdlib/Optional.swift

+4
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ OptionalTests.test("Casting Optional") {
338338
expectTrue(anyToAnyIsOptional(Optional<(String, String)>.none, Bool.self))
339339
}
340340

341+
#if !os(WASI)
341342
OptionalTests.test("Casting Optional Traps") {
342343
let nx: C? = nil
343344
expectCrash { _blackHole(anyToAny(nx, Int.self)) }
@@ -346,6 +347,7 @@ OptionalTests.test("Casting Optional Any Traps") {
346347
let nx: X? = X()
347348
expectCrash { _blackHole(anyToAny(nx as Any, Optional<Int>.self)) }
348349
}
350+
#endif
349351

350352
class TestNoString {}
351353
class TestString : CustomStringConvertible, CustomDebugStringConvertible {
@@ -407,6 +409,7 @@ OptionalTests.test("unsafelyUnwrapped") {
407409
expectEqual(3, nonEmpty.unsafelyUnwrapped)
408410
}
409411

412+
#if !os(WASI)
410413
OptionalTests.test("unsafelyUnwrapped nil")
411414
.xfail(.custom(
412415
{ !_isDebugAssertConfiguration() },
@@ -416,5 +419,6 @@ OptionalTests.test("unsafelyUnwrapped nil")
416419
expectCrashLater()
417420
_blackHole(empty.unsafelyUnwrapped)
418421
}
422+
#endif
419423

420424
runAllTests()

test/stdlib/OptionalTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// RUN: %target-run %t/Assert_Release
1111
// RUN: %target-run %t/Assert_Unchecked
1212
// REQUIRES: executable_test
13+
// UNSUPPORTED: OS=wasi
1314

1415
import StdlibUnittest
1516

test/stdlib/POSIX.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// RUN: %target-run-simple-swift %t
22
// REQUIRES: executable_test
33
// UNSUPPORTED: OS=windows-msvc
4+
// UNSUPPORTED: OS=wasi
45

56
import StdlibUnittest
67
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
78
import Darwin
8-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
9+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
910
import Glibc
1011
#else
1112
#error("Unsupported platform")

test/stdlib/PrintFloat.swift.gyb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import StdlibUnittest
1313
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
1414
import Darwin
15-
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
15+
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku) || os(WASI)
1616
import Glibc
1717
#elseif os(Windows)
1818
import MSVCRT

test/stdlib/RangeTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// RUN: %target-run %t/a.out_Debug
1919
// RUN: %target-run %t/a.out_Release
2020
// REQUIRES: executable_test
21+
// UNSUPPORTED: OS=wasi
2122

2223

2324
import StdlibUnittest

test/stdlib/Repeat.swift

+2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ RepeatTests.test("associated-types") {
2323
indicesType: CountableRange<Int>.self)
2424
}
2525

26+
#if !os(WASI)
2627
RepeatTests.test("out-of-bounds") {
2728
let sequence = repeatElement(0, count: 1)
2829
expectCrashLater()
2930
_ = sequence[sequence.count]
3031
}
32+
#endif
3133

3234
runAllTests()
3335

test/stdlib/Runtime.swift.gyb

+3
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,8 @@ Runtime.test("Struct layout with reference storage types") {
591591
print(malkovich)
592592
}
593593

594+
// WebAssembly/WASI doesn't support dynamic symbol lookup
595+
#if !os(WASI)
594596
Runtime.test("SwiftError layout constants for LLDB") {
595597
let offsetof_SwiftError_typeMetadata = pointerToSwiftCoreSymbol(name: "_swift_lldb_offsetof_SwiftError_typeMetadata")!
596598
let sizeof_SwiftError = pointerToSwiftCoreSymbol(name: "_swift_lldb_sizeof_SwiftError")!
@@ -610,6 +612,7 @@ Runtime.test("SwiftError layout constants for LLDB") {
610612
_UnimplementedError()
611613
#endif
612614
}
615+
#endif
613616

614617
var Reflection = TestSuite("Reflection")
615618

test/stdlib/SetTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-run %t/a.out_Debug
88
// RUN: %target-run %t/a.out_Release
99
// REQUIRES: executable_test
10+
// UNSUPPORTED: OS=wasi
1011

1112
import StdlibUnittest
1213

test/stdlib/StaticString.swift

+4
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ StaticStringTestSuite.test("PointerRepresentation/NonASCII") {
6969
expectDebugPrinted("\"абв\"", str)
7070
}
7171

72+
#if !os(WASI)
7273
StaticStringTestSuite.test("PointerRepresentation/unicodeScalar")
7374
.skip(.custom(
7475
{ _isFastAssertConfiguration() },
@@ -81,6 +82,7 @@ StaticStringTestSuite.test("PointerRepresentation/unicodeScalar")
8182
expectCrashLater()
8283
strOpaque.unicodeScalar
8384
}
85+
#endif
8486

8587
StaticStringTestSuite.test("UnicodeScalarRepresentation/ASCII") {
8688
// The type checker does not call the UnicodeScalar initializer even if
@@ -119,6 +121,7 @@ StaticStringTestSuite.test("UnicodeScalarRepresentation/NonASCII") {
119121
expectDebugPrinted("\"Ы\"", str)
120122
}
121123

124+
#if !os(WASI)
122125
StaticStringTestSuite.test("UnicodeScalarRepresentation/utf8Start")
123126
.skip(.custom(
124127
{ _isFastAssertConfiguration() },
@@ -144,6 +147,7 @@ StaticStringTestSuite.test("UnicodeScalarRepresentation/utf8CodeUnitCount")
144147
expectCrashLater()
145148
strOpaque.utf8CodeUnitCount
146149
}
150+
#endif
147151

148152
runAllTests()
149153

test/stdlib/StringTraps.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// RUN: %target-run %t/a.out_Debug
88
// RUN: %target-run %t/a.out_Release
99
// REQUIRES: executable_test
10+
// UNSUPPORTED: OS=wasi
1011

1112
import StdlibUnittest
1213

test/stdlib/UnsafePointer.swift.gyb

+6-2
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ func checkPtr(
304304
}
305305
}
306306

307+
#if !os(WASI)
307308
UnsafeMutablePointerTestSuite.test("moveAssign:from:") {
308309
let check = checkPtr(UnsafeMutablePointer.moveAssign, true)
309310
check(Check.Disjoint)
@@ -322,6 +323,7 @@ UnsafeMutablePointerTestSuite.test("moveAssign:from:.Right") {
322323
check(Check.RightOverlap)
323324
}
324325
}
326+
#endif
325327

326328
UnsafeMutablePointerTestSuite.test("assign:from:") {
327329
let check = checkPtr(UnsafeMutablePointer.assign, true)
@@ -337,6 +339,7 @@ UnsafeMutablePointerTestSuite.test("moveInitialize:from:") {
337339
check(Check.RightOverlap)
338340
}
339341

342+
#if !os(WASI)
340343
UnsafeMutablePointerTestSuite.test("initialize:from:") {
341344
let check = checkPtr(UnsafeMutablePointer.initialize(from:count:), false)
342345
check(Check.Disjoint)
@@ -355,6 +358,7 @@ UnsafeMutablePointerTestSuite.test("initialize:from:.Right") {
355358
check(Check.RightOverlap)
356359
}
357360
}
361+
#endif
358362

359363
UnsafeMutablePointerTestSuite.test("initialize:from:/immutable") {
360364
var ptr = UnsafeMutablePointer<Missile>.allocate(capacity: 3)
@@ -400,7 +404,7 @@ ${SelfName}TestSuite.test("customMirror") {
400404
let ptr = ${SelfType}(bitPattern: reallyBigInt)!
401405
let mirror = ptr.customMirror
402406
expectEqual(1, mirror.children.count)
403-
#if arch(i386) || arch(arm)
407+
#if arch(i386) || arch(arm) || arch(wasm32)
404408
expectEqual("18446744071562067968", String(describing: mirror.children.first!.1))
405409
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
406410
expectEqual("9223372036854775808", String(describing: mirror.children.first!.1))
@@ -415,7 +419,7 @@ ${SelfName}TestSuite.test("customPlaygroundQuickLook") {
415419
let reallyBigInt: UInt = UInt(Int.max) + 1
416420
let ptr = ${SelfType}(bitPattern: reallyBigInt)!
417421
if case let .text(desc) = ptr.customPlaygroundQuickLook {
418-
#if arch(i386) || arch(arm)
422+
#if arch(i386) || arch(arm) || arch(wasm32)
419423
expectEqual("${SelfName}(0xFFFFFFFF80000000)", desc)
420424
#elseif arch(x86_64) || arch(arm64) || arch(powerpc64) || arch(powerpc64le) || arch(s390x)
421425
expectEqual("${SelfName}(0x8000000000000000)", desc)

0 commit comments

Comments
 (0)