xref: /llvm-project/llvm/test/tools/llvm-ranlib/error-opening-permission.test (revision 05216544a34eaf7aabf45df5f64d1c6c3e4e06c6)
1## Unsupported on windows as marking files "unreadable" is non-trivial on windows.
2# UNSUPPORTED: system-windows
3# REQUIRES: non-root-user
4
5# RUN: rm -rf %t && split-file %s %t && cd %t
6# RUN: yaml2obj 1.yaml -o 1.o
7# RUN: llvm-ar rcS a.a 1.o
8# RUN: cp a.a b.a && cp a.a c.a && cp a.a d.a
9# RUN: chmod 100 c.a
10# RUN: not llvm-ranlib a.a b.a c.a d.a 2>&1 | FileCheck %s --check-prefix=NO-PERMISSION -DMSG=%errc_EACCES
11
12# NO-PERMISSION:     error: unable to open 'c.a': [[MSG]]
13# NO-PERMISSION-NOT: {{.}}
14
15## The archives before c.a (a.a and b.a) have been processed.
16# RUN: llvm-nm --print-armap a.a | FileCheck %s
17# RUN: cmp a.a b.a
18## The others (c.a and d.a) do not have a symbol table.
19# RUN: chmod 700 c.a
20# RUN: llvm-nm --print-armap c.a | FileCheck %s --check-prefix=NOMAP
21# RUN: cmp c.a d.a
22
23# CHECK:      Archive map
24# CHECK-NEXT: foo in 1.o
25# CHECK-EMPTY:
26
27# NOMAP-NOT: Archive map
28
29#--- 1.yaml
30--- !ELF
31FileHeader:
32  Class:   ELFCLASS64
33  Data:    ELFDATA2LSB
34  Type:    ET_REL
35  Machine: EM_X86_64
36Sections:
37  - Name: .text
38    Type: SHT_PROGBITS
39Symbols:
40  - Name:    foo
41    Binding: STB_GLOBAL
42    Section: .text
43