diff options
author | Owen Reynolds <gbreynoo@gmail.com> | 2019-08-12 14:00:28 +0000 |
---|---|---|
committer | Owen Reynolds <gbreynoo@gmail.com> | 2019-08-12 14:00:28 +0000 |
commit | 47298393d2e4d35480d37b0afdea3e899dc798e2 (patch) | |
tree | 6e0a361043e95950771acd4706c0754802558969 /llvm/test/tools/llvm-ar | |
parent | fee242aed415458fa89eaaa0e4ae8a887bd8c874 (diff) | |
download | bcm5719-llvm-47298393d2e4d35480d37b0afdea3e899dc798e2.tar.gz bcm5719-llvm-47298393d2e4d35480d37b0afdea3e899dc798e2.zip |
[llvm-ar] Accept file paths with windows format slashes
The internal representation of llvm-ar archives uses linux style slashes
for paths, no matter the OS. In the case of windows this meant file
paths input intending to match existing members would only match if
linux style slashes where used. This change allows either slash
direction to be input by the user.
This change includes removing an unnecessary call to normalisePath and
moving the call of another.
Differential Revision: https://reviews.llvm.org/D65743
llvm-svn: 368573
Diffstat (limited to 'llvm/test/tools/llvm-ar')
-rw-r--r-- | llvm/test/tools/llvm-ar/windows-path.test | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-ar/windows-path.test b/llvm/test/tools/llvm-ar/windows-path.test new file mode 100644 index 00000000000..e33fbf532c3 --- /dev/null +++ b/llvm/test/tools/llvm-ar/windows-path.test @@ -0,0 +1,44 @@ +# Test that windows path seperators are handled correctly. +REQUIRES: system-windows + +# Note: many of these tests depend on relative paths, so we have to cd to a +# test directory first. +RUN: mkdir -p %t && cd %t +RUN: rm -rf a b && mkdir a b +RUN: echo hello-a > a/foo.txt +RUN: echo hello-b > b/foo.txt +RUN: echo hello-parent > foo.txt + +# P is implied when using thin archives. +# Create an archive. +RUN: rm -f archive.a +RUN: llvm-ar rcST archive.a a\..\a\foo.txt +RUN: llvm-ar rcST archive.a foo.txt +RUN: llvm-ar rcST archive.a b\foo.txt b/foo.txt +RUN: llvm-ar dT archive.a foo.txt +RUN: llvm-ar t archive.a | FileCheck %s --check-prefix=ARCHIVE --implicit-check-not {{.}} + +ARCHIVE: a/foo.txt +ARCHIVE-NEXT: b/foo.txt +ARCHIVE-NEXT: b/foo.txt + +RUN: llvm-ar t archive.a | FileCheck %s --check-prefix=LIST-BOTH --implicit-check-not {{.}} +RUN: llvm-ar t archive.a a\foo.txt | FileCheck %s --check-prefix=LIST-A --implicit-check-not {{.}} +RUN: llvm-ar t archive.a b\foo.txt | FileCheck %s --check-prefix=LIST-B --implicit-check-not {{.}} + +LIST-BOTH: a/foo.txt +LIST-BOTH-NEXT: b/foo.txt +LIST-BOTH-NEXT: b/foo.txt +LIST-A: a/foo.txt +LIST-B: b/foo.txt + +# Nesting a thin archive with a name conflict. +RUN: rm -f a\nested.a b\nested.a nested.a +RUN: llvm-ar rcST a\nested.a a\foo.txt +RUN: llvm-ar rcST b\nested.a b\foo.txt +RUN: llvm-ar rcST nested.a a\nested.a foo.txt b\nested.a +RUN: llvm-ar t nested.a | FileCheck %s --check-prefix=NESTED --implicit-check-not {{.}} + +NESTED: a/foo.txt +NESTED-NEXT: foo.txt +NESTED-NEXT: b/foo.txt |