summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit/tests
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2016-06-02 23:49:42 +0000
committerDaniel Dunbar <daniel@zuster.org>2016-06-02 23:49:42 +0000
commit591838d1d33bc0dc5d2ffc66dd22176f280cc625 (patch)
tree2367888e3b7458947c935a6553f727d016a3558a /llvm/utils/lit/tests
parentfb5c756606d037661ce5d61b536824af9e69b2d0 (diff)
downloadbcm5719-llvm-591838d1d33bc0dc5d2ffc66dd22176f280cc625.tar.gz
bcm5719-llvm-591838d1d33bc0dc5d2ffc66dd22176f280cc625.zip
[lit] Improve readability of failing scripts.
- This only applies to scripts executed by the _internal_ shell script interpreter. - This patch reworks the log to look more like a shell transcript, and be less verbose (but in the interest of calling attention to the important parts). Here is an example of the new format, for commands with/without failures and with/without output: ``` $ true $ echo hi hi $ false note: command had no output on stdout or stderr error: command failed with exit status 1 ``` llvm-svn: 271610
Diffstat (limited to 'llvm/utils/lit/tests')
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt3
-rw-r--r--llvm/utils/lit/tests/Inputs/shtest-output-printing/lit.cfg4
-rw-r--r--llvm/utils/lit/tests/shtest-format.py5
-rw-r--r--llvm/utils/lit/tests/shtest-output-printing.py26
-rw-r--r--llvm/utils/lit/tests/shtest-shell.py6
5 files changed, 38 insertions, 6 deletions
diff --git a/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt b/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
new file mode 100644
index 00000000000..1720c6097bd
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
@@ -0,0 +1,3 @@
+# RUN: true
+# RUN: echo hi
+# RUN: false
diff --git a/llvm/utils/lit/tests/Inputs/shtest-output-printing/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-output-printing/lit.cfg
new file mode 100644
index 00000000000..4fe698d7336
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-output-printing/lit.cfg
@@ -0,0 +1,4 @@
+import lit.formats
+config.name = 'shtest-output-printing'
+config.suffixes = ['.txt']
+config.test_format = lit.formats.ShTest(execute_external=False)
diff --git a/llvm/utils/lit/tests/shtest-format.py b/llvm/utils/lit/tests/shtest-format.py
index 39b0e9c9c62..20884f8c485 100644
--- a/llvm/utils/lit/tests/shtest-format.py
+++ b/llvm/utils/lit/tests/shtest-format.py
@@ -39,9 +39,8 @@
#
# CHECK: Command Output (stdout):
# CHECK-NEXT: --
-# CHECK-NEXT: Command 0: "printf"
-# CHECK-NEXT: Command 0 Result: 0
-# CHECK-NEXT: Command 0 Output:
+# CHECK-NEXT: $ "printf"
+# CHECK-NEXT: # command output:
# CHECK-NEXT: line 1: failed test output on stdout
# CHECK-NEXT: line 2: failed test output on stdout
diff --git a/llvm/utils/lit/tests/shtest-output-printing.py b/llvm/utils/lit/tests/shtest-output-printing.py
new file mode 100644
index 00000000000..1d5fc04ab81
--- /dev/null
+++ b/llvm/utils/lit/tests/shtest-output-printing.py
@@ -0,0 +1,26 @@
+# Check the various features of the ShTest format.
+#
+# RUN: not %{lit} -j 1 -v %{inputs}/shtest-output-printing > %t.out
+# RUN: FileCheck < %t.out %s
+#
+# END.
+
+# CHECK: -- Testing:
+
+# CHECK: FAIL: shtest-output-printing :: basic.txt
+# CHECK-NEXT: *** TEST 'shtest-output-printing :: basic.txt' FAILED ***
+# CHECK-NEXT: Script:
+# CHECK-NEXT: --
+# CHECK: --
+# CHECK-NEXT: Exit Code: 1
+#
+# CHECK: Command Output
+# CHECK-NEXT: --
+# CHECK-NEXT: $ "true"
+# CHECK-NEXT: $ "echo" "hi"
+# CHECK-NEXT: # command output:
+# CHECK-NEXT: hi
+#
+# CHECK: $ "false"
+# CHECK-NEXT: note: command had no output on stdout or stderr
+# CHECK-NEXT: error: command failed with exit status: 1
diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py
index 32479e19a10..379b040fc45 100644
--- a/llvm/utils/lit/tests/shtest-shell.py
+++ b/llvm/utils/lit/tests/shtest-shell.py
@@ -9,10 +9,10 @@
# CHECK: FAIL: shtest-shell :: error-0.txt
# CHECK: *** TEST 'shtest-shell :: error-0.txt' FAILED ***
-# CHECK: Command 0: "not-a-real-command"
-# CHECK: Command 0 Result: 127
-# CHECK: Command 0 Stderr:
+# CHECK: $ "not-a-real-command"
+# CHECK: # command stderr:
# CHECK: 'not-a-real-command': command not found
+# CHECK: error: command failed with exit status: 127
# CHECK: ***
# FIXME: The output here sucks.
OpenPOWER on IntegriCloud