[PATCH] D67643: [lit] Extend internal diff to support `-` argument

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 17:13:12 PDT 2019


jdenny created this revision.
jdenny added reviewers: probinson, stella.stamenova, bd1976llvm, jlpeyton, rnk, mgorny.
Herald added a subscriber: delcypher.
Herald added a project: LLVM.

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

  # RUN: program | diff file -

Such cases exist now, in `clang/test/Analysis` for example.  We are 
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-` as a command-line option.

This patch adds support for `-` to mean stdin.  There are several
mechanisms in lit's `diff` implementation that deal with encodings.  I
have not yet determined how to handle those in python for stdin, so
I've just added diagnostics for when they are encountered.  So far, it
seems that's sufficient to make tests that use `-` pass when running
lit's internal shell under Linux.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67643

Files:
  llvm/utils/lit/lit/builtin_commands/diff.py
  llvm/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt
  llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt
  llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt
  llvm/utils/lit/tests/max-failures.py
  llvm/utils/lit/tests/shtest-shell.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67643.220409.patch
Type: text/x-patch
Size: 6581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190917/4dd71c9d/attachment-0001.bin>


More information about the llvm-commits mailing list