11// RUN: %empty-directory(%t)
2- // RUN: %target-build-swift -Xfrontend -disable-availability-checking -I %swift-lib-dir -I %swift_src_root/lib/ExternalGenericMetadataBuilder -enable-experimental-feature Extern %s -o %t/VerifyExternalMetadata
2+ //
3+ // RUN: %host-build-swift %S/Inputs/testMetadataLibrary.swift -emit-library -emit-module -o %t/libtestMetadataLibrary.dylib
4+ // RUN: %target-codesign %t/libtestMetadataLibrary.dylib
5+ //
6+ // RUN: %target-build-swift -Xfrontend -disable-availability-checking -I %swift-lib-dir -I %swift_src_root/lib/ExternalGenericMetadataBuilder -I %t -L %t -ltestMetadataLibrary -enable-experimental-feature Extern %s -o %t/VerifyExternalMetadata
37// RUN: %target-codesign %t/VerifyExternalMetadata
48//
59// RUN: %host-build-swift -Xfrontend -disable-availability-checking -I %swift-lib-dir -I %swift_src_root/lib/ExternalGenericMetadataBuilder -L%swift-lib-dir -lswiftGenericMetadataBuilder -Xlinker -rpath -Xlinker %swift-lib-dir -enable-experimental-feature Extern %S/Inputs/buildMetadataJSON.swift -o %t/buildMetadataJSON
1115// RUN: %target-run %t/VerifyExternalMetadata getJSON > %t/names.json
1216// RUN: %target-run %t/buildMetadataJSON %target-arch %t/VerifyExternalMetadata %stdlib_dir/libswiftCore.dylib < %t/names.json > %t/libswiftPrespecialized.json
1317// RUN: %target-run %t/json2c %t/libswiftPrespecialized.json > %t/libswiftPrespecialized.c
14- // RUN: %clang -isysroot %sdk -target %target-triple -bundle %t/libswiftPrespecialized.c -L%stdlib_dir -lswiftCore -bundle_loader %t/VerifyExternalMetadata - o %t/libswiftPrespecialized.bundle
18+ // RUN: %clang -isysroot %sdk -target %target-triple -dynamiclib %t/libswiftPrespecialized.c -L%stdlib_dir -lswiftCore -o %t/libswiftPrespecialized.dylib
1519//
1620// Set a custom library path because we need to ensure we don't load an arm64e
1721// dylib into an arm64 test, since the prespecialized metadata depends on the
1822// exact contents of the library.
19- // RUN: env SWIFT_DEBUG_ENABLE_LIB_PRESPECIALIZED_LOGGING=y SWIFT_DEBUG_LIB_PRESPECIALIZED_PATH=%t/libswiftPrespecialized.bundle %target-run env DYLD_LIBRARY_PATH=%stdlib_dir/%target-arch %t/VerifyExternalMetadata
23+ // RUN: env SWIFT_DEBUG_ENABLE_LIB_PRESPECIALIZED_LOGGING=y DYLD_INSERT_LIBRARIES=%t/libswiftPrespecialized.dylib SWIFT_DEBUG_LIB_PRESPECIALIZED_PATH=%t/libswiftPrespecialized.dylib %target-run env DYLD_LIBRARY_PATH=%stdlib_dir/%target-arch %t/VerifyExternalMetadata
2024
2125// REQUIRES: executable_test
2226// REQUIRES: OS=macosx && CPU=arm64
@@ -25,32 +29,7 @@ import ExternalGenericMetadataBuilder
2529import Foundation
2630import StdlibUnittest
2731
28- public struct GenericStruct < T, U, V> {
29- var t : T
30- var u : U
31- var v : V
32- var str : String
33- }
34-
35- public struct GenericField < T, U> {
36- var field : GenericStruct < T , U , Double >
37- var int : Int
38- }
39-
40- public struct Box < T> {
41- var field : T
42- }
43-
44- public struct Box3 < T, U, V> {
45- var field1 : T
46- var field2 : U
47- var field3 : V
48- }
49-
50- // The protocol conformance puts a symbol into __DATA_CONST which the builder
51- // can use as the base symbol for references to other data.
52- public protocol PublicProto { }
53- extension Box3 : PublicProto { }
32+ import testMetadataLibrary
5433
5534let args = CommandLine . arguments
5635
@@ -60,8 +39,8 @@ if args.count > 1 && args[1] == "getJSON" {
6039 GenericField < GenericField < Int8 , Int16 > ,
6140 Array < GenericStruct < Double , String , Float > > > . self,
6241 Array< Array< Array< Array< Array< Array< Array< Double>>>>>>> . self ,
63- Box< Int> . self ,
64- Box< String> . self ,
42+ testMetadataLibrary . Box< Int> . self ,
43+ testMetadataLibrary . Box< String> . self ,
6544 Box3< Int, Int, Int> . self ,
6645 ]
6746 let typeNames = types. map { _mangledTypeName ( $0) ! }
0 commit comments