Skip to content

Commit 8f0382c

Browse files
authored
[test] Replace swift_obj_root for alternates that work in LLVM unified builds (swiftlang#66167)
In LLVM unified builds `%swift_obj_root` points to `<LLVM build dir>/tools/swift`, and folders like `bin`, `lib` and `share` are not under `swift_obj_root`, which makes some tests fail. For the cases in which `%swift_obj_root/lib` was used, replace it by using `%swift-lib-dir` instead. Replicate `%swift-lib-dir` to create `%swift-bin-dir` and `%swift-share-dir`, and use those instead of `%swift_obj_root/bin` and `%swift_obj_root/share`. This alternates work both in Swift build-script builds and also in LLVM unified builds.
1 parent 658f0ea commit 8f0382c

17 files changed

+36
-32
lines changed

test/Concurrency/fail_implicit_concurrency_load.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// REQUIRES: concurrency
66
// RUN: %empty-directory(%t)
77
// RUN: mkdir -p %t/inputs
8-
// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift_obj_root/lib/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm
9-
// RUN: %target-swift-emit-pcm -module-name _SwiftConcurrencyShims %swift_obj_root/lib/swift/shims/module.modulemap -o %t/inputs/_SwiftConcurrencyShims.pcm
8+
// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm
9+
// RUN: %target-swift-emit-pcm -module-name _SwiftConcurrencyShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/_SwiftConcurrencyShims.pcm
1010

1111
// RUN: echo "[{" > %/t/inputs/map.json
1212
// RUN: echo "\"moduleName\": \"Swift\"," >> %/t/inputs/map.json
@@ -16,13 +16,13 @@
1616
// RUN: echo "{" >> %/t/inputs/map.json
1717
// RUN: echo "\"moduleName\": \"SwiftShims\"," >> %/t/inputs/map.json
1818
// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json
19-
// RUN: echo "\"clangModuleMapPath\": \"%swift_obj_root/lib/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
19+
// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
2020
// RUN: echo "\"clangModulePath\": \"%t/inputs/SwiftShims.pcm\"" >> %/t/inputs/map.json
2121
// RUN: echo "}," >> %/t/inputs/map.json
2222
// RUN: echo "{" >> %/t/inputs/map.json
2323
// RUN: echo "\"moduleName\": \"_SwiftConcurrencyShims\"," >> %/t/inputs/map.json
2424
// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json
25-
// RUN: echo "\"clangModuleMapPath\": \"%swift_obj_root/lib/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
25+
// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
2626
// RUN: echo "\"clangModulePath\": \"%t/inputs/_SwiftConcurrencyShims.pcm\"" >> %/t/inputs/map.json
2727
// RUN: echo "}," >> %/t/inputs/map.json
2828
// RUN: echo "{" >> %/t/inputs/map.json

test/Demangle/objc-getclass.cpp

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-clang %s -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -lswiftCore -lobjc -o %t/objc-getclass
2+
// RUN: %target-clang %s -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -lswiftCore -lobjc -o %t/objc-getclass
33
// RUN: %target-codesign %t/objc-getclass
44
// RUN: %target-run %t/objc-getclass %S/Inputs/objc-getclass.txt
55

test/Driver/LegacyDriver/legacy-driver-propagates-response-file-to-new-driver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
// REQUIRES: shell
77
// RUN: %{python} -c 'for i in range(500001): print("-DTEST5_" + str(i))' > %t.resp
8-
// RUN: cp %S/Inputs/print-args.sh %swift_obj_root/bin/legacy-driver-propagates-response-file.sh
8+
// RUN: cp %S/Inputs/print-args.sh %swift-bin-dir/legacy-driver-propagates-response-file.sh
99
// RUN: env SWIFT_USE_NEW_DRIVER=legacy-driver-propagates-response-file.sh %swiftc_driver_plain %s @%t.resp | %FileCheck %s
10-
// RUN: rm %swift_obj_root/bin/legacy-driver-propagates-response-file.sh
10+
// RUN: rm %swift-bin-dir/legacy-driver-propagates-response-file.sh
1111

1212
// CHECK: -Xfrontend
1313
// CHECK-NEXT: -new-driver-path

test/Frontend/module-alias-explicit-build.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
/// Create a module Bar
88
// RUN: echo 'public func bar() {}' > %t/inputs/FileBar.swift
99
// RUN: %target-swift-frontend -module-name Bar %t/inputs/FileBar.swift -emit-module -emit-module-path %t/inputs/Bar.swiftmodule
10-
// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift_obj_root/lib/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm
11-
// RUN: %target-swift-emit-pcm -module-name _SwiftConcurrencyShims %swift_obj_root/lib/swift/shims/module.modulemap -o %t/inputs/_SwiftConcurrencyShims.pcm
10+
// RUN: %target-swift-emit-pcm -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/SwiftShims.pcm
11+
// RUN: %target-swift-emit-pcm -module-name _SwiftConcurrencyShims %swift-lib-dir/swift/shims/module.modulemap -o %t/inputs/_SwiftConcurrencyShims.pcm
1212

1313
/// Check Bar.swiftmodule is created
1414
// RUN: test -f %t/inputs/Bar.swiftmodule
@@ -39,13 +39,13 @@
3939
// RUN: echo "{" >> %/t/inputs/map.json
4040
// RUN: echo "\"moduleName\": \"SwiftShims\"," >> %/t/inputs/map.json
4141
// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json
42-
// RUN: echo "\"clangModuleMapPath\": \"%swift_obj_root/lib/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
42+
// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
4343
// RUN: echo "\"clangModulePath\": \"%t/inputs/SwiftShims.pcm\"" >> %/t/inputs/map.json
4444
// RUN: echo "}," >> %/t/inputs/map.json
4545
// RUN: echo "{" >> %/t/inputs/map.json
4646
// RUN: echo "\"moduleName\": \"_SwiftConcurrencyShims\"," >> %/t/inputs/map.json
4747
// RUN: echo "\"isFramework\": false," >> %/t/inputs/map.json
48-
// RUN: echo "\"clangModuleMapPath\": \"%swift_obj_root/lib/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
48+
// RUN: echo "\"clangModuleMapPath\": \"%swift-lib-dir/swift/shims/module.modulemap\"," >> %/t/inputs/map.json
4949
// RUN: echo "\"clangModulePath\": \"%t/inputs/_SwiftConcurrencyShims.pcm\"" >> %/t/inputs/map.json
5050
// RUN: echo "}," >> %/t/inputs/map.json
5151
// RUN: echo "{" >> %/t/inputs/map.json

test/IRGen/conditional-dead-strip-exec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// RUN: %target-build-swift -Xfrontend -conditional-runtime-records %s -emit-ir -o %t/main.ll
77

8-
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -flto -o %t/main
8+
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -flto -o %t/main
99
// RUN: %target-codesign %t/main
1010
// RUN: %target-run %t/main | %FileCheck %s
1111

test/IRGen/conditional-dead-strip-reflection.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-build-swift -Xfrontend -conditional-runtime-records %s -emit-ir -o %t/main.ll
3-
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -flto -o %t/main
3+
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -flto -o %t/main
44
// RUN: %target-swift-reflection-dump %t/main | %FileCheck %s
55

66
// FIXME(mracek): More work needed to get this to work on non-Apple platforms.

test/IRGen/virtual-function-elimination-exec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// RUN: %empty-directory(%t)
66
// RUN: %target-build-swift -Xfrontend -enable-llvm-vfe %s -Onone -emit-ir -o %t/main.ll
7-
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -flto -o %t/main
7+
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -flto -o %t/main
88
// RUN: %target-codesign %t/main
99
// RUN: %target-run %t/main | %FileCheck %s
1010

test/IRGen/virtual-function-elimination-generics-exec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// RUN: %empty-directory(%t)
66
// RUN: %target-build-swift -Xfrontend -enable-llvm-vfe %s -Onone -emit-ir -o %t/main.ll
7-
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -flto -o %t/main
7+
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -flto -o %t/main
88
// RUN: %target-codesign %t/main
99
// RUN: %target-run %t/main | %FileCheck %s
1010

test/IRGen/witness-method-elimination-exec-relative.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// RUN: %empty-directory(%t)
66
// RUN: %target-build-swift -Xfrontend -enable-llvm-wme %s -Onone -emit-ir -o %t/main.ll -Xfrontend -enable-relative-protocol-witness-tables
7-
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -flto -o %t/main
7+
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -flto -o %t/main
88
// RUN: %target-codesign %t/main
99
// RUN: %target-run %t/main | %FileCheck %s
1010

test/IRGen/witness-method-elimination-exec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// RUN: %empty-directory(%t)
66
// RUN: %target-build-swift -Xfrontend -enable-llvm-wme %s -Onone -emit-ir -o %t/main.ll
7-
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift_obj_root/lib/swift/%target-sdk-name -flto -o %t/main
7+
// RUN: %target-clang %t/main.ll -isysroot %sdk -L%swift-lib-dir/swift/%target-sdk-name -flto -o %t/main
88
// RUN: %target-codesign %t/main
99
// RUN: %target-run %t/main | %FileCheck %s
1010

0 commit comments

Comments
 (0)