Skip to content

Commit 72875f0

Browse files
[Wasm] Disable crash tests in test/stdlib/StringAPICString.swift
1 parent 38222d5 commit 72875f0

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/stdlib/StringAPICString.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
import StdlibUnittest
99

10+
#if arch(wasm32)
11+
let enableCrashTests = false
12+
#else
13+
let enableCrashTests = true
14+
#endif
15+
1016
var CStringTests = TestSuite("CStringTests")
1117

1218
func getNullUTF8() -> UnsafeMutablePointer<UInt8>? {
@@ -227,6 +233,7 @@ CStringTests.test("Substring.withCString") {
227233

228234
CStringTests.test("String.cString.with.Array.UInt8.input") {
229235
guard #available(SwiftStdlib 5.7, *) else { return }
236+
230237
do {
231238
let (u8p, dealloc) = getASCIIUTF8()
232239
defer { dealloc() }
@@ -239,6 +246,7 @@ CStringTests.test("String.cString.with.Array.UInt8.input") {
239246
}
240247
}
241248
}
249+
guard enableCrashTests else { return }
242250
// no need to test every case; that is covered in other tests
243251
expectCrashLater(
244252
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
@@ -263,6 +271,7 @@ CStringTests.test("String.cString.with.Array.CChar.input") {
263271
}
264272
}
265273
}
274+
guard enableCrashTests else { return }
266275
// no need to test every case; that is covered in other tests
267276
expectCrashLater(
268277
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
@@ -292,6 +301,7 @@ CStringTests.test("String.cString.with.inout.UInt8.conversion") {
292301
var str = String(cString: &c)
293302
expectTrue(str.isEmpty)
294303
c = 100
304+
guard enableCrashTests else { return }
295305
expectCrashLater(
296306
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
297307
// withMessage: "input of String.init(cString:) must be null-terminated"
@@ -306,6 +316,7 @@ CStringTests.test("String.cString.with.inout.CChar.conversion") {
306316
var str = String(cString: &c)
307317
expectTrue(str.isEmpty)
308318
c = 100
319+
guard enableCrashTests else { return }
309320
expectCrashLater(
310321
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
311322
// withMessage: "input of String.init(cString:) must be null-terminated"
@@ -330,6 +341,7 @@ CStringTests.test("String.validatingUTF8.with.Array.input") {
330341
}
331342
}
332343
}
344+
guard enableCrashTests else { return }
333345
// no need to test every case; that is covered in other tests
334346
expectCrashLater(
335347
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
@@ -362,6 +374,7 @@ CStringTests.test("String.validatingUTF8.with.inout.conversion") {
362374
expectNotNil(str)
363375
expectEqual(str?.isEmpty, true)
364376
c = 100
377+
guard enableCrashTests else { return }
365378
expectCrashLater(
366379
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
367380
// withMessage: "input of String.init(validatingUTF8:) must be null-terminated"
@@ -387,6 +400,7 @@ CStringTests.test("String.decodeCString.with.Array.input") {
387400
}
388401
}
389402
}
403+
guard enableCrashTests else { return }
390404
// no need to test every case; that is covered in other tests
391405
expectCrashLater(
392406
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
@@ -426,6 +440,7 @@ CStringTests.test("String.decodeCString.with.inout.conversion") {
426440
expectEqual(result?.result.isEmpty, true)
427441
expectEqual(result?.repairsMade, false)
428442
c = 100
443+
guard enableCrashTests else { return }
429444
expectCrashLater(
430445
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
431446
// withMessage: "input of decodeCString(_:as:repairingInvalidCodeUnits:) must be null-terminated"
@@ -449,6 +464,7 @@ CStringTests.test("String.init.decodingCString.with.Array.input") {
449464
}
450465
}
451466
}
467+
guard enableCrashTests else { return }
452468
// no need to test every case; that is covered in other tests
453469
expectCrashLater(
454470
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
@@ -478,6 +494,7 @@ CStringTests.test("String.init.decodingCString.with.inout.conversion") {
478494
var str = String(decodingCString: &c, as: Unicode.UTF8.self)
479495
expectEqual(str.isEmpty, true)
480496
c = 100
497+
guard enableCrashTests else { return }
481498
expectCrashLater(
482499
// Workaround for https://bugs.swift.org/browse/SR-16103 (rdar://91365967)
483500
// withMessage: "input of String.init(decodingCString:as:) must be null-terminated"

0 commit comments

Comments
 (0)