Skip to content

Commit 2b0039d

Browse files
committed
[android] Switch %swiftc_driver for %target-swiftc_driver
When compiling against a platform different than the host, like it happens when testing against Android stdlib from a Linux host, one needs to use %target-swiftc_driver to setup the tools directory correctly and the target options, otherwise errors will happen when trying to link a host targetted file against the destination platform libraries.
1 parent cb0cdbc commit 2b0039d

15 files changed

+57
-61
lines changed

test/Driver/SourceRanges/range-incremental-no-build-record.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// First, build without range dependencies with no new options.
55
// =============================================================================
66

7+
// REQUIRES: executable_test
78

89
// Copy in the inputs.
910
// The lack of a build record or swiftdeps files should disable incremental compilation
@@ -12,7 +13,7 @@
1213
// Ensure that the extra outputs are not generated when they should not be:
1314
// RUN: %empty-directory(%t)
1415
// RUN: cp -r %S/Inputs/range-incremental-no-build-record/* %t
15-
// RUN: cd %t && %swiftc_driver -output-file-map %t/output.json -incremental -enable-batch-mode ./main.swift ./fileA.swift ./fileB.swift -module-name main -j2 -driver-show-job-lifecycle -driver-show-incremental >& %t/output0
16+
// RUN: cd %t && %target-swiftc_driver -output-file-map %t/output.json -incremental -enable-batch-mode ./main.swift ./fileA.swift ./fileB.swift -module-name main -j2 -driver-show-job-lifecycle -driver-show-incremental >& %t/output0
1617

1718
// RUN: %FileCheck -match-full-lines -check-prefix=CHECK-NO-BUILD-REC %s < %t/output0
1819
// CHECK-NO-BUILD-REC: Incremental compilation could not read build record.
@@ -29,7 +30,7 @@
2930

3031
// CHECK-HAS-BATCHES: Batchable: {compile:
3132

32-
// RUN: %t/main | tee run0 | grep Any > /dev/null && rm %t/main
33+
// RUN: %target-run %t/main | tee run0 | grep Any > /dev/null && rm %t/main
3334

3435
// =============================================================================
3536
// Same, except force the driver to compute both strategies via -driver-compare-incremental-schemes
@@ -43,11 +44,11 @@
4344
// Ensure that the extra outputs are not generated when they should not be:
4445
// RUN: %empty-directory(%t)
4546
// RUN: cp -r %S/Inputs/range-incremental-no-build-record/* %t
46-
// RUN: cd %t && %swiftc_driver -driver-compare-incremental-schemes -output-file-map %t/output.json -incremental -enable-batch-mode ./main.swift ./fileA.swift ./fileB.swift -module-name main -j2 -driver-show-job-lifecycle -driver-show-incremental >& %t/output1
47+
// RUN: cd %t && %target-swiftc_driver -driver-compare-incremental-schemes -output-file-map %t/output.json -incremental -enable-batch-mode ./main.swift ./fileA.swift ./fileB.swift -module-name main -j2 -driver-show-job-lifecycle -driver-show-incremental >& %t/output1
4748

4849
// RUN: %FileCheck -match-full-lines -check-prefix=CHECK-NO-BUILD-REC %s < %t/output1
4950

5051
// RUN: %FileCheck -match-full-lines -check-prefix=CHECK-COMPARE-DISABLED-NO-BUILD-RECORD %s < %t/output1
5152
// CHECK-COMPARE-DISABLED-NO-BUILD-RECORD: *** Incremental build disabled because could not read build record, cannot compare ***
5253

53-
// RUN: %t/main | tee run1 | grep Any > /dev/null && rm %t/main
54+
// RUN: %target-run %t/main | tee run1 | grep Any > /dev/null && rm %t/main
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %swiftc_driver -incremental -autolink-force-load %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
2-
// RUN: %swiftc_driver -autolink-force-load -incremental %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
1+
// RUN: %target-swiftc_driver -incremental -autolink-force-load %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
2+
// RUN: %target-swiftc_driver -autolink-force-load -incremental %s 2>&1 | %FileCheck -check-prefix=AUTOLINK_FORCE_LOAD %s
33

44
// MACHO targets do not support COMDAT
55
// UNSUPPORTED: OS=macosx
@@ -8,4 +8,3 @@
88
// UNSUPPORTED: OS=ios
99

1010
// AUTOLINK_FORCE_LOAD-NOT: error: '-autolink-force-load' is not supported with '-incremental'
11-

test/Driver/batch_mode_dependencies_make_wrong_order.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
// RUN: echo 'public func main() {}' >%t/main.swift
77
//
88
// First prime the incremental state, but note that we're building in the d c b a (reverse-alphabetical) order.
9-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift
9+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift
1010
//
1111
// Now perturb the interface of a.swift and delete its output
1212
// RUN: echo 'class a { var x : Int = 10 }' >%t/a.swift
1313
// RUN: rm %t/a.o
1414
//
1515
// Now rebuild, which will rebuild a.swift then do a cascading dep-graph invalidation
16-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift -driver-show-incremental -driver-show-job-lifecycle >%t/out.txt 2>&1
16+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -incremental -output-file-map %S/Inputs/abcd_filemap.yaml -module-name main -j 1 d.swift c.swift b.swift a.swift main.swift -driver-show-incremental -driver-show-job-lifecycle >%t/out.txt 2>&1
1717
// RUN: %FileCheck %s <%t/out.txt
1818
//
1919
// Check that we saw invalidation happen in command-line argument order

test/Driver/options.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@
121121
// BAD_DEBUG_LEVEL_ERROR: error: argument '-debug-info-format=codeview' is not allowed with '{{.*}}'
122122

123123
// RUN: %swift_driver -F %t/test.framework %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
124-
// RUN: %swiftc_driver -F %t/test.framework %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
124+
// RUN: %target-swiftc_driver -F %t/test.framework %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
125125
// RUN: %swift_driver -Fsystem %t/test.framework %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
126-
// RUN: %swiftc_driver -Fsystem %t/test.framework %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
126+
// RUN: %target-swiftc_driver -Fsystem %t/test.framework %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
127127
// RUN: %swift_driver -F %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
128-
// RUN: %swiftc_driver -F %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
128+
// RUN: %target-swiftc_driver -F %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
129129
// RUN: %swift_driver -Fsystem %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
130-
// RUN: %swiftc_driver -Fsystem %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
130+
// RUN: %target-swiftc_driver -Fsystem %t/test.framework/ %s 2>&1 | %FileCheck -check-prefix SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION %s
131131
// SEARCH_PATH_INCLUDES_FRAMEWORK_EXTENSION: warning: framework search path ends in ".framework"

test/Frontend/Fingerprints/class-fingerprint.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Seeing weird failure on CI, so set the mod times
1717
// RUN: touch -t 200101010101 %t/*.swift
1818

19-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1
19+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1
2020

2121
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps
2222

@@ -29,7 +29,7 @@
2929
// RUN: touch -t 200101010101 %t/*.swift
3030
// RUN: touch -t 200301010101 %t/definesAB.swift
3131

32-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2
32+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2
3333

3434
// Save for debugging:
3535
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps
@@ -53,7 +53,7 @@
5353
// Seeing weird failure on CI, so set the mod times
5454
// RUN: touch -t 200101010101 %t/*.swift
5555

56-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
56+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
5757

5858
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps
5959

@@ -67,7 +67,7 @@
6767
// RUN: touch -t 200101010101 %t/*.swift
6868
// RUN: touch -t 200301010101 %t/definesAB.swift
6969

70-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
70+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
7171

7272
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps
7373

test/Frontend/Fingerprints/enum-fingerprint.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Seeing weird failure on CI, so set the mod times
1717
// RUN: touch -t 200101010101 %t/*.swift
1818

19-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1
19+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1
2020

2121
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps
2222

@@ -29,7 +29,7 @@
2929
// RUN: touch -t 200101010101 %t/*.swift
3030
// RUN: touch -t 200301010101 %t/definesAB.swift
3131

32-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2
32+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2
3333

3434
// Save for debugging:
3535
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps
@@ -53,7 +53,7 @@
5353
// Seeing weird failure on CI, so set the mod times
5454
// RUN: touch -t 200101010101 %t/*.swift
5555

56-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
56+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
5757

5858
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps
5959

@@ -67,7 +67,7 @@
6767
// RUN: touch -t 200101010101 %t/*.swift
6868
// RUN: touch -t 200301010101 %t/definesAB.swift
6969

70-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
70+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
7171

7272
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps
7373

test/Frontend/Fingerprints/extension-adds-member.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// RUN: touch -t 200101010101 %t/*.swift
2222

2323

24-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output1
24+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output1
2525

2626

2727
// Change one type, but uses of all types get recompiled
@@ -33,7 +33,7 @@
3333
// RUN: touch -t 200101010101 %t/*.swift
3434
// RUN: touch -t 200301010101 %t/definesAB.swift
3535

36-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output2
36+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output2
3737

3838

3939
// This test checks for the status quo; it would be OK to be more conservative
@@ -60,7 +60,7 @@
6060
// Seeing weird failure on CI, so set the mod times
6161
// RUN: touch -t 200101010101 %t/*.swift
6262

63-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3
63+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output3
6464

6565
// Change one type, only uses of that type get recompiled
6666

@@ -71,7 +71,7 @@
7171
// RUN: touch -t 200101010101 %t/*.swift
7272
// RUN: touch -t 200301010101 %t/definesAB.swift
7373

74-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4
74+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >& %t/output4
7575

7676
// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED-W %s < %t/output4
7777
// RUN: %FileCheck -check-prefix=CHECK-NOT-RECOMPILED-W %s < %t/output4

test/Frontend/Fingerprints/protocol-fingerprint.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// Seeing weird failure on CI, so set the mod times
1717
// RUN: touch -t 200101010101 %t/*.swift
1818

19-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1
19+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output1
2020

2121
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps
2222

@@ -29,7 +29,7 @@
2929
// RUN: touch -t 200101010101 %t/*.swift
3030
// RUN: touch -t 200301010101 %t/definesAB.swift
3131

32-
// RUN: cd %t && %swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2
32+
// RUN: cd %t && %target-swiftc_driver -disable-type-fingerprints -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output2
3333

3434
// Save for debugging:
3535
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB1.swiftdeps
@@ -53,7 +53,7 @@
5353
// Seeing weird failure on CI, so set the mod times
5454
// RUN: touch -t 200101010101 %t/*.swift
5555

56-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
56+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output3
5757

5858
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB3.swiftdeps
5959

@@ -67,9 +67,8 @@
6767
// RUN: touch -t 200101010101 %t/*.swift
6868
// RUN: touch -t 200301010101 %t/definesAB.swift
6969

70-
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
70+
// RUN: cd %t && %target-swiftc_driver -enable-batch-mode -j2 -incremental -disable-direct-intramodule-dependencies -driver-show-incremental main.swift definesAB.swift usesA.swift usesB.swift -module-name main -output-file-map ofm.json >&output4
7171

7272
// only-run-for-debugging: cp %t/usesB.swiftdeps %t/usesB4.swiftdeps
7373

7474
// RUN: %FileCheck -check-prefix=CHECK-MAINAB-RECOMPILED %s < %t/output4
75-

0 commit comments

Comments
 (0)