Skip to content

Add a Regression Test For Scenario Improved By Private Dependencies #32032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct Point {
let x: Double
let y: Double
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
struct Point {
let x: Float
let y: Float
}
1 change: 1 addition & 0 deletions test/Incremental/Inputs/superfluous-cascade/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

22 changes: 22 additions & 0 deletions test/Incremental/Inputs/superfluous-cascade/ofm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"main.swift": {
"object": "./main.o",
"swift-dependencies": "./main.swiftdeps"
},
"definesPoint.swift": {
"object": "./definesPoint.o",
"swift-dependencies": "./definesPoint.swiftdeps"
},
"usesPoint.swift": {
"object": "./usesPoint.o",
"swift-dependencies": "./usesPoint.swiftdeps"
},
"usesDisplay.swift": {
"object": "./usesDisplay.o",
"swift-dependencies": "./usesDisplay.swiftdeps"
},
"": {
"swift-dependencies": "./main~buildrecord.swiftdeps"
}
}

3 changes: 3 additions & 0 deletions test/Incremental/Inputs/superfluous-cascade/usesDisplay.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct Computer {
let display: Display
}
12 changes: 12 additions & 0 deletions test/Incremental/Inputs/superfluous-cascade/usesPoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
struct Shape {
let vertices: [Point]
}

struct Display {
let brand: Brand
}

enum Brand {
case apple
case sun
}
56 changes: 56 additions & 0 deletions test/Incremental/superfluous-cascade.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// =============================================================================
// Without private dependencies
// =============================================================================

// Establish status quo

// RUN: %empty-directory(%t)
// RUN: cp %S/Inputs/superfluous-cascade/* %t
// RUN: cp %t/definesPoint{-before,}.swift
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output1

// Change one type - the cascading edge causes us to rebuild everything but main

// RUN: cp %t/definesPoint{-after,}.swift
// RUN: touch -t 200201010101 %t/*
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesPoint.swift

// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output2

// RUN: %FileCheck -check-prefix=CHECK-STATUS-QUO-RECOMPILED %s < %t/output2

// CHECK-STATUS-QUO-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesPoint.o <= usesPoint.swift}
// CHECK-STATUS-QUO-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesDisplay.o <= usesDisplay.swift}


// =============================================================================
// With private dependencies
// =============================================================================

// Establish status quo

// RUN: %empty-directory(%t)
// RUN: cp %S/Inputs/superfluous-cascade/* %t
// RUN: cp %t/definesPoint{-before,}.swift
// RUN: touch -t 200101010101 %t/*.swift

// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -experimental-private-intransitive-dependencies >&output3

// Change one type - now only the user of that type rebuilds

// RUN: cp %t/definesPoint{-after,}.swift
// RUN: touch -t 200201010101 %t/*
// RUN: touch -t 200101010101 %t/*.swift
// RUN: touch -t 200301010101 %t/definesPoint.swift

// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -experimental-private-intransitive-dependencies >&output4

// RUN: %FileCheck -check-prefix=CHECK-PRIVATE-RECOMPILED %s --dump-input=always < %t/output4

// CHECK-PRIVATE-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesPoint.o <= usesPoint.swift}
// CHECK-PRIVATE-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesDisplay.o <= usesDisplay.swift}