File: install-name-tool-id.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (67 lines) | stat: -rw-r--r-- 1,955 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## This test checks updating a dynamic shared library ID in a MachO binary.

# RUN: yaml2obj %s --docnum=1 -o %t

## Specifying -id once:
# RUN: llvm-install-name-tool -id /usr/lib/A_long_long_test %t
# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID --implicit-check-not='name /usr'

# ID: name /usr/lib/A_long_long_test

## Specifying -id more than once:
# RUN: llvm-install-name-tool -id /usr/lib/B_long -id /usr/lib/K_long -id /usr/A_short  %t
# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=ID-MULTIPLE --implicit-check-not='name /usr'

# ID-MULTIPLE: name /usr/A_short

## Specifying -id with empty string:
# RUN: not llvm-install-name-tool -id '' %t 2>&1 | \
# RUN:   FileCheck %s --check-prefix=EMPTY

# EMPTY: cannot specify an empty id

## Missing id argument:
# RUN: not llvm-install-name-tool %t -id 2>&1 | \
# RUN:   FileCheck %s --check-prefix=MISSING

# MISSING: missing argument to -id option

## Shared dylib binary
--- !mach-o
FileHeader:
  magic:           0xFEEDFACF
  cputype:         0x01000007
  cpusubtype:      0x00000003
  filetype:        0x00000006
  ncmds:           1
  sizeofcmds:      56
  flags:           0x00002000
  reserved:        0x00000000
LoadCommands:
  - cmd:                        LC_ID_DYLIB
    cmdsize:                    56
    dylib:
        name:                   24
        timestamp:              2
        current_version:        82115073
        compatibility_version:  65536
    Content:                    '/usr/lib/A'

# RUN: yaml2obj %s --docnum=2 -o %t

## Check that -id option has no effect if binary is not a shared dylib:
# RUN: cp %t %t1
# RUN: llvm-install-name-tool -id /usr/lib/J %t
# RUN: cmp %t %t1

## Executable binary
--- !mach-o
FileHeader:
  magic:           0xFEEDFACF
  cputype:         0x01000007
  cpusubtype:      0x00000003
  filetype:        0x00000001
  ncmds:           0
  sizeofcmds:      0
  flags:           0x00002000
  reserved:        0x00000000