public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rae Moar <rmoar@google.com>
To: shuah@kernel.org, davidgow@google.com
Cc: jackmanb@google.com, linux-kselftest@vger.kernel.org,
	 kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org,
	 Rae Moar <rmoar@google.com>
Subject: [PATCH v3 2/2] kunit: tool: add test to check parsing late test plan
Date: Thu, 13 Mar 2025 19:27:14 +0000	[thread overview]
Message-ID: <20250313192714.1380005-2-rmoar@google.com> (raw)
In-Reply-To: <20250313192714.1380005-1-rmoar@google.com>

Add test to check for the infinite loop caused by the inability
to parse a late test plan.

The test parses the following output:
 TAP version 13
 ok 4 test4
 1..4

Signed-off-by: Rae Moar <rmoar@google.com>
---
Changes since v2:
- Adds this patch to add a test for this behavior

 tools/testing/kunit/kunit_tool_test.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py
index 0bcb0cc002f8..5ff4f6ffd873 100755
--- a/tools/testing/kunit/kunit_tool_test.py
+++ b/tools/testing/kunit/kunit_tool_test.py
@@ -363,6 +363,17 @@ class KUnitParserTest(unittest.TestCase):
 		self.print_mock.assert_any_call(StrContains('  Indented more.'))
 		self.noPrintCallContains('not ok 1 test1')
 
+	def test_parse_late_test_plan(self):
+		output = """
+		TAP version 13
+		ok 4 test4
+		1..4
+		"""
+		result = kunit_parser.parse_run_tests(output.splitlines(), stdout)
+		# Missing test results after test plan should alert a suspected test crash.
+		self.assertEqual(kunit_parser.TestStatus.TEST_CRASHED, result.status)
+		self.assertEqual(result.counts, kunit_parser.TestCounts(passed=1, crashed=1, errors=1))
+
 def line_stream_from_strs(strs: Iterable[str]) -> kunit_parser.LineStream:
 	return kunit_parser.LineStream(enumerate(strs, start=1))
 
-- 
2.49.0.rc1.451.g8f38331e32-goog


  reply	other threads:[~2025-03-13 19:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 19:27 [PATCH v3 1/2] kunit: tool: Fix bug in parsing test plan Rae Moar
2025-03-13 19:27 ` Rae Moar [this message]
2025-03-14  5:37   ` [PATCH v3 2/2] kunit: tool: add test to check parsing late " David Gow
2025-03-14  5:37 ` [PATCH v3 1/2] kunit: tool: Fix bug in parsing " David Gow
2025-03-17 16:13   ` Brendan Jackman
2025-03-19 21:11     ` Rae Moar
2025-03-20 10:07       ` Brendan Jackman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250313192714.1380005-2-rmoar@google.com \
    --to=rmoar@google.com \
    --cc=davidgow@google.com \
    --cc=jackmanb@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox