Skip to content

Commit af25b67

Browse files
committed
[swift-stage2] Point the API migrator at the correct directory when building/testing against a host toolchain.
This involved adding a new substitution called %api_diff_data_dir that when building against a host toolchain, looks in the host toolchain (next to swiftc) rather than in the resource dir. The reason why I need to do this is this allows me to perform a stdlib stage2 build without needing to build swift itself. The only interesting changes here are that I had to add %api_diff_data_dir to a bunch of normal/expected tests and also add %api_diff_data_dir's length to the offsets in rdar31892850.swift.
1 parent 9bb056b commit af25b67

23 files changed

+63
-43
lines changed

test/Migrator/always_remove_old_remap_file.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// RUN: %empty-directory(%t)
22
// RUN: cp %s %t/input.swift
3-
// RUN: %target-swift-frontend -c -update-code -primary-file %t/input.swift -emit-migrated-file-path %t/always_remove_old_remap_file.result -emit-remap-file-path %t/always_remove_old_remap_file.remap -o /dev/null
3+
// RUN: %target-swift-frontend -c -update-code -primary-file %t/input.swift -emit-migrated-file-path %t/always_remove_old_remap_file.result -emit-remap-file-path %t/always_remove_old_remap_file.remap %api_diff_data_dir -o /dev/null %api_diff_data_dir
44
// RUN: ls %t/always_remove_old_remap_file.remap
55

66
// Simulate leaving behind code that can't build in Swift 4:
77
// RUN: echo asdfads >> %t/input.swift
88

99
// Migrate again. This should delete the old remap file.
10-
// RUN: not %target-swift-frontend -c -update-code -primary-file %t/input.swift -emit-migrated-file-path %t/always_remove_old_remap_file.result -emit-remap-file-path %t/always_remove_old_remap_file.remap -o /dev/null
10+
// RUN: not %target-swift-frontend -c -update-code -primary-file %t/input.swift -emit-migrated-file-path %t/always_remove_old_remap_file.result -emit-remap-file-path %t/always_remove_old_remap_file.remap %api_diff_data_dir -o /dev/null %api_diff_data_dir
1111

1212
// RUN: not ls %t/always_remove_old_remap_file.remap
1313

test/Migrator/fixit_flatMap.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
2-
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t.result -swift-version 4
1+
// RUN: %target-swift-frontend -typecheck %s -swift-version 4 %api_diff_data_dir
2+
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t.result -swift-version 4 %api_diff_data_dir
33
// RUN: diff -u %s.expected %t.result
44

55
// REQUIRES: VENDOR=apple

test/Migrator/fixit_flatMap.swift.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
2-
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t.result -swift-version 4
1+
// RUN: %target-swift-frontend -typecheck %s -swift-version 4 %api_diff_data_dir
2+
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -emit-migrated-file-path %t.result -swift-version 4 %api_diff_data_dir
33
// RUN: diff -u %s.expected %t.result
44

55
// REQUIRES: VENDOR=apple

test/Migrator/insert_replace_fixit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4
2+
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4 %api_diff_data_dir
33
// RUN: %diff -u %s.expected %t/result.swift
44

55
import TestMyTime

test/Migrator/insert_replace_fixit.swift.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4
2+
// RUN: %target-swift-frontend -typecheck -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/result.swift -swift-version 4 %api_diff_data_dir
33
// RUN: %diff -u %s.expected %t/result.swift
44

55
import TestMyTime

test/Migrator/no_ast_passes_after_swift4.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// REQUIRES: objc_interop
2-
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/no_ast_passes_after_swift4.swift.result -emit-remap-file-path %t/no_ast_passes_after_swift4.swift.remap -o /dev/null -swift-version 4.2
2+
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/no_ast_passes_after_swift4.swift.result -emit-remap-file-path %t/no_ast_passes_after_swift4.swift.remap -o /dev/null -swift-version 4.2 %api_diff_data_dir
33
// RUN: diff -u %S/no_ast_passes_after_swift4.swift.expected %t/no_ast_passes_after_swift4.swift.result
4-
// RUN: %target-swift-frontend -typecheck -F %S/mock-sdk -swift-version 4 %t/no_ast_passes_after_swift4.swift.result
4+
// RUN: %target-swift-frontend -typecheck -F %S/mock-sdk -swift-version 4 %t/no_ast_passes_after_swift4.swift.result %api_diff_data_dir
55

66
import Bar
77
func foo() -> FooComparisonResult {

test/Migrator/no_ast_passes_after_swift4.swift.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// REQUIRES: objc_interop
2-
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/no_ast_passes_after_swift4.swift.result -emit-remap-file-path %t/no_ast_passes_after_swift4.swift.remap -o /dev/null -swift-version 4.2
2+
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -F %S/mock-sdk -emit-migrated-file-path %t/no_ast_passes_after_swift4.swift.result -emit-remap-file-path %t/no_ast_passes_after_swift4.swift.remap -o /dev/null -swift-version 4.2 %api_diff_data_dir
33
// RUN: diff -u %S/no_ast_passes_after_swift4.swift.expected %t/no_ast_passes_after_swift4.swift.result
4-
// RUN: %target-swift-frontend -typecheck -F %S/mock-sdk -swift-version 4 %t/no_ast_passes_after_swift4.swift.result
4+
// RUN: %target-swift-frontend -typecheck -F %S/mock-sdk -swift-version 4 %t/no_ast_passes_after_swift4.swift.result %api_diff_data_dir
55

66
import Bar
77
func foo() -> FooComparisonResult {

test/Migrator/no_extraneous_argument_labels.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
2-
// RUN: %empty-directory(%t) && %target-swift-frontend -c -primary-file %s -emit-migrated-file-path %t/no_extraneous_argument_labels.result -swift-version 4 -o /dev/null
1+
// RUN: %target-swift-frontend -typecheck %s -swift-version 4 %api_diff_data_dir
2+
// RUN: %empty-directory(%t) && %target-swift-frontend -c -primary-file %s -emit-migrated-file-path %t/no_extraneous_argument_labels.result -swift-version 4 -o /dev/null %api_diff_data_dir
33
// RUN: %diff -u %s.expected %t/no_extraneous_argument_labels.result
4-
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
4+
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5 %api_diff_data_dir
55

66
func foo(_ oc: [String]) {
77
var args: [String] = []

test/Migrator/no_extraneous_argument_labels.swift.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
2-
// RUN: %empty-directory(%t) && %target-swift-frontend -c -primary-file %s -emit-migrated-file-path %t/no_extraneous_argument_labels.result -swift-version 4 -o /dev/null
1+
// RUN: %target-swift-frontend -typecheck %s -swift-version 4 %api_diff_data_dir
2+
// RUN: %empty-directory(%t) && %target-swift-frontend -c -primary-file %s -emit-migrated-file-path %t/no_extraneous_argument_labels.result -swift-version 4 -o /dev/null %api_diff_data_dir
33
// RUN: %diff -u %s.expected %t/no_extraneous_argument_labels.result
4-
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5
4+
// RUN: %target-swift-frontend -typecheck %s.expected -swift-version 5 %api_diff_data_dir
55

66
func foo(_ oc: [String]) {
77
var args: [String] = []

test/Migrator/no_var_to_let.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %target-swift-frontend -typecheck %s -swift-version 4
2-
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 4 -o /dev/null
3-
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 4 -o /dev/null
1+
// RUN: %target-swift-frontend -typecheck %s -swift-version 4 %api_diff_data_dir
2+
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 4 -o /dev/null %api_diff_data_dir
3+
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -primary-file %s -emit-migrated-file-path %t/no_var_to_let.swift.result -swift-version 4 -o /dev/null %api_diff_data_dir
44
// RUN: %diff -u %s %t/no_var_to_let.swift.result
5-
// RUN: %target-swift-frontend -typecheck %s -swift-version 5
5+
// RUN: %target-swift-frontend -typecheck %s -swift-version 5 %api_diff_data_dir
66

77
// Note that the diff run line indicates that there should be no change.
88

0 commit comments

Comments
 (0)