From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36A2E1BDDE; Tue, 16 Jan 2024 00:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oOWN7/p3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34404C433F1; Tue, 16 Jan 2024 00:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705364009; bh=cW6hRmn+otuIyGPQpwcj9sDrhpCGcPW/qnKNPUk62jo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oOWN7/p3C4se8tZakIu2Ft8I8kBUM7Ize+UmashCb/lHR+ZogfsRFlj7B8gRfxx8u L39098bIKxnV+PWCfjJ6UGuZeAluLYylQVNwVtRHtukSzZmLtIHmKuBKNY0HNyNssA vIVMdeQGNFfjw1LTMHTRsGSGcjNvKbEI2YWXq76gVOJpPAJk+YXJi5LN4Mtq1kowaA FpY1dtkP4ymvB1Ljj0l0O2Y2zXEC0KG7DBZ/rAJ5AYZBlNZlC+zAPJIOOKspQ+BtvE aWluX8KeNulTvLfAz+oEUtn/p1n2B1l79jdGFzhtIN7piLP004GUnzb2ZhcU0gQjm5 +sQFGZOe5snIA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rae Moar , David Gow , Shuah Khan , Sasha Levin , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Subject: [PATCH AUTOSEL 6.7 12/18] kunit: tool: fix parsing of test attributes Date: Mon, 15 Jan 2024 19:12:54 -0500 Message-ID: <20240116001308.212917-12-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116001308.212917-1-sashal@kernel.org> References: <20240116001308.212917-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7 Content-Transfer-Encoding: 8bit From: Rae Moar [ Upstream commit 8ae27bc7fff4ef467a7964821a6cedb34a05d3b2 ] Add parsing of attributes as diagnostic data. Fixes issue with test plan being parsed incorrectly as diagnostic data when located after suite-level attributes. Note that if there does not exist a test plan line, the diagnostic lines between the suite header and the first result will be saved in the suite log rather than the first test case log. Signed-off-by: Rae Moar Reviewed-by: David Gow Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/kunit/kunit_parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py index 79d8832c862a..ce34be15c929 100644 --- a/tools/testing/kunit/kunit_parser.py +++ b/tools/testing/kunit/kunit_parser.py @@ -450,7 +450,7 @@ def parse_diagnostic(lines: LineStream) -> List[str]: Log of diagnostic lines """ log = [] # type: List[str] - non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START] + non_diagnostic_lines = [TEST_RESULT, TEST_HEADER, KTAP_START, TAP_START, TEST_PLAN] while lines and not any(re.match(lines.peek()) for re in non_diagnostic_lines): log.append(lines.pop()) @@ -726,6 +726,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: # test plan test.name = "main" ktap_line = parse_ktap_header(lines, test) + test.log.extend(parse_diagnostic(lines)) parse_test_plan(lines, test) parent_test = True else: @@ -737,6 +738,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: if parent_test: # If KTAP version line and/or subtest header is found, attempt # to parse test plan and print test header + test.log.extend(parse_diagnostic(lines)) parse_test_plan(lines, test) print_test_header(test) expected_count = test.expected_count -- 2.43.0