@@ -362,6 +362,14 @@ final class IncrementalCompilationTests: XCTestCase {
362
362
#endif
363
363
}
364
364
365
+ // FIXME: Expect failure in Linux in CI just as testIncrementalDiagnostics
366
+ func testAlwaysRebuildDependents( ) throws {
367
+ #if !os(Linux)
368
+ tryInitial ( true )
369
+ tryTouchingMainAlwaysRebuildDependents ( true )
370
+ #endif
371
+ }
372
+
365
373
func testIncremental( ) throws {
366
374
try testIncremental ( checkDiagnostics: false )
367
375
}
@@ -499,6 +507,36 @@ final class IncrementalCompilationTests: XCTestCase {
499
507
] ,
500
508
whenAutolinking: autolinkLifecycleExpectations)
501
509
}
510
+ func tryTouchingMainAlwaysRebuildDependents( _ checkDiagnostics: Bool ) {
511
+ touch ( " main " )
512
+ let extraArgument = " -driver-always-rebuild-dependents "
513
+ try ! doABuild (
514
+ " non-propagating but \( extraArgument) " ,
515
+ checkDiagnostics: checkDiagnostics,
516
+ extraArguments: [ extraArgument] ,
517
+ expectingRemarks: [
518
+ " Incremental compilation: Scheduing changed input {compile: main.o <= main.swift} " ,
519
+ " Incremental compilation: May skip current input: {compile: other.o <= other.swift} " ,
520
+ " Incremental compilation: Queuing (initial): {compile: main.o <= main.swift} " ,
521
+ " Incremental compilation: scheduling dependents of main.swift; -driver-always-rebuild-dependents " ,
522
+ " Incremental compilation: Traced: interface of top-level name foo from: main.swift -> implementation of other.swiftdeps from: other.swift " ,
523
+ " Incremental compilation: Found dependent of main.swift: {compile: other.o <= other.swift} " ,
524
+ " Incremental compilation: Immediately scheduling dependent on main.swift {compile: other.o <= other.swift} " ,
525
+ " Incremental compilation: Queuing (dependent): {compile: other.o <= other.swift} " ,
526
+ " Found 2 batchable jobs " ,
527
+ " Forming into 1 batch " ,
528
+ " Adding {compile: main.swift} to batch 0 " ,
529
+ " Adding {compile: other.swift} to batch 0 " ,
530
+ " Forming batch job from 2 constituents: main.swift, other.swift " ,
531
+ " Incremental compilation: Queuing Compiling main.swift, other.swift " ,
532
+ " Starting Compiling main.swift, other.swift " ,
533
+ " Finished Compiling main.swift, other.swift " ,
534
+ " Starting Linking theModule " ,
535
+ " Finished Linking theModule " ,
536
+ ] ,
537
+ whenAutolinking: autolinkLifecycleExpectations)
538
+ }
539
+
502
540
503
541
func touch( _ name: String ) {
504
542
print ( " *** touching \( name) *** " , to: & stderrStream) ; stderrStream. flush ( )
@@ -517,17 +555,20 @@ final class IncrementalCompilationTests: XCTestCase {
517
555
}
518
556
func doABuild( _ message: String ,
519
557
checkDiagnostics: Bool ,
558
+ extraArguments: [ String ] = [ ] ,
520
559
expectingRemarks texts: [ String ] ,
521
560
whenAutolinking: [ String ] ) throws {
522
561
try doABuild (
523
562
message,
524
563
checkDiagnostics: checkDiagnostics,
564
+ extraArguments: extraArguments,
525
565
expecting: texts. map { . remark( $0) } ,
526
566
expectingWhenAutolinking: whenAutolinking. map { . remark( $0) } )
527
567
}
528
568
529
569
func doABuild( _ message: String ,
530
570
checkDiagnostics: Bool ,
571
+ extraArguments: [ String ] = [ ] ,
531
572
expecting expectations: [ Diagnostic . Message ] ,
532
573
expectingWhenAutolinking autolinkExpectations: [ Diagnostic . Message ] ) throws {
533
574
print ( " *** starting build \( message) *** " , to: & stderrStream) ; stderrStream. flush ( )
@@ -537,8 +578,9 @@ final class IncrementalCompilationTests: XCTestCase {
537
578
try ? driver. run ( jobs: jobs)
538
579
}
539
580
581
+ let allArgs = args + extraArguments
540
582
if checkDiagnostics {
541
- try assertDriverDiagnostics ( args: args ) { driver, verifier in
583
+ try assertDriverDiagnostics ( args: allArgs ) { driver, verifier in
542
584
verifier. forbidUnexpected ( . error, . warning, . note, . remark, . ignored)
543
585
expectations. forEach { verifier. expect ( $0) }
544
586
if driver. isAutolinkExtractJobNeeded {
@@ -551,7 +593,7 @@ final class IncrementalCompilationTests: XCTestCase {
551
593
let diagnosticEngine = DiagnosticsEngine ( handlers: [
552
594
{ print ( $0, to: & stderrStream) ; stderrStream. flush ( ) }
553
595
] )
554
- var driver = try Driver ( args: args , env: ProcessEnv . vars,
596
+ var driver = try Driver ( args: allArgs , env: ProcessEnv . vars,
555
597
diagnosticsEngine: diagnosticEngine,
556
598
fileSystem: localFileSystem)
557
599
doIt ( & driver)
0 commit comments