Skip to content

Commit 37a48ea

Browse files
authored
Merge pull request #38699 from glessard/absurd-allocations
2 parents 4cd373c + d03cb6d commit 37a48ea

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

test/Runtime/allocator_sanity.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN: %target-run-simple-swiftgyb
2+
3+
// REQUIRES: executable_test
4+
// UNSUPPORTED: use_os_stdlib
5+
// UNSUPPORTED: back_deployment_runtime
6+
7+
import StdlibUnittest
8+
9+
var AllocationsTestSuite = TestSuite("Allocations")
10+
11+
AllocationsTestSuite.test("absurd.allocation.misaligned") {
12+
expectCrashLater()
13+
let mustFail = UnsafeMutableRawPointer.allocate(byteCount: 1024,
14+
alignment: 19)
15+
expectUnreachable()
16+
_ = mustFail
17+
}
18+
19+
AllocationsTestSuite.test("absurd.allocation.gargantuan") {
20+
expectCrashLater()
21+
let mustFail = UnsafeMutableRawPointer.allocate(byteCount: Int.max,
22+
alignment: 0)
23+
expectUnreachable()
24+
_ = mustFail
25+
}
26+
27+
runAllTests()

test/stdlib/UnsafeRawPointer.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,18 +229,4 @@ UnsafeMutableRawPointerExtraTestSuite.test("moveInitialize:from:") {
229229
check(Check.RightOverlap)
230230
}
231231

232-
UnsafeMutableRawPointerExtraTestSuite.test("absurd.allocation.misaligned") {
233-
expectCrashLater()
234-
let mustFail = UnsafeMutableRawPointer.allocate(byteCount: 1024,
235-
alignment: 19)
236-
expectUnreachable()
237-
}
238-
239-
UnsafeMutableRawPointerExtraTestSuite.test("absurd.allocation.gargantuan") {
240-
expectCrashLater()
241-
let mustFail = UnsafeMutableRawPointer.allocate(byteCount: Int.max,
242-
alignment: 0)
243-
expectUnreachable()
244-
}
245-
246232
runAllTests()

0 commit comments

Comments
 (0)