Skip to content

Commit 88c643a

Browse files
committed
[llvm-readobj]Add test showing behaviour of thin archive member path printing
This was a test requested in https://reviews.llvm.org/D58677. Reviewed by: rupprecht, grimar, Higuoxing Differential Revision: https://reviews.llvm.org/D5877 llvm-svn: 355183
1 parent 5bcf99b commit 88c643a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# RUN: rm -rf %t
2+
# RUN: mkdir -p %t/a/b
3+
# RUN: cd %t
4+
# RUN: cp %p/Inputs/trivial.obj.elf-x86-64 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 --check-prefix=REL
12+
# REL: File: 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
18+
# RUN: not llvm-readelf --file-headers a/relative.a 2>&1 | FileCheck %s --check-prefix=ERR1
19+
# ERR1: Error reading file: a/relative.a: 'b/1.o': {{[Nn]}}o such file or directory
20+
21+
# RUN: mkdir -p %t/c
22+
# RUN: cp %p/Inputs/trivial.obj.elf-x86-64 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 -DDIR=%t
27+
# ABS: File: [[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
32+
# RUN: not llvm-readelf --file-headers %t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%t
33+
# ERR2: Error reading file: [[DIR]]/c/absolute.a: '[[DIR]]/a/b/1.o': {{[Nn]}}o such file or directory

0 commit comments

Comments
 (0)