Skip to content

Commit b212229

Browse files
committed
test: add and use prefix substitutions for libraries
The naming convention is different on Windows than on Unix-like environments. In order to follow the convention we need to substitute the prefix and the suffix. Take the opportunity to rename the `target-dylib-extension` to the CMake-like variable `target-shared-library-suffix` and introduce `target-shared-library-prefix`. This helps linking the test suite binaries on Windows.
1 parent a30c32d commit b212229

34 files changed

+175
-166
lines changed

test/IRGen/vtable_symbol_linkage.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule.%target-dylib-extension
4-
// RUN: %target-build-swift -I %t %s %t/BaseModule.%target-dylib-extension -o %t/a.out
3+
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule%{target-shared-library-suffix}
4+
// RUN: %target-build-swift -I %t %s %t/BaseModule%{target-shared-library-suffix} -o %t/a.out
55

6-
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule.%target-dylib-extension -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience
7-
// RUN: %target-build-swift -I %t %s %t/BaseModule.%target-dylib-extension -o %t/a.out -Xfrontend -enable-class-resilience
6+
// RUN: %target-build-swift %S/Inputs/vtable_symbol_linkage_base.swift -emit-module -emit-module-path=%t/BaseModule.swiftmodule -emit-library -module-name BaseModule -o %t/BaseModule%{target-shared-library-suffix} -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience
7+
// RUN: %target-build-swift -I %t %s %t/BaseModule%{target-shared-library-suffix} -o %t/a.out -Xfrontend -enable-class-resilience
88

99
// Check if the program can be linked without undefined symbol errors.
1010

test/Interpreter/SDK/objc_getClass.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-build-swift-dylib(%t/libresilient_struct.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
4-
// RUN: %target-codesign %t/libresilient_struct.%target-dylib-extension
3+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
4+
// RUN: %target-codesign %t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix}
55

6-
// RUN: %target-build-swift-dylib(%t/libresilient_class.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
7-
// RUN: %target-codesign %t/libresilient_class.%target-dylib-extension
6+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_class%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
7+
// RUN: %target-codesign %t/%{target-shared-library-prefix}resilient_class%{target-shared-library-suffix}
88

99
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -o %t/main -Xlinker -rpath -Xlinker %t
1010
// RUN: %target-codesign %t/main
1111

12-
// RUN: %target-run %t/main %t/libresilient_struct.%target-dylib-extension %t/libresilient_class.%target-dylib-extension
12+
// RUN: %target-run %t/main %t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix} %t/libresilient_class%{target-shared-library-suffix}
1313

1414

1515
// REQUIRES: executable_test

test/Interpreter/class_resilience.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-build-swift-dylib(%t/libresilient_struct.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
4-
// RUN: %target-codesign %t/libresilient_struct.%target-dylib-extension
3+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct
4+
// RUN: %target-codesign %t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix}
55

6-
// RUN: %target-build-swift-dylib(%t/libresilient_class.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
7-
// RUN: %target-codesign %t/libresilient_class.%target-dylib-extension
6+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_class%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct
7+
// RUN: %target-codesign %t/%{target-shared-library-prefix}resilient_class%{target-shared-library-suffix}
88

9-
// RUN: %target-build-swift-dylib(%t/libfixed_layout_class.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct
10-
// RUN: %target-codesign %t/libfixed_layout_class.%target-dylib-extension
9+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}fixed_layout_class%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct
10+
// RUN: %target-codesign %t/%{target-shared-library-prefix}fixed_layout_class%{target-shared-library-suffix}
1111

1212
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct -lresilient_class -lfixed_layout_class -o %t/main -Xfrontend -enable-class-resilience -Xlinker -rpath -Xlinker %t
1313
// RUN: %target-codesign %t/main
1414

15-
// RUN: %target-run %t/main %t/libresilient_struct.%target-dylib-extension %t/libresilient_class.%target-dylib-extension %t/libfixed_layout_class.%target-dylib-extension
15+
// RUN: %target-run %t/main %t/%{target-shared-library-prefix}resilient_struct%{target-shared-library-suffix} %t/%{target-shared-library-prefix}resilient_class%{target-shared-library-suffix} %t/%{target-shared-library-prefix}fixed_layout_class%{target-shared-library-suffix}
1616

17-
// RUN: %target-build-swift-dylib(%t/libresilient_struct_wmo.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct -whole-module-optimization
18-
// RUN: %target-codesign %t/libresilient_struct_wmo.%target-dylib-extension
17+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_struct_wmo%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_struct.swift -emit-module -emit-module-path %t/resilient_struct.swiftmodule -module-name resilient_struct -whole-module-optimization
18+
// RUN: %target-codesign %t/%{target-shared-library-prefix}resilient_struct_wmo%{target-shared-library-suffix}
1919

20-
// RUN: %target-build-swift-dylib(%t/libresilient_class_wmo.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization
21-
// RUN: %target-codesign %t/libresilient_class_wmo.%target-dylib-extension
20+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}resilient_class_wmo%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/resilient_class.swift -emit-module -emit-module-path %t/resilient_class.swiftmodule -module-name resilient_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization
21+
// RUN: %target-codesign %t/%{target-shared-library-prefix}resilient_class_wmo%{target-shared-library-suffix}
2222

23-
// RUN: %target-build-swift-dylib(%t/libfixed_layout_class_wmo.%target-dylib-extension) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization
24-
// RUN: %target-codesign %t/libfixed_layout_class_wmo.%target-dylib-extension
23+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}fixed_layout_class_wmo%{target-shared-library-suffix}) -Xfrontend -enable-resilience -Xfrontend -enable-class-resilience %S/../Inputs/fixed_layout_class.swift -emit-module -emit-module-path %t/fixed_layout_class.swiftmodule -module-name fixed_layout_class -I%t -L%t -lresilient_struct_wmo -whole-module-optimization
24+
// RUN: %target-codesign %t/%{target-shared-library-prefix}fixed_layout_class_wmo%{target-shared-library-suffix}
2525

2626
// RUN: %target-build-swift %s -L %t -I %t -lresilient_struct_wmo -lresilient_class_wmo -lfixed_layout_class_wmo -Xfrontend -enable-class-resilience -o %t/main2 -Xlinker -rpath -Xlinker %t -module-name main
2727
// RUN: %target-codesign %t/main2
2828

29-
// RUN: %target-run %t/main2 %t/libresilient_struct_wmo.%target-dylib-extension %t/libresilient_class_wmo.%target-dylib-extension %t/libfixed_layout_class_wmo.%target-dylib-extension
29+
// RUN: %target-run %t/main2 %t/%{target-shared-library-prefix}resilient_struct_wmo%{target-shared-library-suffix} %t/%{target-shared-library-prefix}resilient_class_wmo%{target-shared-library-suffix} %t/%{target-shared-library-prefix}fixed_layout_class_wmo%{target-shared-library-suffix}
3030

3131
// REQUIRES: executable_test
3232

test/Interpreter/conditional_conformances_modules.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift-dylib(%t/libBasic.%target-dylib-extension) %S/../Inputs/conditional_conformance_basic_conformances.swift -module-name Basic -emit-module -emit-module-path %t/Basic.swiftmodule
3-
// RUN: %target-build-swift-dylib(%t/libWithAssoc.%target-dylib-extension) %S/../Inputs/conditional_conformance_with_assoc.swift -module-name WithAssoc -emit-module -emit-module-path %t/WithAssoc.swiftmodule
4-
// RUN: %target-build-swift-dylib(%t/libSubclass.%target-dylib-extension) %S/../Inputs/conditional_conformance_subclass.swift -module-name Subclass -emit-module -emit-module-path %t/Subclass.swiftmodule
2+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}Basic%{target-shared-library-suffix}) %S/../Inputs/conditional_conformance_basic_conformances.swift -module-name Basic -emit-module -emit-module-path %t/Basic.swiftmodule
3+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}WithAssoc%{target-shared-library-suffix}) %S/../Inputs/conditional_conformance_with_assoc.swift -module-name WithAssoc -emit-module -emit-module-path %t/WithAssoc.swiftmodule
4+
// RUN: %target-build-swift-dylib(%t/%{target-shared-library-prefix}Subclass%{target-shared-library-suffix}) %S/../Inputs/conditional_conformance_subclass.swift -module-name Subclass -emit-module -emit-module-path %t/Subclass.swiftmodule
55
// RUN: %target-build-swift -I%t -L%t -lBasic -lWithAssoc -lSubclass %s -o %t/conditional_conformances_modules -Xlinker -rpath -Xlinker %t
6-
// RUN: %target-run %t/conditional_conformances_modules %t/libBasic.%target-dylib-extension %t/libWithAssoc.%target-dylib-extension %t/libSubclass.%target-dylib-extension
6+
// RUN: %target-run %t/conditional_conformances_modules %t/%{target-shared-library-prefix}Basic%{target-shared-library-suffix} %t/%{target-shared-library-prefix}WithAssoc%{target-shared-library-suffix} %t/%{target-shared-library-prefix}Subclass%{target-shared-library-suffix}
77

88
// REQUIRES: executable_test
99
// FIXME: seems to fail on 32-bit simulator?

0 commit comments

Comments
 (0)