xref: /llvm-project/llvm/test/tools/llvm-readtapi/stubify-simple.test (revision 7189219ec9fc768f159917052b4b5998d077c39f)
1; RUN: rm -rf %t
2; RUN: split-file %s %t
3; RUN: yaml2obj %S/Inputs/flat_namespace.yaml -o %t/flat_namespace.dylib
4; RUN: yaml2obj %S/Inputs/thread_local.yaml -o %t/thread_local.dylib
5; RUN: yaml2obj %S/Inputs/universal.yaml -o %t/fat.dylib
6; RUN: yaml2obj %S/Inputs/objc.yaml -o %t/objc.dylib
7; RUN: llvm-readtapi -stubify %t/objc.dylib -o %t/new_objc.tbd 2>&1 | FileCheck %s --allow-empty
8; RUN: llvm-readtapi -stubify %t/objc.dylib %t/flat_namespace.dylib %t/thread_local.dylib %t/fat.dylib -delete-input 2>&1 | FileCheck %s --allow-empty
9; RUN: llvm-readtapi -compare %t/expected_flat.tbd %t/flat_namespace.tbd 2>&1 | FileCheck %s --allow-empty
10; RUN: llvm-readtapi -compare %t/expected_tl.tbd %t/thread_local.tbd 2>&1 | FileCheck %s --allow-empty
11; RUN: llvm-readtapi -compare %t/objc.tbd %t/expected_objc.tbd 2>&1 | FileCheck %s --allow-empty
12; RUN: llvm-readtapi -compare %t/new_objc.tbd %t/expected_objc.tbd 2>&1 | FileCheck %s --allow-empty
13
14; CHECK-NOT: error:
15; CHECK-NOT: warning:
16
17;--- expected_flat.tbd
18{
19  "main_library": {
20    "compatibility_versions": [
21      {
22        "version": "0"
23      }
24    ],
25    "current_versions": [
26      {
27        "version": "0"
28      }
29    ],
30    "exported_symbols": [
31      {
32        "text": {
33          "global": [ "_foo" ]
34        }
35      }
36    ],
37    "flags": [
38      {
39        "attributes": [
40          "flat_namespace",
41          "not_app_extension_safe"
42        ]
43      }
44    ],
45    "install_names": [
46      {
47        "name": "foo.dylib"
48      }
49    ],
50    "target_info": [
51      {
52        "min_deployment": "10.14",
53        "target": "x86_64-macos"
54      }
55    ],
56    "undefined_symbols": [
57      {
58        "data": {
59          "global": [ "dyld_stub_binder", "_bar", "_putchar" ]
60        }
61      }
62    ]
63  },
64  "tapi_tbd_version": 5
65}
66
67;--- expected_tl.tbd
68{
69  "main_library": {
70    "compatibility_versions": [
71      {
72        "version": "0"
73      }
74    ],
75    "current_versions": [
76      {
77        "version": "0"
78      }
79    ],
80    "exported_symbols": [
81      {
82        "data": {
83          "thread_local": [
84            "_MySymbol"
85          ]
86        }
87      }
88    ],
89    "flags": [
90      {
91        "attributes": [
92          "not_app_extension_safe"
93        ]
94      }
95    ],
96    "install_names": [
97      {
98        "name": "/System/Library/Frameworks/ThreadLocal.framework/ThreadLocal"
99      }
100    ],
101    "target_info": [
102      {
103        "min_deployment": "11",
104        "target": "x86_64-macos"
105      }
106    ]
107  },
108  "tapi_tbd_version": 5
109}
110
111;--- expected_objc.tbd
112{
113  "main_library": {
114    "compatibility_versions": [
115      {
116        "version": "0"
117      }
118    ],
119    "current_versions": [
120      {
121        "version": "0"
122      }
123    ],
124    "exported_symbols": [
125      {
126        "data": {
127          "objc_class": [
128            "Suggestion"
129          ],
130          "objc_ivar": [
131            "Suggestion._topChoice",
132            "Suggestion._other"
133          ]
134        }
135      }
136    ],
137    "flags": [
138      {
139        "attributes": [
140          "not_app_extension_safe"
141        ]
142      }
143    ],
144    "install_names": [
145      {
146        "name": "tmp.dylib"
147      }
148    ],
149    "target_info": [
150      {
151        "min_deployment": "13",
152        "target": "arm64-macos"
153      }
154    ]
155  },
156  "tapi_tbd_version": 5
157}
158
159