aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-09-20 12:47:50 +0400
committerJussi Pakkanen <jpakkane@gmail.com>2019-09-23 13:28:11 -0400
commit6a12f3fc16cde79515ce38040421b1a6743bdbb1 (patch)
tree5738c5412c5a66136c22ec477ad56cd26c5a55e1
parent6b0c711c912578372f9dcf53c9301fb9f3b167ea (diff)
downloadmeson-6a12f3fc16cde79515ce38040421b1a6743bdbb1.zip
meson-6a12f3fc16cde79515ce38040421b1a6743bdbb1.tar.gz
meson-6a12f3fc16cde79515ce38040421b1a6743bdbb1.tar.bz2
mtest: TAP: ignore empty lines
According to http://testanything.org/tap-specification.html "Any output line that is not a version, a plan, a test line, a diagnostic or a bail out is considered an “unknown” line. A TAP parser is required to not consider an unknown line as an error but may optionally choose to capture said line and hand it to the test harness, which may have custom behavior attached [...] TAP::Harness reports TAP syntax errors at the end of a test run". (glib gtest can generate empty lines)
-rw-r--r--mesonbuild/mtest.py3
-rwxr-xr-xrun_unittests.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 70585f4..e9bdefd 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -299,6 +299,9 @@ class TAPParser:
yield self.Version(version=version)
continue
+ if len(line) == 0:
+ continue
+
yield self.Error('unexpected input at line %d' % (lineno,))
if state == self._YAML:
diff --git a/run_unittests.py b/run_unittests.py
index 17ae45e..7c79fa3 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -6730,6 +6730,12 @@ class TAPParserTests(unittest.TestCase):
self.assert_plan(events, count=1, late=True)
self.assert_last(events)
+ def test_empty_line(self):
+ events = self.parse_tap('1..1\n\nok 1')
+ self.assert_plan(events, count=1, late=False)
+ self.assert_test(events, number=1, name='', result=TestResult.OK)
+ self.assert_last(events)
+
def test_unexpected(self):
events = self.parse_tap('1..1\ninvalid\nok 1')
self.assert_plan(events, count=1, late=False)