[PATCH] D95513: [llvm-objdump][test] Fix --prefix tests for system-windows

Vinicius Tinti via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 05:14:43 PST 2021


tinti updated this revision to Diff 319534.
tinti edited the summary of this revision.
tinti added a comment.
Herald added a subscriber: pengfei.

Reword.
Explain behavior for adding {{[/\\]}}
Fix missing EOFs.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95513/new/

https://reviews.llvm.org/D95513

Files:
  llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
  llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
  llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test


Index: llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test
+++ 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.
 
@@ -43,3 +49,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
+
Index: llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-windows.test
===================================================================
--- /dev/null
+++ 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 '\' in system-windows).
+;; 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
+
Index: llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
+++ llvm/test/tools/llvm-objdump/X86/source-interleave-prefix-non-windows.test
@@ -1,7 +1,7 @@
 ;; Test --prefix option platform specific behavior.
 ; UNSUPPORTED: system-windows
 
-;; Test removal of trailing separators (only '/').
+;; Test removal of trailing separators (only '/' in non system-windows).
 ;; The prefix 'myprefix/\' is not changed.
 
 ; RUN: sed -e "s,SRC_COMPDIR,/Inputs,g" %p/Inputs/source-interleave.ll > %t.ll


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95513.319534.patch
Type: text/x-patch
Size: 3185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210127/89276b36/attachment.bin>


More information about the llvm-commits mailing list