summaryrefslogtreecommitdiff
path: root/utils/lit/tests
diff options
context:
space:
mode:
Diffstat (limited to 'utils/lit/tests')
-rwxr-xr-xutils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest38
-rw-r--r--utils/lit/tests/Inputs/googletest-upstream-format/lit.cfg3
-rw-r--r--utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt2
-rw-r--r--utils/lit/tests/Inputs/shtest-format/requires-any-present.txt2
-rw-r--r--utils/lit/tests/Inputs/shtest-output-printing/basic.txt3
-rw-r--r--utils/lit/tests/Inputs/shtest-output-printing/lit.cfg4
-rw-r--r--utils/lit/tests/googletest-upstream-format.py20
-rw-r--r--utils/lit/tests/shtest-format.py11
-rw-r--r--utils/lit/tests/shtest-output-printing.py28
-rw-r--r--utils/lit/tests/shtest-shell.py8
10 files changed, 110 insertions, 9 deletions
diff --git a/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest b/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest
new file mode 100755
index 0000000000000..d7bc5968f2611
--- /dev/null
+++ b/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import sys
+
+if len(sys.argv) != 2:
+ raise ValueError("unexpected number of args")
+
+if sys.argv[1] == "--gtest_list_tests":
+ print("""\
+Running main() from gtest_main.cc
+FirstTest.
+ subTestA
+ subTestB
+ParameterizedTest/0.
+ subTest
+ParameterizedTest/1.
+ subTest""")
+ sys.exit(0)
+elif not sys.argv[1].startswith("--gtest_filter="):
+ raise ValueError("unexpected argument: %r" % (sys.argv[1]))
+
+test_name = sys.argv[1].split('=',1)[1]
+print('Running main() from gtest_main.cc')
+if test_name == 'FirstTest.subTestA':
+ print('I am subTest A, I PASS')
+ print('[ PASSED ] 1 test.')
+ sys.exit(0)
+elif test_name == 'FirstTest.subTestB':
+ print('I am subTest B, I FAIL')
+ print('And I have two lines of output')
+ sys.exit(1)
+elif test_name in ('ParameterizedTest/0.subTest',
+ 'ParameterizedTest/1.subTest'):
+ print('I am a parameterized test, I also PASS')
+ print('[ PASSED ] 1 test.')
+ sys.exit(0)
+else:
+ raise SystemExit("error: invalid test name: %r" % (test_name,))
diff --git a/utils/lit/tests/Inputs/googletest-upstream-format/lit.cfg b/utils/lit/tests/Inputs/googletest-upstream-format/lit.cfg
new file mode 100644
index 0000000000000..9fb5d2b0247be
--- /dev/null
+++ b/utils/lit/tests/Inputs/googletest-upstream-format/lit.cfg
@@ -0,0 +1,3 @@
+import lit.formats
+config.name = 'googletest-upstream-format'
+config.test_format = lit.formats.GoogleTest('DummySubDir', 'Test')
diff --git a/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt b/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
new file mode 100644
index 0000000000000..c977ee90c9e55
--- /dev/null
+++ b/utils/lit/tests/Inputs/shtest-format/requires-any-missing.txt
@@ -0,0 +1,2 @@
+RUN: true
+REQUIRES-ANY: a-missing-feature, a-missing-feature-2
diff --git a/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt b/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
new file mode 100644
index 0000000000000..f3be518b25827
--- /dev/null
+++ b/utils/lit/tests/Inputs/shtest-format/requires-any-present.txt
@@ -0,0 +1,2 @@
+RUN: true
+REQUIRES-ANY: a-missing-feature, a-present-feature
diff --git a/utils/lit/tests/Inputs/shtest-output-printing/basic.txt b/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
new file mode 100644
index 0000000000000..4899c7e63db45
--- /dev/null
+++ b/utils/lit/tests/Inputs/shtest-output-printing/basic.txt
@@ -0,0 +1,3 @@
+# RUN: true
+# RUN: echo hi
+# RUN: wc missing-file &> %t.out
diff --git a/utils/lit/tests/Inputs/shtest-output-printing/lit.cfg b/utils/lit/tests/Inputs/shtest-output-printing/lit.cfg
new file mode 100644
index 0000000000000..4fe698d73368e
--- /dev/null
+++ b/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/utils/lit/tests/googletest-upstream-format.py b/utils/lit/tests/googletest-upstream-format.py
new file mode 100644
index 0000000000000..1fc7c7c4a5ad2
--- /dev/null
+++ b/utils/lit/tests/googletest-upstream-format.py
@@ -0,0 +1,20 @@
+# Check the various features of the GoogleTest format.
+#
+# RUN: not %{lit} -j 1 -v %{inputs}/googletest-upstream-format > %t.out
+# RUN: FileCheck < %t.out %s
+#
+# END.
+
+# CHECK: -- Testing:
+# CHECK: PASS: googletest-upstream-format :: DummySubDir/OneTest/FirstTest.subTestA
+# CHECK: FAIL: googletest-upstream-format :: DummySubDir/OneTest/FirstTest.subTestB
+# CHECK-NEXT: *** TEST 'googletest-upstream-format :: DummySubDir/OneTest/FirstTest.subTestB' FAILED ***
+# CHECK-NEXT: Running main() from gtest_main.cc
+# CHECK-NEXT: I am subTest B, I FAIL
+# CHECK-NEXT: And I have two lines of output
+# CHECK: ***
+# CHECK: PASS: googletest-upstream-format :: DummySubDir/OneTest/ParameterizedTest/0.subTest
+# CHECK: PASS: googletest-upstream-format :: DummySubDir/OneTest/ParameterizedTest/1.subTest
+# CHECK: Failing Tests (1)
+# CHECK: Expected Passes : 3
+# CHECK: Unexpected Failures: 1
diff --git a/utils/lit/tests/shtest-format.py b/utils/lit/tests/shtest-format.py
index 751f0d7080306..20884f8c4854d 100644
--- a/utils/lit/tests/shtest-format.py
+++ b/utils/lit/tests/shtest-format.py
@@ -39,14 +39,15 @@
#
# 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
# CHECK: UNRESOLVED: shtest-format :: no-test-line.txt
# CHECK: PASS: shtest-format :: pass.txt
+# CHECK: UNSUPPORTED: shtest-format :: requires-any-missing.txt
+# CHECK: PASS: shtest-format :: requires-any-present.txt
# CHECK: UNSUPPORTED: shtest-format :: requires-missing.txt
# CHECK: PASS: shtest-format :: requires-present.txt
# CHECK: UNSUPPORTED: shtest-format :: unsupported_dir/some-test.txt
@@ -69,9 +70,9 @@
# CHECK: shtest-format :: external_shell/fail_with_bad_encoding.txt
# CHECK: shtest-format :: fail.txt
-# CHECK: Expected Passes : 4
+# CHECK: Expected Passes : 5
# CHECK: Expected Failures : 3
-# CHECK: Unsupported Tests : 2
+# CHECK: Unsupported Tests : 3
# CHECK: Unresolved Tests : 1
# CHECK: Unexpected Passes : 1
# CHECK: Unexpected Failures: 3
diff --git a/utils/lit/tests/shtest-output-printing.py b/utils/lit/tests/shtest-output-printing.py
new file mode 100644
index 0000000000000..24580b37f1f54
--- /dev/null
+++ b/utils/lit/tests/shtest-output-printing.py
@@ -0,0 +1,28 @@
+# Check the various features of the ShTest format.
+#
+# RUN: not %{lit} -j 1 -v %{inputs}/shtest-output-printing > %t.out
+# RUN: FileCheck --input-file %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: $ "wc" "missing-file"
+# CHECK-NEXT: # redirected output from '{{.*}}/basic.txt.tmp.out':
+# CHECK-NEXT: missing-file{{.*}} No such file or directory
+# CHECK: note: command had no output on stdout or stderr
+# CHECK-NEXT: error: command failed with exit status: 1
diff --git a/utils/lit/tests/shtest-shell.py b/utils/lit/tests/shtest-shell.py
index 32479e19a1026..18b80cd7d0877 100644
--- a/utils/lit/tests/shtest-shell.py
+++ b/utils/lit/tests/shtest-shell.py
@@ -1,7 +1,7 @@
# 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
+# RUN: FileCheck --input-file %t.out %s
#
# END.
@@ -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.