xref: /llvm-project/llvm/test/tools/llvm-readtapi/extract-invalid.test (revision 4d29bdabab5cc953e21603f7f8c127a7f7540ed0)
1; RUN: rm -rf %t
2; RUN: split-file %s %t
3// Check readtapi only accepts one file.
4; RUN: not llvm-readtapi -extract %t/libfoo.tbd %t/libbar.tbd 2>&1 | FileCheck %s --allow-empty --check-prefix EXTRA
5// Check missing argument.
6; RUN: not llvm-readtapi -extract %t/libfoo.tbd 2>&1 | FileCheck %s --allow-empty --check-prefix MISSING
7// Check that TBD file manipulation was not valid and error propagated as expected.
8; RUN: not llvm-readtapi -arch x86_64 -extract %t/libfoo.tbd 2>&1 | FileCheck %s --allow-empty --check-prefix MISMATCH
9
10; EXTRA: error: extract only supports one input file
11; MISSING:  extract requires -arch <arch>
12; MISMATCH: error: {{.*}}libfoo.tbd' file doesn't have architecture 'x86_64'
13
14;--- libfoo.tbd
15--- !tapi-tbd
16tbd-version:     4
17targets:         [ arm64-ios ]
18flags:           [ not_app_extension_safe ]
19install-name:    '/usr/lib/libfoo.dylib'
20exports:
21  - targets:         [ arm64-ios ]
22    symbols:         [ _bar ]
23...
24
25;--- libbar.tbd
26{
27  "main_library": {
28    "exported_symbols": [
29      {
30        "data": {
31          "global": [
32            "_bar"
33          ]
34        }
35      }
36    ],
37    "flags": [
38      {
39        "attributes": [
40          "not_app_extension_safe"
41        ]
42      }
43    ],
44    "install_names": [
45      {
46        "name": "/usr/lib/libbar.dylib"
47      }
48    ],
49    "target_info": [
50      {
51        "target": "arm64-ios"
52      }
53    ]
54  },
55  "tapi_tbd_version": 5
56}
57