[llvm] r374426 - Revert r374390: "[lit] Extend internal diff to support `-` argument"

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 12:25:11 PDT 2019


Author: jdenny
Date: Thu Oct 10 12:25:11 2019
New Revision: 374426

URL: http://llvm.org/viewvc/llvm-project?rev=374426&view=rev
Log:
Revert r374390: "[lit] Extend internal diff to support `-` argument"

This breaks a Windows bot.

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

Modified: llvm/trunk/utils/lit/lit/builtin_commands/diff.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/builtin_commands/diff.py?rev=374426&r1=374425&r2=374426&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/builtin_commands/diff.py (original)
+++ llvm/trunk/utils/lit/lit/builtin_commands/diff.py Thu Oct 10 12:25:11 2019
@@ -27,13 +27,8 @@ def getDirTree(path, basedir=""):
 def compareTwoFiles(flags, filepaths):
     filelines = []
     for file in filepaths:
-        if file == "-":
-            stdin_fileno = sys.stdin.fileno()
-            with os.fdopen(os.dup(stdin_fileno), 'rb') as stdin_bin:
-                filelines.append(stdin_bin.readlines())
-        else:
-            with open(file, 'rb') as file_bin:
-                filelines.append(file_bin.readlines())
+        with open(file, 'rb') as file_bin:
+            filelines.append(file_bin.readlines())
 
     try:
         return compareTwoTextFiles(flags, filepaths, filelines,
@@ -199,13 +194,10 @@ def main(argv):
     exitCode = 0
     try:
         for file in args:
-            if file != "-" and not os.path.isabs(file):
+            if not os.path.isabs(file):
                 file = os.path.realpath(os.path.join(os.getcwd(), file))
 
             if flags.recursive_diff:
-                if file == "-":
-                    sys.stderr.write("Error: cannot recursively compare '-'\n")
-                    sys.exit(1)
                 dir_trees.append(getDirTree(file))
             else:
                 filepaths.append(file)

Modified: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt?rev=374426&r1=374425&r2=374426&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt (original)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-encodings.txt Thu Oct 10 12:25:11 2019
@@ -5,11 +5,5 @@
 # RUN: diff -u diff-in.utf8 diff-in.bin && false || true
 # RUN: diff -u diff-in.bin diff-in.utf8 && false || true
 
-# RUN: cat diff-in.bin | diff -u - diff-in.bin
-# RUN: cat diff-in.bin | diff -u diff-in.bin -
-# RUN: cat diff-in.bin | diff -u diff-in.utf16 - && false || true
-# RUN: cat diff-in.bin | diff -u diff-in.utf8 - && false || true
-# RUN: cat diff-in.bin | diff -u - diff-in.utf8 && false || true
-
 # Fail so lit will print output.
 # RUN: false

Modified: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt?rev=374426&r1=374425&r2=374426&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt (original)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-pipes.txt Thu Oct 10 12:25:11 2019
@@ -5,16 +5,6 @@
 # RUN: diff %t.foo %t.foo | FileCheck -allow-empty -check-prefix=EMPTY %s
 # RUN: diff -u %t.foo %t.bar | FileCheck %s && false || true
 
-# Check input pipe.
-# RUN: echo foo | diff -u - %t.foo
-# RUN: echo foo | diff -u %t.foo -
-# RUN: echo bar | diff -u %t.foo - && false || true
-# RUN: echo bar | diff -u - %t.foo && false || true
-
-# Check output and input pipes at the same time.
-# RUN: echo foo | diff - %t.foo | FileCheck -allow-empty -check-prefix=EMPTY %s
-# RUN: echo bar | diff -u %t.foo - | FileCheck %s && false || true
-
 # Fail so lit will print output.
 # RUN: false
 

Removed: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt?rev=374425&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt (original)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-7.txt (removed)
@@ -1,2 +0,0 @@
-# diff -r currently cannot handle stdin.
-# RUN: diff -r - %t

Removed: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt?rev=374425&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt (original)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/diff-r-error-8.txt (removed)
@@ -1,2 +0,0 @@
-# diff -r currently cannot handle stdin.
-# RUN: diff -r %t -

Modified: llvm/trunk/utils/lit/tests/max-failures.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/max-failures.py?rev=374426&r1=374425&r2=374426&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/max-failures.py (original)
+++ llvm/trunk/utils/lit/tests/max-failures.py Thu Oct 10 12:25:11 2019
@@ -8,7 +8,7 @@
 #
 # END.
 
-# CHECK: Failing Tests (30)
+# CHECK: Failing Tests (28)
 # CHECK: Failing Tests (1)
 # CHECK: Failing Tests (2)
 # CHECK: error: argument --max-failures: requires positive integer, but found '0'

Modified: llvm/trunk/utils/lit/tests/shtest-shell.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/shtest-shell.py?rev=374426&r1=374425&r2=374426&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/shtest-shell.py (original)
+++ llvm/trunk/utils/lit/tests/shtest-shell.py Thu Oct 10 12:25:11 2019
@@ -81,60 +81,6 @@
 # CHECK: error: command failed with exit status: 1
 # CHECK: $ "true"
 
-# CHECK: $ "cat" "diff-in.bin"
-# CHECK-NOT: error
-# CHECK: $ "diff" "-u" "-" "diff-in.bin"
-# CHECK-NOT: error
-
-# CHECK: $ "cat" "diff-in.bin"
-# CHECK-NOT: error
-# CHECK: $ "diff" "-u" "diff-in.bin" "-"
-# CHECK-NOT: error
-
-# CHECK: $ "cat" "diff-in.bin"
-# CHECK-NOT: error
-# CHECK: $ "diff" "-u" "diff-in.utf16" "-"
-# CHECK: # command output:
-# CHECK-NEXT: ---
-# CHECK-NEXT: +++
-# CHECK-NEXT: @@
-# CHECK-NEXT: {{^ .f.o.o.$}}
-# CHECK-NEXT: {{^-.b.a.r.$}}
-# CHECK-NEXT: {{^\+.b.a.r..}}
-# CHECK-NEXT: {{^ .b.a.z.$}}
-# CHECK: error: command failed with exit status: 1
-# CHECK: $ "true"
-
-# CHECK: $ "cat" "diff-in.bin"
-# CHECK-NOT: error
-# CHECK: $ "diff" "-u" "diff-in.utf8" "-"
-# CHECK: # command output:
-# CHECK-NEXT: ---
-# CHECK-NEXT: +++
-# CHECK-NEXT: @@
-# CHECK-NEXT: -foo
-# CHECK-NEXT: -bar
-# CHECK-NEXT: -baz
-# CHECK-NEXT: {{^\+.f.o.o.$}}
-# CHECK-NEXT: {{^\+.b.a.r..}}
-# CHECK-NEXT: {{^\+.b.a.z.$}}
-# CHECK: error: command failed with exit status: 1
-# CHECK: $ "true"
-
-# CHECK: $ "diff" "-u" "-" "diff-in.utf8"
-# CHECK: # command output:
-# CHECK-NEXT: ---
-# CHECK-NEXT: +++
-# CHECK-NEXT: @@
-# CHECK-NEXT: {{^\-.f.o.o.$}}
-# CHECK-NEXT: {{^\-.b.a.r..}}
-# CHECK-NEXT: {{^\-.b.a.z.$}}
-# CHECK-NEXT: +foo
-# CHECK-NEXT: +bar
-# CHECK-NEXT: +baz
-# CHECK: error: command failed with exit status: 1
-# CHECK: $ "true"
-
 # CHECK: $ "false"
 
 # CHECK: ***
@@ -212,51 +158,6 @@
 # CHECK-NOT: error
 # CHECK: $ "true"
 
-# CHECK: $ "echo" "foo"
-# CHECK: $ "diff" "-u" "-" "{{[^"]*}}.foo"
-# CHECK-NOT: note
-# CHECK-NOT: error
-
-# CHECK: $ "echo" "foo"
-# CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "-"
-# CHECK-NOT: note
-# CHECK-NOT: error
-
-# CHECK: $ "echo" "bar"
-# CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "-"
-# CHECK: # command output:
-# CHECK: @@
-# CHECK-NEXT: -foo
-# CHECK-NEXT: +bar
-# CHECK: error: command failed with exit status: 1
-# CHECK: $ "true"
-
-# CHECK: $ "echo" "bar"
-# CHECK: $ "diff" "-u" "-" "{{[^"]*}}.foo"
-# CHECK: # command output:
-# CHECK: @@
-# CHECK-NEXT: -bar
-# CHECK-NEXT: +foo
-# CHECK: error: command failed with exit status: 1
-# CHECK: $ "true"
-
-# CHECK: $ "echo" "foo"
-# CHECK: $ "diff" "-" "{{[^"]*}}.foo"
-# CHECK-NOT: note
-# CHECK-NOT: error
-# CHECK: $ "FileCheck"
-# CHECK-NOT: note
-# CHECK-NOT: error
-
-# CHECK: $ "echo" "bar"
-# CHECK: $ "diff" "-u" "{{[^"]*}}.foo" "-"
-# CHECK: note: command had no output on stdout or stderr
-# CHECK: error: command failed with exit status: 1
-# CHECK: $ "FileCheck"
-# CHECK-NOT: note
-# CHECK-NOT: error
-# CHECK: $ "true"
-
 # CHECK: $ "false"
 
 # CHECK: ***
@@ -315,20 +216,6 @@
 # CHECK: File {{.*}}dir1{{.*}}extra_file is a regular empty file while file {{.*}}dir2{{.*}}extra_file is a directory
 # CHECK: error: command failed with exit status: 1
 
-# CHECK: FAIL: shtest-shell :: diff-r-error-7.txt
-# CHECK: *** TEST 'shtest-shell :: diff-r-error-7.txt' FAILED ***
-# CHECK: $ "diff" "-r" "-" "{{[^"]*}}"
-# CHECK: # command stderr:
-# CHECK: Error: cannot recursively compare '-'
-# CHECK: error: command failed with exit status: 1
-
-# CHECK: FAIL: shtest-shell :: diff-r-error-8.txt
-# CHECK: *** TEST 'shtest-shell :: diff-r-error-8.txt' FAILED ***
-# CHECK: $ "diff" "-r" "{{[^"]*}}" "-"
-# CHECK: # command stderr:
-# CHECK: Error: cannot recursively compare '-'
-# CHECK: error: command failed with exit status: 1
-
 # CHECK: PASS: shtest-shell :: diff-r.txt
 
 # CHECK: FAIL: shtest-shell :: error-0.txt
@@ -410,4 +297,4 @@
 # CHECK: PASS: shtest-shell :: sequencing-0.txt
 # CHECK: XFAIL: shtest-shell :: sequencing-1.txt
 # CHECK: PASS: shtest-shell :: valid-shell.txt
-# CHECK: Failing Tests (30)
+# CHECK: Failing Tests (28)




More information about the llvm-commits mailing list