[all-commits] [llvm/llvm-project] b16380: [lit] Make internal diff work in pipelines

Joel E. Denny via All-commits all-commits at lists.llvm.org
Tue Oct 29 12:16:01 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b163806cdc317ee160a2ce694958c088a949fa7d
      https://github.com/llvm/llvm-project/commit/b163806cdc317ee160a2ce694958c088a949fa7d
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2019-10-29 (Tue, 29 Oct 2019)

  Changed paths:
    M llvm/utils/lit/lit/TestRunner.py
    A llvm/utils/lit/lit/builtin_commands/diff.py
    R llvm/utils/lit/tests/Inputs/shtest-shell/diff-error-0.txt
    A llvm/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt
    R llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-0.txt
    R llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified-error-1.txt
    M llvm/utils/lit/tests/Inputs/shtest-shell/diff-unified.txt
    M llvm/utils/lit/tests/max-failures.py
    M llvm/utils/lit/tests/shtest-shell.py

  Log Message:
  -----------
  [lit] Make internal diff work in pipelines

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 -
 # RUN: not diff file1 file2 | FileCheck %s
```

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` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Also, when lit's `diff` prints differences to stdout in Windows, this
patch ensures it always terminate lines with `\n` not `\r\n`.  That
way, strict FileCheck directives checking the `diff` output succeed in
both Linux and Windows.  This wasn't an issue when `diff` was internal
to lit because `diff` didn't then write to the true stdout, which is
where the `\n` -> `\r\n` conversion happened in Python.

Reviewed By: probinson, stella.stamenova

Differential Revision: https://reviews.llvm.org/D66574


  Commit: 7c1d536c21c7d98be350ffab8353e202c14dcc93
      https://github.com/llvm/llvm-project/commit/7c1d536c21c7d98be350ffab8353e202c14dcc93
  Author: Joel E. Denny <jdenny.ornl at gmail.com>
  Date:   2019-10-29 (Tue, 29 Oct 2019)

  Changed paths:
    M llvm/utils/lit/lit/builtin_commands/diff.py
    M llvm/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt
    M llvm/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt
    A llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt
    A llvm/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt
    M llvm/utils/lit/tests/max-failures.py
    M llvm/utils/lit/tests/shtest-shell.py

  Log Message:
  -----------
  [lit] Extend internal diff to support `-` argument

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.

Reviewed By: probinson, rnk

Differential Revision: https://reviews.llvm.org/D67643


Compare: https://github.com/llvm/llvm-project/compare/772533d9214b...7c1d536c21c7


More information about the All-commits mailing list