@@ -4855,6 +4855,88 @@ fileprivate struct SwiftTaskConstructionTests: CoreBasedTests {
48554855 }
48564856 }
48574857
4858+ @Test (
4859+ . requireSDKs( . host) ,
4860+ )
4861+ func swiftcDisableSandboxSetting( ) async throws {
4862+ let targetName = " targetName "
4863+ let swiftCompilerPath = try await self . swiftCompilerPath
4864+ let swiftVersion = try await self . swiftVersion
4865+ let libtoolPath = try await self . libtoolPath
4866+ try await withTemporaryDirectory { tmpDir in
4867+ let testProject = try await TestProject (
4868+ " ProjectName " ,
4869+ sourceRoot: tmpDir. join ( " srcroot " ) ,
4870+ groupTree: TestGroup (
4871+ " SomeFiles " ,
4872+ children: [
4873+ TestFile ( " File1.swift " ) ,
4874+ ] ,
4875+ ) ,
4876+ targets: [
4877+ TestStandardTarget (
4878+ targetName,
4879+ type: . staticLibrary,
4880+ buildConfigurations: [
4881+ TestBuildConfiguration (
4882+ " Debug " ,
4883+ buildSettings: [
4884+ " PRODUCT_NAME " : " $(TARGET_NAME) " ,
4885+ " SWIFT_EXEC " : swiftCompilerPath. str,
4886+ " LIBTOOL " : libtoolPath. str,
4887+ " SWIFT_VERSION " : swiftVersion,
4888+ ] ,
4889+ ) ,
4890+ ] ,
4891+ buildPhases: [
4892+ TestSourcesBuildPhase (
4893+ [
4894+ TestBuildFile ( " File1.swift " ) ,
4895+ ] ,
4896+ ) ,
4897+ ] ,
4898+ ) ,
4899+ ] ,
4900+ )
4901+
4902+ let tester = try await TaskConstructionTester ( getCore ( ) , testProject)
4903+
4904+ // Default (setting unset) should not pass -disable-sandbox.
4905+ await tester. checkBuild (
4906+ BuildParameters ( configuration: " Debug " ) ,
4907+ runDestination: . host,
4908+ ) { results in
4909+ results. checkTarget ( targetName) { target in
4910+ results. checkTask ( . matchTarget( target) , . matchRuleType( " SwiftDriver Compilation " ) ) { task in
4911+ task. checkCommandLineDoesNotContain ( " -disable-sandbox " )
4912+ }
4913+ }
4914+ }
4915+
4916+ await tester. checkBuild (
4917+ BuildParameters ( configuration: " Debug " , overrides: [ " SWIFTC_DISABLE_SANDBOX " : " YES " ] ) ,
4918+ runDestination: . host,
4919+ ) { results in
4920+ results. checkTarget ( targetName) { target in
4921+ results. checkTask ( . matchTarget( target) , . matchRuleType( " SwiftDriver Compilation " ) ) { task in
4922+ task. checkCommandLineContains ( [ " -disable-sandbox " ] )
4923+ }
4924+ }
4925+ }
4926+
4927+ await tester. checkBuild (
4928+ BuildParameters ( configuration: " Debug " , overrides: [ " SWIFTC_DISABLE_SANDBOX " : " NO " ] ) ,
4929+ runDestination: . host,
4930+ ) { results in
4931+ results. checkTarget ( targetName) { target in
4932+ results. checkTask ( . matchTarget( target) , . matchRuleType( " SwiftDriver Compilation " ) ) { task in
4933+ task. checkCommandLineDoesNotContain ( " -disable-sandbox " )
4934+ }
4935+ }
4936+ }
4937+ }
4938+ }
4939+
48584940 @Test ( . requireSDKs( . macOS) )
48594941 func layoutStringValueWitnesses( ) async throws {
48604942 try await withTemporaryDirectory { tmpDir in
0 commit comments