[PATCH] D120623: [lit] Read command stdout/stderr as text on Windows

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 26 14:42:47 PST 2022


mstorsjo created this revision.
mstorsjo added reviewers: jdenny, rnk.
Herald added subscribers: atanasyan, jrtc27, delcypher, sdardis, emaste.
mstorsjo requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

This takes care of normalizing newlines back to single LF instead
of CRLF.

This on itself breaks on a couple tests that accidentally seem to
be writing binary data to stdout; make sure those cases are piped
to /dev/null instead of actually written to a terminal.

This is an alternative to half of the fixes in D120546 <https://reviews.llvm.org/D120546>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120623

Files:
  llvm/test/MC/ELF/diff2.s
  llvm/test/MC/Mips/relocation-xfail.s
  llvm/test/Other/cfg-printer-branch-weights-percent.ll
  llvm/test/Other/cfg-printer-branch-weights.ll
  llvm/test/Other/cfg-printer-filter.ll
  llvm/test/Other/cfg_deopt_unreach.ll
  llvm/utils/lit/lit/TestRunner.py


Index: llvm/utils/lit/lit/TestRunner.py
===================================================================
--- llvm/utils/lit/lit/TestRunner.py
+++ llvm/utils/lit/lit/TestRunner.py
@@ -783,7 +783,8 @@
                                           stdout = stdout,
                                           stderr = stderr,
                                           env = cmd_shenv.env,
-                                          close_fds = kUseCloseFDs))
+                                          close_fds = kUseCloseFDs,
+                                          universal_newlines = True))
             proc_not_counts.append(not_count)
             # Let the helper know about this process
             timeoutHelper.addProcess(procs[-1])
Index: llvm/test/Other/cfg_deopt_unreach.ll
===================================================================
--- llvm/test/Other/cfg_deopt_unreach.ll
+++ llvm/test/Other/cfg_deopt_unreach.ll
@@ -1,12 +1,12 @@
 ; RUN: rm -rf %t
 ; RUN: mkdir -p %t
-; RUN: opt < %s -dot-cfg -cfg-hide-unreachable-paths -cfg-dot-filename-prefix=%t/unreach 2>/dev/null
+; RUN: opt < %s -dot-cfg -cfg-hide-unreachable-paths -cfg-dot-filename-prefix=%t/unreach 2>/dev/null > /dev/null
 ; RUN: FileCheck %s -input-file=%t/unreach.callee.dot -check-prefix=UNREACH
-; RUN: opt < %s -dot-cfg -cfg-hide-deoptimize-paths -cfg-dot-filename-prefix=%t/deopt 2>/dev/null
+; RUN: opt < %s -dot-cfg -cfg-hide-deoptimize-paths -cfg-dot-filename-prefix=%t/deopt 2>/dev/null > /dev/null
 ; RUN: FileCheck %s -input-file=%t/deopt.callee.dot -check-prefix=DEOPT
-; RUN: opt < %s -dot-cfg -cfg-dot-filename-prefix=%t/no-flags 2>/dev/null
+; RUN: opt < %s -dot-cfg -cfg-dot-filename-prefix=%t/no-flags 2>/dev/null > /dev/null
 ; RUN: FileCheck %s -input-file=%t/no-flags.callee.dot -check-prefix=NO-FLAGS
-; RUN: opt < %s -dot-cfg -cfg-hide-unreachable-paths -cfg-hide-deoptimize-paths -cfg-dot-filename-prefix=%t/both-flags 2>/dev/null
+; RUN: opt < %s -dot-cfg -cfg-hide-unreachable-paths -cfg-hide-deoptimize-paths -cfg-dot-filename-prefix=%t/both-flags 2>/dev/null > /dev/null
 ; RUN: FileCheck %s -input-file=%t/both-flags.callee.dot -check-prefix=BOTH-FLAGS
 
 declare i8 @llvm.experimental.deoptimize.i8(...)
Index: llvm/test/Other/cfg-printer-filter.ll
===================================================================
--- llvm/test/Other/cfg-printer-filter.ll
+++ llvm/test/Other/cfg-printer-filter.ll
@@ -1,12 +1,12 @@
 ; RUN: rm -f %t.other.dot %t-only.other.dot
 
 ;; Both f and func are dumped because their names contain the pattern 'f' as a substring.
-; RUN: opt < %s -dot-cfg -cfg-dot-filename-prefix=%t -cfg-func-name=f 2>/dev/null
+; RUN: opt < %s -dot-cfg -cfg-dot-filename-prefix=%t -cfg-func-name=f 2>/dev/null > /dev/null
 ; RUN: FileCheck %s -input-file=%t.f.dot -check-prefix=F
 ; RUN: FileCheck %s -input-file=%t.func.dot -check-prefix=Func
 ; RUN: not test -f %t.other.dot
 
-; RUN: opt < %s -dot-cfg-only -cfg-dot-filename-prefix=%t-only -cfg-func-name=f 2>/dev/null
+; RUN: opt < %s -dot-cfg-only -cfg-dot-filename-prefix=%t-only -cfg-func-name=f 2>/dev/null > /dev/null
 ; RUN: FileCheck %s -input-file=%t-only.f.dot -check-prefix=F
 ; RUN: FileCheck %s -input-file=%t-only.func.dot -check-prefix=Func
 ; RUN: not test -f %t-only.other.dot
Index: llvm/test/Other/cfg-printer-branch-weights.ll
===================================================================
--- llvm/test/Other/cfg-printer-branch-weights.ll
+++ llvm/test/Other/cfg-printer-branch-weights.ll
@@ -1,4 +1,4 @@
-;RUN: opt < %s -dot-cfg -cfg-weights -cfg-raw-weights -cfg-dot-filename-prefix=%t 2>/dev/null
+;RUN: opt < %s -dot-cfg -cfg-weights -cfg-raw-weights -cfg-dot-filename-prefix=%t 2>/dev/null > /dev/null
 ;RUN: FileCheck %s -input-file=%t.f.dot
 
 define void @f(i32) {
Index: llvm/test/Other/cfg-printer-branch-weights-percent.ll
===================================================================
--- llvm/test/Other/cfg-printer-branch-weights-percent.ll
+++ llvm/test/Other/cfg-printer-branch-weights-percent.ll
@@ -1,4 +1,4 @@
-;RUN: opt < %s -dot-cfg -cfg-weights -cfg-dot-filename-prefix=%t 2>/dev/null
+;RUN: opt < %s -dot-cfg -cfg-weights -cfg-dot-filename-prefix=%t 2>/dev/null > /dev/null
 ;RUN: FileCheck %s -input-file=%t.f.dot
 
 define void @f(i32) {
Index: llvm/test/MC/Mips/relocation-xfail.s
===================================================================
--- llvm/test/MC/Mips/relocation-xfail.s
+++ llvm/test/MC/Mips/relocation-xfail.s
@@ -1,5 +1,5 @@
 // RUN: llvm-mc -filetype=obj -triple mips-unknown-linux -mattr=+micromips < %s \
-// RUN:     | llvm-readobj --sections --section-data \
+// RUN:     | llvm-readobj --sections --section-data - \
 // RUN:     | FileCheck -check-prefix=DATA %s
 //
 // XFAIL: *
Index: llvm/test/MC/ELF/diff2.s
===================================================================
--- llvm/test/MC/ELF/diff2.s
+++ llvm/test/MC/ELF/diff2.s
@@ -1,4 +1,4 @@
-// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2> %t
+// RUN: not llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s 2> %t > /dev/null
 // RUN: FileCheck -input-file %t %s
 
 .global zed


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120623.411645.patch
Type: text/x-patch
Size: 5133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220226/b7bbeda4/attachment.bin>


More information about the llvm-commits mailing list