xref: /llvm-project/llvm/test/tools/llvm-readtapi/stubify-symlink-darwin.test (revision 0ed02621b9d87342daff0dcd9014319d4eeb2735)
1# Tapi's awareness of symlinks relies on POSIX level apis not available on windows.
2; REQUIRES: system-darwin
3
4; RUN: rm -rf %t
5; RUN: split-file %s %t
6; RUN: mkdir -p %t/sysroot/usr/lib/
7; RUN: mkdir -p %t/sysroot/System/Library/Frameworks/System.framework
8; RUN: yaml2obj %S/Inputs/libSystem.1.yaml -o %t/sysroot/usr/lib/libSystem.1.dylib
9; RUN: cd %t/sysroot/usr/lib
10# Set relative symlink.
11; RUN: ln -s  libSystem.1.dylib libSystem.dylib
12# Set broken but accepted symlink.
13; RUN: ln -s /usr/lib/libSystem.1.dylib %t/sysroot/System/Library/Frameworks/System.framework/System
14# Set absolute symlink.
15; RUN: ln -s  %t/sysroot/usr/lib/libSystem.dylib libfoo.dylib
16; RUN: cd %t
17; RUN: llvm-readtapi -stubify %t/sysroot 2>&1 | FileCheck -allow-empty %s
18; RUN: llvm-readtapi -compare %t/sysroot/usr/lib/libfoo.tbd  %t/expected_system.tbd 2>&1 | FileCheck -allow-empty %s
19; RUN: file %t/sysroot/System/Library/Frameworks/System.framework/System.tbd 2>&1 | FileCheck -allow-empty %s
20
21# Warn on invalid symlink.
22; RUN: ln -s  %t/sysroot/usr/libSystem.dylib %t/sysroot/usr/lib/libbroken.dylib
23; RUN: llvm-readtapi -stubify %t/sysroot 2>&1 | FileCheck %s --check-prefix BROKEN_SYMLINK
24
25; CHECK-NOT: error:
26; CHECK-NOT: warning:
27
28; BROKEN_SYMLINK: ignoring broken symlink: {{.*}}/usr/lib/libbroken.dylib
29
30;--- expected_system.tbd
31{
32  "main_library": {
33    "flags": [
34      {
35        "attributes": [
36          "not_app_extension_safe"
37        ]
38      }
39    ],
40    "install_names": [
41      {
42        "name": "/usr/lib/libSystem.1.dylib"
43      }
44    ],
45    "target_info": [
46      {
47        "min_deployment": "10.14",
48        "target": "x86_64-macos"
49      },
50      {
51        "min_deployment": "12",
52        "target": "x86_64-maccatalyst"
53      }
54    ]
55  },
56  "tapi_tbd_version": 5
57}
58