diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-08-14 22:21:11 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-08-14 22:21:11 +0000 |
commit | 4fa59392684435c2196baf43c35c07fe8b348cae (patch) | |
tree | 51f44bcfbc0d13605c9e0759f10887ff79a1a2e1 /utils/lit | |
parent | 80a06baec266e901f58797c39ac78c9552036b9d (diff) | |
download | external_llvm-4fa59392684435c2196baf43c35c07fe8b348cae.zip external_llvm-4fa59392684435c2196baf43c35c07fe8b348cae.tar.gz external_llvm-4fa59392684435c2196baf43c35c07fe8b348cae.tar.bz2 |
[lit] Add test coverage of gtest format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rwxr-xr-x | utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest | 34 | ||||
-rw-r--r-- | utils/lit/tests/Inputs/googletest-format/lit.cfg | 3 | ||||
-rw-r--r-- | utils/lit/tests/googletest-format.py | 20 |
3 files changed, 57 insertions, 0 deletions
diff --git a/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest b/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest new file mode 100755 index 0000000..9dff137 --- /dev/null +++ b/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest @@ -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,)) diff --git a/utils/lit/tests/Inputs/googletest-format/lit.cfg b/utils/lit/tests/Inputs/googletest-format/lit.cfg new file mode 100644 index 0000000..f2f6cda --- /dev/null +++ b/utils/lit/tests/Inputs/googletest-format/lit.cfg @@ -0,0 +1,3 @@ +import lit.formats +config.name = 'googletest-format' +config.test_format = lit.formats.GoogleTest('DummySubDir', 'Test') diff --git a/utils/lit/tests/googletest-format.py b/utils/lit/tests/googletest-format.py new file mode 100644 index 0000000..a62fd1b --- /dev/null +++ b/utils/lit/tests/googletest-format.py @@ -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 + |