[llvm] r188417 - [lit] Add test coverage of gtest format.
Daniel Dunbar
daniel at zuster.org
Wed Aug 14 15:21:11 PDT 2013
Author: ddunbar
Date: Wed Aug 14 17:21:11 2013
New Revision: 188417
URL: http://llvm.org/viewvc/llvm-project?rev=188417&view=rev
Log:
[lit] Add test coverage of gtest format.
Added:
llvm/trunk/utils/lit/tests/Inputs/googletest-format/
llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/
llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest (with props)
llvm/trunk/utils/lit/tests/Inputs/googletest-format/lit.cfg
llvm/trunk/utils/lit/tests/googletest-format.py
Added: llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest?rev=188417&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest (added)
+++ llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest Wed Aug 14 17:21:11 2013
@@ -0,0 +1,34 @@
+#!/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("""\
+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]
+if test_name == 'FirstTest.subTestA':
+ print('I am subTest A, I PASS')
+ 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')
+ sys.exit(0)
+else:
+ raise SystemExit("error: invalid test name: %r" % (test_name,))
Propchange: llvm/trunk/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest
------------------------------------------------------------------------------
svn:executable = *
Added: llvm/trunk/utils/lit/tests/Inputs/googletest-format/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/googletest-format/lit.cfg?rev=188417&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/googletest-format/lit.cfg (added)
+++ llvm/trunk/utils/lit/tests/Inputs/googletest-format/lit.cfg Wed Aug 14 17:21:11 2013
@@ -0,0 +1,3 @@
+import lit.formats
+config.name = 'googletest-format'
+config.test_format = lit.formats.GoogleTest('DummySubDir', 'Test')
Added: llvm/trunk/utils/lit/tests/googletest-format.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/googletest-format.py?rev=188417&view=auto
==============================================================================
--- llvm/trunk/utils/lit/tests/googletest-format.py (added)
+++ llvm/trunk/utils/lit/tests/googletest-format.py Wed Aug 14 17:21:11 2013
@@ -0,0 +1,20 @@
+# Check the various features of the GoogleTest format.
+#
+# RUN: not %{lit} -j 1 -v %{inputs}/googletest-format > %t.out
+# RUN: FileCheck < %t.out %s
+#
+# END.
+
+# CHECK: -- Testing:
+# CHECK: PASS: googletest-format :: DummySubDir/OneTest/FirstTest.subTestA
+# CHECK: FAIL: googletest-format :: DummySubDir/OneTest/FirstTest.subTestB
+# CHECK-NEXT: *** TEST 'googletest-format :: DummySubDir/OneTest/FirstTest.subTestB' FAILED ***
+# CHECK-NEXT: I am subTest B, I FAIL
+# CHECK-NEXT: And I have two lines of output
+# CHECK: ***
+# CHECK: PASS: googletest-format :: DummySubDir/OneTest/ParameterizedTest/0.subTest
+# CHECK: PASS: googletest-format :: DummySubDir/OneTest/ParameterizedTest/1.subTest
+# CHECK: Failing Tests (1)
+# CHECK: Expected Passes : 3
+# CHECK: Unexpected Failures: 1
+
More information about the llvm-commits
mailing list