summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools
diff options
context:
space:
mode:
authorOwen Reynolds <gbreynoo@gmail.com>2019-06-04 10:13:03 +0000
committerOwen Reynolds <gbreynoo@gmail.com>2019-06-04 10:13:03 +0000
commit5d5078e341f593944d9badd53e374e6b319282da (patch)
treefb8ff535fd53402c5d82253f8c11143aed9ca321 /llvm/test/tools
parent3018d505a3643f1b191da1e2cc99493708ede186 (diff)
downloadbcm5719-llvm-5d5078e341f593944d9badd53e374e6b319282da.tar.gz
bcm5719-llvm-5d5078e341f593944d9badd53e374e6b319282da.zip
[llvm-ar] Reapply Fix relative thin archive path handling
Includes a fix for an introduced build failure due to a post c++11 use of std::mismatch. This fixes some thin archive relative path issues, paths are shortened where possible and paths are output correctly when using the display table command. Differential Revision: https://reviews.llvm.org/D59491 llvm-svn: 362484
Diffstat (limited to 'llvm/test/tools')
-rw-r--r--llvm/test/tools/llvm-ar/reduce-thin-path.test10
-rw-r--r--llvm/test/tools/llvm-ar/thin-archive.test45
-rw-r--r--llvm/test/tools/llvm-objcopy/ELF/archive-unknown-members.test8
-rw-r--r--llvm/test/tools/llvm-readobj/thin-archive-paths.test6
4 files changed, 62 insertions, 7 deletions
diff --git a/llvm/test/tools/llvm-ar/reduce-thin-path.test b/llvm/test/tools/llvm-ar/reduce-thin-path.test
new file mode 100644
index 00000000000..aea6101ce9b
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/reduce-thin-path.test
@@ -0,0 +1,10 @@
+RUN: rm -rf %t && mkdir -p %t/foo/bar/
+RUN: mkdir -p %t/baz/
+RUN: yaml2obj %S/Inputs/elf.yaml -o %t/elf.o
+
+RUN: cd %t && llvm-ar rTc %t/baz/internal.ar elf.o
+RUN: cd %t/foo && llvm-ar rTc %t/foo/bar/external.ar ../baz/internal.ar
+
+RUN: FileCheck -input-file=%t/foo/bar/external.ar %s
+
+CHECK: {{^}}../../elf.o/
diff --git a/llvm/test/tools/llvm-ar/thin-archive.test b/llvm/test/tools/llvm-ar/thin-archive.test
new file mode 100644
index 00000000000..8d9543b6869
--- /dev/null
+++ b/llvm/test/tools/llvm-ar/thin-archive.test
@@ -0,0 +1,45 @@
+RUN: rm -rf %t && mkdir -p %t/foo/bar/
+
+RUN: yaml2obj %S/Inputs/elf.yaml -o %t/foo/elf.o
+RUN: cp %t/foo/elf.o %t/foo/bar/elf.o
+RUN: cp %t/foo/bar/elf.o %t/delete.o
+
+Test that modules can be added with absolute paths when the archive is created using an absolute path
+
+RUN: llvm-ar rTc %t/absolute-1.ar %t/foo/elf.o %t/delete.o %t/foo/bar/elf.o
+RUN: llvm-ar dT %t/absolute-1.ar delete.o
+
+RUN: FileCheck -input-file=%t/absolute-1.ar --check-prefixes=THIN,CHECK %s -DPATH=%/t/
+RUN: llvm-ar t %t/absolute-1.ar | FileCheck %s -DPATH=%/t/
+
+Test that modules can be added with absolute paths when the archive is created using a relative path
+
+RUN: llvm-ar rTc Output/%basename_t.tmp/absolute-2.ar %t/foo/elf.o %t/delete.o %t/foo/bar/elf.o
+RUN: llvm-ar dT Output/%basename_t.tmp/absolute-2.ar %t/delete.o
+
+RUN: FileCheck -input-file=%t/absolute-2.ar --check-prefixes=THIN,CHECK %s -DPATH=%/t/
+RUN: llvm-ar t %t/absolute-2.ar | FileCheck %s -DPATH=%/t/
+
+These tests must be run in %t/foo. cd %t is included on each line to make debugging this test case easier.
+
+Test that modules can be added with relative paths when the archive is created using a relative path
+
+RUN: cd %t/foo && llvm-ar rTc ../relative-1.ar elf.o ../delete.o bar/elf.o
+RUN: cd %t/foo && llvm-ar dT ../relative-1.ar delete.o
+
+RUN: FileCheck -input-file=%t/relative-1.ar --check-prefixes=THIN,CHECK %s -DPATH=
+RUN: llvm-ar t %t/relative-1.ar | FileCheck %s -DPATH=%/t/
+
+Test that modules can be added with relative paths when the archive is created using a absolute path
+
+RUN: cd %t/foo && llvm-ar rTc %t/relative-2.ar elf.o ../delete.o bar/elf.o
+RUN: cd %t/foo && llvm-ar dT %t/relative-2.ar delete.o
+
+RUN: FileCheck -input-file=%t/relative-2.ar --check-prefixes=THIN,CHECK %s -DPATH=
+RUN: llvm-ar t %t/relative-2.ar | FileCheck %s -DPATH=%/t/
+
+THIN: !<thin>
+
+CHECK-NOT: delete.o
+CHECK: {{^}}[[PATH]]foo/elf.o
+CHECK: {{^}}[[PATH]]foo/bar/elf.o
diff --git a/llvm/test/tools/llvm-objcopy/ELF/archive-unknown-members.test b/llvm/test/tools/llvm-objcopy/ELF/archive-unknown-members.test
index 6540b630f7d..39a6597a83b 100644
--- a/llvm/test/tools/llvm-objcopy/ELF/archive-unknown-members.test
+++ b/llvm/test/tools/llvm-objcopy/ELF/archive-unknown-members.test
@@ -23,10 +23,10 @@
# RUN: llvm-ar rcT %t.thin1.a %t1.o %s
# RUN: llvm-ar rcT %t.thin2.a %t2.o %s
-# RUN: not llvm-objcopy --strip-debug %t.thin1.a 2>&1 \
-# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%t.thin1.a -DMEMBER=%s
-# RUN: not llvm-strip --strip-debug %t.thin2.a 2>&1 \
-# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%t.thin2.a -DMEMBER=%s
+# RUN: not llvm-objcopy --strip-debug %/t.thin1.a 2>&1 \
+# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%/t.thin1.a -DMEMBER=%/s
+# RUN: not llvm-strip --strip-debug %/t.thin2.a 2>&1 \
+# RUN: | FileCheck %s --check-prefix=THIN -DARCHIVE=%/t.thin2.a -DMEMBER=%/s
## Verify that the first member was not modified, if a later member could not
## be recognized.
# RUN: cmp %t.o %t1.o
diff --git a/llvm/test/tools/llvm-readobj/thin-archive-paths.test b/llvm/test/tools/llvm-readobj/thin-archive-paths.test
index f1952c739cc..d7a971eb303 100644
--- a/llvm/test/tools/llvm-readobj/thin-archive-paths.test
+++ b/llvm/test/tools/llvm-readobj/thin-archive-paths.test
@@ -23,11 +23,11 @@
# RUN: llvm-ar rcT c/absolute.a %t/a/b/1.o
# Show that absolute paths in the file header printing are correct.
-# RUN: llvm-readobj --file-headers c/absolute.a | FileCheck %s --check-prefix=ABS -DDIR=%t
+# RUN: llvm-readobj --file-headers c/absolute.a | FileCheck %s --check-prefix=ABS -DDIR=%/t
# ABS: File: [[DIR]]/a/b/1.o
# Show that absolute paths in an error message for both archive and member are correct.
# RUN: rm a/b/1.o
-# RUN: not llvm-readobj --file-headers %t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%t
-# RUN: not llvm-readelf --file-headers %t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%t
+# RUN: not llvm-readobj --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t
+# RUN: not llvm-readelf --file-headers %/t/c/absolute.a 2>&1 | FileCheck %s --check-prefix=ERR2 -DDIR=%/t
# ERR2: error: '[[DIR]]/c/absolute.a': '[[DIR]]/a/b/1.o': {{[Nn]}}o such file or directory
OpenPOWER on IntegriCloud