forked from apple/swift-nio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCrashTests+Strict.swift
More file actions
32 lines (30 loc) · 1.02 KB
/
Copy pathCrashTests+Strict.swift
File metadata and controls
32 lines (30 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
#if !canImport(Darwin) || os(macOS)
import NIOCore
import NIOPosix
struct StrictCrashTests {
let testEventLoopSheduleAfterShutdown = CrashTest(
regex: "Fatal error: Cannot schedule tasks on an EventLoop that has already shut down."
) {
setenv("SWIFTNIO_STRICT", "1", 1)
let elg = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let loop = elg.next()
try! elg.syncShutdownGracefully()
loop.execute {
print("Crash should happen before this line is printed.")
}
}
}
#endif