xref: /llvm-project/llvm/test/tools/llvm-readtapi/merge.test (revision ae182dbb1d199f92b9c146e3db8a738a30b587b9)
1; RUN: rm -rf %t
2; RUN: split-file %s %t
3; RUN: llvm-readtapi -merge %t/i386.tbd %t/x86_64.tbd %t/arm64.tbd --filetype tbd-v5 -o %t/out.tbd -compact 2>&1 | FileCheck %s --allow-empty
4; RUN: llvm-readtapi -merge %t/i386.tbd %t/x86_64.tbd %t/arm64.tbd --filetype=tbd-v5 --o %t/out.tbd -compact 2>&1 | FileCheck %s --allow-empty
5; RUN: llvm-readtapi -compare %t/out.tbd %t/expected.tbd 2>&1 | FileCheck %s --allow-empty
6
7; CHECK-NOT: error
8; CHECK-NOT: warning
9
10;--- expected.tbd
11{
12    "main_library": {
13        "allowable_clients": [{ "clients": ["ClientAll"] }],
14        "exported_symbols": [
15            {
16                "data": {
17                    "global": ["_sym1"],
18                    "objc_class": ["_A"],
19                    "thread_local": ["_tlv1"],
20                    "weak": ["_weak1"]
21                }
22            },
23            {
24                "data": {
25                    "objc_ivar": ["_A._ivar1"]
26                },
27                "targets": [ "x86_64-macos", "arm64-macos" ]
28            }
29        ],
30        "install_names": [
31            { "name": "/usr/lib/libfat.dylib" }
32        ],
33        "reexported_libraries": [
34            {
35                "names": [ "/usr/lib/liball.dylib" ]
36            }
37        ],
38        "target_info": [
39            { "target": "i386-macos" },
40            {
41                "min_deployment": "13.1",
42                "target": "x86_64-macos"
43            },
44            {
45                "target": "arm64-macos"
46            }
47        ]
48    },
49    "tapi_tbd_version": 5
50}
51
52
53;--- i386.tbd
54--- !tapi-tbd-v3
55archs:           [ i386 ]
56platform:        macosx
57install-name:    /usr/lib/libfat.dylib
58exports:
59  - archs:           [ i386 ]
60    allowable-clients: [ ClientAll ]
61    re-exports:      [ /usr/lib/liball.dylib ]
62    symbols:         [ _sym1 ]
63    objc-classes:    [ _A ]
64    weak-def-symbols: [ _weak1 ]
65    thread-local-symbols: [ _tlv1 ]
66...
67
68;--- x86_64.tbd
69{
70  "main_library": {
71    "allowable_clients": [
72      {
73        "clients": [
74          "ClientAll"
75        ]
76      }
77    ],
78    "exported_symbols": [
79      {
80        "data": {
81          "global": [
82            "_sym1"
83          ],
84          "objc_class": [
85            "_A"
86          ],
87          "objc_ivar": [
88            "_A._ivar1"
89          ],
90          "thread_local": [
91            "_tlv1"
92          ],
93          "weak": [
94            "_weak1"
95          ]
96        }
97      }
98    ],
99    "install_names": [
100      {
101        "name": "/usr/lib/libfat.dylib"
102      }
103    ],
104    "reexported_libraries": [
105      {
106        "names": [
107          "/usr/lib/liball.dylib"
108        ]
109      }
110    ],
111    "target_info": [
112      {
113        "min_deployment": "13.1",
114        "target": "x86_64-macos"
115      }
116    ]
117  },
118  "tapi_tbd_version": 5
119}
120
121;--- arm64.tbd
122--- !tapi-tbd
123tbd-version:     4
124targets:         [ arm64-macos ]
125install-name:    '/usr/lib/libfat.dylib'
126allowable-clients:
127  - targets:         [ arm64-macos ]
128    clients:         [ ClientAll ]
129reexported-libraries:
130  - targets:         [ arm64-macos ]
131    libraries:       [ '/usr/lib/liball.dylib' ]
132exports:
133  - targets:         [ arm64-macos ]
134    symbols:         [ _sym1 ]
135    objc-classes:    [ _A ]
136    objc-ivars:      [ _A._ivar1 ]
137    weak-symbols:    [ _weak1 ]
138    thread-local-symbols: [ _tlv1 ]
139...
140