[llvm] 8b4a727 - [llvm-objdump][test] Fix --prefix tests for system-windows
Vinicius Tinti via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 13:58:16 PST 2021
Author: Vinicius Tinti
Date: 2021-02-09T21:54:51Z
New Revision: 8b4a7272810178a91f128f32b9f8ccb97bcf11b9
URL: https://github.com/llvm/llvm-project/commit/8b4a7272810178a91f128f32b9f8ccb97bcf11b9
DIFF: https://github.com/llvm/llvm-project/commit/8b4a7272810178a91f128f32b9f8ccb97bcf11b9.diff
LOG: [llvm-objdump][test] Fix --prefix tests for system-windows
Merging directories and files may produce different results on different
platforms.
Merging "./Inputs" and "source-interleave-x86_64.c" will use different
separators in POSIX and Windows.
Dedicated tests are needed for dealing with removing trailing separators
for POSIX (consider only '/') and Windows (consider '/' and '\').
Fixes D85024.
Fixes PR46368.
Reviewed By: jhenderson, MaskRay
Differential revision: https://reviews.llvm.org/D95513
Added:
llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
Modified:
llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
index a32d1b704736..0fba437dcde3 100644
--- a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
+++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
@@ -1,10 +1,11 @@
;; Test --prefix option platform specific behavior.
; UNSUPPORTED: system-windows
-;; Test removal of trailing separators (only '/').
+;; Test removal of trailing separators (only '/' on non-Windows systems).
;; The prefix 'myprefix/\' is not changed.
; RUN: sed -e "s,SRC_COMPDIR,/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll
; RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll
; RUN: llvm-objdump --prefix 'myprefix/\' --source %t.o 2>&1 | FileCheck %s -DFILE=%t.o -DPREFIX='myprefix/\'
; CHECK: warning: '[[FILE]]': failed to find source [[PREFIX]]/Inputs/source-interleave-x86_64.c
+
diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
new file mode 100644
index 000000000000..0f8952daec42
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
@@ -0,0 +1,11 @@
+;; Test --prefix option platform specific behavior.
+; REQUIRES: system-windows
+
+;; Test removal of trailing separators (both '/' and '\' on Windows systems).
+;; The prefix 'myprefix/\' is changed to 'myprefix'.
+
+; RUN: sed -e "s,SRC_COMPDIR,/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll
+; RUN: llc -o %t.o -filetype=obj -mtriple=x86_64-pc-linux %t.ll
+; RUN: llvm-objdump --prefix 'myprefix/\' --source %t.o 2>&1 | FileCheck %s -DFILE=%t.o -DPREFIX='myprefix'
+; CHECK: warning: '[[FILE]]': failed to find source [[PREFIX]]/Inputs\source-interleave-x86_64.c
+
diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
index 23ce55a329ac..f82d403437b4 100644
--- a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
+++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
@@ -1,13 +1,19 @@
;; Test --prefix option.
-;; UNSUPPORTED: system-windows
+
+;; Separators change from platform to platform. In POSIX the full path for the
+;; directory './Inputs' appended with the file 'source-interleave-x86_64.c' is
+;; './Inputs/source-interleave-x86_64.c'. For Windows it is
+;; './Inputs\source-interleave-x86_64.c'. Platform specific tests are needed
+;; since '\' may or may not be a separator.
;; Test prefix option ignored for relative paths.
+;; For the test below it is possible to accept both '/' and '\' as a separator.
; RUN: sed -e "s,SRC_COMPDIR,./Inputs,g" %p/Inputs/source-interleave.ll > %t-relative-path.ll
; RUN: llc -o %t-relative-path.o -filetype=obj -mtriple=x86_64-pc-linux %t-relative-path.ll
; RUN: llvm-objdump --prefix myprefix --source %t-relative-path.o 2>&1 | \
; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-relative-path.o -DPREFIX=.
-; CHECK-BROKEN-PREFIX: warning: '[[FILE]]': failed to find source [[PREFIX]]/Inputs/source-interleave-x86_64.c
+; CHECK-BROKEN-PREFIX: warning: '[[FILE]]': failed to find source [[PREFIX]]/Inputs{{[/\\]}}source-interleave-x86_64.c
;; Test invalid source interleave fixed by adding the correct prefix.
@@ -34,3 +40,4 @@
; RUN: llvm-objdump --prefix myprefix// --source %t-missing-prefix.o 2>&1 | \
; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-missing-prefix.o -DPREFIX=myprefix
+
More information about the llvm-commits
mailing list