[llvm] r174102 - [lit] Add a test for internal shell execution behaviors.

Daniel Dunbar daniel at zuster.org
Thu Jan 31 14:15:20 PST 2013


Author: ddunbar
Date: Thu Jan 31 16:15:20 2013
New Revision: 174102

URL: http://llvm.org/viewvc/llvm-project?rev=174102&view=rev
Log:
[lit] Add a test for internal shell execution behaviors.

Added:
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-0.txt
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-1.txt
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-2.txt
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/lit.cfg
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/redirects.txt
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-0.txt
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-1.txt
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh   (with props)
    llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh   (with props)
    llvm/trunk/utils/lit/tests/shtest-shell.py

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-0.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-0.txt?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-0.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-0.txt Thu Jan 31 16:15:20 2013
@@ -0,0 +1,3 @@
+# Check error on an internal shell error (unable to find command).
+#
+# RUN: not-a-real-command

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-1.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-1.txt?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-1.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-1.txt Thu Jan 31 16:15:20 2013
@@ -0,0 +1,3 @@
+# Check error on a shell parsing failure.
+#
+# RUN: echo "missing quote

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-2.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-2.txt?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-2.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/error-2.txt Thu Jan 31 16:15:20 2013
@@ -0,0 +1,3 @@
+# Check error on a unsupported redirect.
+#
+# RUN: echo "hello" 3>&1

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/lit.cfg?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/lit.cfg (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/lit.cfg Thu Jan 31 16:15:20 2013
@@ -0,0 +1,5 @@
+config.name = 'shtest-shell'
+config.suffixes = ['.txt']
+config.test_format = lit.formats.ShTest()
+config.test_source_root = None
+config.test_exec_root = None

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/redirects.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/redirects.txt?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/redirects.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/redirects.txt Thu Jan 31 16:15:20 2013
@@ -0,0 +1,41 @@
+# Check stdout redirect (> and >>).
+#
+# RUN: echo "not-present" > %t.stdout-write
+# RUN: echo "is-present" > %t.stdout-write
+# RUN: FileCheck --check-prefix=STDOUT-WRITE < %t.stdout-write %s
+#
+# STDOUT-WRITE-NOT: not-present
+# STDOUT-WRITE: is-present
+#
+# RUN: echo "appended-line" >> %t.stdout-write
+# RUN: FileCheck --check-prefix=STDOUT-APPEND < %t.stdout-write %s
+#
+# STDOUT-APPEND: is-present
+# STDOUT-APPEND: appended-line
+
+
+# Check stderr redirect (2> and 2>>).
+#
+# RUN: echo "not-present" > %t.stderr-write
+# RUN: %S/write-to-stderr.sh 2> %t.stderr-write
+# RUN: FileCheck --check-prefix=STDERR-WRITE < %t.stderr-write %s
+#
+# STDERR-WRITE-NOT: not-present
+# STDERR-WRITE: a line on stderr
+#
+# RUN: %S/write-to-stderr.sh 2>> %t.stderr-write
+# RUN: FileCheck --check-prefix=STDERR-APPEND < %t.stderr-write %s
+#
+# STDERR-APPEND: a line on stderr
+# STDERR-APPEND: a line on stderr
+
+
+# Check combined redirect (&>).
+#
+# RUN: echo "not-present" > %t.combined
+# RUN: %S/write-to-stdout-and-stderr.sh &> %t.combined
+# RUN: FileCheck --check-prefix=COMBINED-WRITE < %t.combined %s
+#
+# COMBINED-WRITE-NOT: not-present
+# COMBINED-WRITE: a line on stdout
+# COMBINED-WRITE: a line on stderr

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-0.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-0.txt?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-0.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-0.txt Thu Jan 31 16:15:20 2013
@@ -0,0 +1,28 @@
+# Check sequencing operations.
+#
+# RUN: echo "first-line" > %t.out && echo "second-line" >> %t.out
+# RUN: FileCheck --check-prefix CHECK-AND < %t.out %s
+#
+# CHECK-AND: first-line
+# CHECK-AND: second-line
+#
+# The false case of && is tested in sequencing-2.txt
+
+
+# RUN: echo "first-line" > %t.out || echo "second-line" >> %t.out
+# RUN: FileCheck --check-prefix CHECK-OR-1 < %t.out %s
+#
+# CHECK-OR-1: first-line
+# CHECK-OR-1-NOT: second-line
+
+# RUN: false || echo "second-line" > %t.out
+# RUN: FileCheck --check-prefix CHECK-OR-2 < %t.out %s
+#
+# CHECK-OR-2: second-line
+
+
+# RUN: echo "first-line" > %t.out; echo "second-line" >> %t.out
+# RUN: FileCheck --check-prefix CHECK-SEQ < %t.out %s
+#
+# CHECK-SEQ: first-line
+# CHECK-SEQ: second-line

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-1.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-1.txt?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-1.txt (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/sequencing-1.txt Thu Jan 31 16:15:20 2013
@@ -0,0 +1,2 @@
+# RUN: false && true
+# XFAIL: *

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh Thu Jan 31 16:15:20 2013
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo "a line on stderr" 1>&2

Propchange: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stderr.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh (added)
+++ llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh Thu Jan 31 16:15:20 2013
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo "a line on stdout"
+echo "a line on stderr" 1>&2

Propchange: llvm/trunk/utils/lit/tests/Inputs/shtest-shell/write-to-stdout-and-stderr.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: llvm/trunk/utils/lit/tests/shtest-shell.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/shtest-shell.py?rev=174102&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/shtest-shell.py (added)
+++ llvm/trunk/utils/lit/tests/shtest-shell.py Thu Jan 31 16:15:20 2013
@@ -0,0 +1,33 @@
+# Check the internal shell handling component of the ShTest format.
+#
+# RUN: not %{lit} -j 1 -v %{inputs}/shtest-shell > %t.out
+# RUN: FileCheck < %t.out %s
+#
+# END.
+
+# CHECK: -- Testing:
+
+# 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': command not found
+# CHECK: ***
+
+# FIXME: The output here sucks.
+#
+# CHECK: FAIL: shtest-shell :: error-1.txt
+# CHECK: *** TEST 'shtest-shell :: error-1.txt' FAILED ***
+# CHECK: shell parser error on: 'echo "missing quote'
+# CHECK: ***
+
+# CHECK: FAIL: shtest-shell :: error-2.txt
+# CHECK: *** TEST 'shtest-shell :: error-2.txt' FAILED ***
+# CHECK: Unsupported redirect:
+# CHECK: ***
+
+# CHECK: PASS: shtest-shell :: redirects.txt
+# CHECK: PASS: shtest-shell :: sequencing-0.txt
+# CHECK: XFAIL: shtest-shell :: sequencing-1.txt
+# CHECK: Failing Tests (3)





More information about the llvm-commits mailing list