xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/thin-archive-paths.test (revision 42a21778f61cdc8462ce2cfb6ad7bc1992b2063c)
1# RUN: rm -rf %t
2# RUN: mkdir -p %t/a/b
3# RUN: cd %t
4# RUN: yaml2obj %s -o a/b/1.o
5# The archive is deliberately in a different directory to the cwd, to show that
6# the member paths printed are exactly what's in the archive and not relative
7# to the cwd.
8# RUN: llvm-ar rcT a/relative.a a/b/1.o
9
10# Show that relative paths in the file header printing look sensible.
11# RUN: llvm-readobj --file-headers a/relative.a | FileCheck %s -DARFILE="a/relative.a" --check-prefix=REL
12# REL: File: [[ARFILE]](b/1.o)
13
14# Show that relative paths in an error message for both archive and member look
15# sensible.
16# RUN: rm a/b/1.o
17# RUN: not llvm-readobj --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1 -DMSG=%errc_ENOENT
18# RUN: not llvm-readelf --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1 -DMSG=%errc_ENOENT
19# ERR1: error: 'a/relative.a': 'b/1.o': [[MSG]]
20
21# RUN: mkdir -p %t/c
22# RUN: yaml2obj %s -o a/b/1.o
23# RUN: llvm-ar rcT c/absolute.a %t/a/b/1.o
24
25# Show that absolute paths in the file header printing are correct.
26# RUN: llvm-readobj --file-headers c/absolute.a | FileCheck %s --check-prefix=ABS -DARFILE="c/absolute.a" -DDIR=%/t
27# ABS: File: [[ARFILE]]([[DIR]]/a/b/1.o)
28
29# Show that absolute paths in an error message for both archive and member are correct.
30# RUN: rm a/b/1.o
31# RUN: not llvm-readobj --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t -DMSG=%errc_ENOENT
32# RUN: not llvm-readelf --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t -DMSG=%errc_ENOENT
33# ERR2: error: '[[DIR]]/c/absolute.a': '[[DIR]]/a/b/1.o': [[MSG]]
34
35--- !ELF
36FileHeader:
37  Class: ELFCLASS32
38  Data:  ELFDATA2LSB
39  Type:  ET_DYN
40