From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DD99C83F1B for ; Thu, 17 Jul 2025 08:49:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 393558D0008; Thu, 17 Jul 2025 04:49:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 343A18D0010; Thu, 17 Jul 2025 04:49:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BE5C8D0008; Thu, 17 Jul 2025 04:49:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id F05AE8D0010 for ; Thu, 17 Jul 2025 04:49:00 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B875A1A065F for ; Thu, 17 Jul 2025 08:49:00 +0000 (UTC) X-FDA: 83673131640.16.D66F78F Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf22.hostedemail.com (Postfix) with ESMTP id BFF10C0006 for ; Thu, 17 Jul 2025 08:48:58 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="z/e5YP3n"; dkim=pass header.d=linutronix.de header.s=2020e header.b=4K1YHeej; spf=pass (imf22.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752742139; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HTyGoXC0dVBZ4irV+U60qFcUCjn8ZNx4ePIDmwa7kkM=; b=mWjmytYyLmAXdKjtK/Qa4Z7+B5yUNxaHouXH0kmgZ42K55nfJo9mxvrXxTZMaAaUfDdwYe DI4yLx5+PDtUDrG+djg0uxGEWpSC8FusY67qxvDf8fcl6GePfYGt3aDlUZJdyLmch2Do7A YmAAIEqO5+ZUTVFA4GKCrOX1ZUIshZo= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="z/e5YP3n"; dkim=pass header.d=linutronix.de header.s=2020e header.b=4K1YHeej; spf=pass (imf22.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752742139; a=rsa-sha256; cv=none; b=p6HZmAHmJdgQGttP6t7mIbC+Ft7/IhyfQwbJSnzsGJBWI9r9DpL3++yOnFwhDEedAq9k4T R5MRdj0dJnMbBSXyhKa+fDTRiaOGmZeNk7dCwyNfMiKXVvjyvUL3Q+xTkU5nWdFGGsdCLV 1YmOV+zTJ6ZHOksGaG0tRlauiJ1/4AY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1752742137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HTyGoXC0dVBZ4irV+U60qFcUCjn8ZNx4ePIDmwa7kkM=; b=z/e5YP3n8sdJJ7RJkZzDUhlccH//pj4MtKZGk+xANNmnjfs+vd/s+FBnJXI98BTfum4KCe a2SORUf6JbPx6NKcw6ZOfVBpq0w0plfEe++rRrGTh12A6IoNhiitvmk154l70KvBjg9b1u 1u29HqekVdpVglHpzSO+PfNf+S33kqBPk87IEJ8svBMSll9tnis614+Y5XXu+qMet6V8H+ M9ryrxknJeK56Ag2ltYAgGyVREw4/b2++GEIWLGeUvQGzjsWwlgnKKYEHku+YKxocP3PeV xRKdcYAWVOZl/iGctW1PmDEL+gKBFDI2EXJhDkmx5PUqmUEU0lMla1on5krVJA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1752742137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HTyGoXC0dVBZ4irV+U60qFcUCjn8ZNx4ePIDmwa7kkM=; b=4K1YHeej61l1AWM6ROFp0S48a+vTZ12cgz/A6VIEwjhsX+AXWqQSFG4Tbnmz7Dx8om7DOk 49kXanApK5HN15DQ== Date: Thu, 17 Jul 2025 10:48:10 +0200 Subject: [PATCH v5 08/15] kunit: tool: Don't overwrite test status based on subtest counts MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20250717-kunit-kselftests-v5-8-442b711cde2e@linutronix.de> References: <20250717-kunit-kselftests-v5-0-442b711cde2e@linutronix.de> In-Reply-To: <20250717-kunit-kselftests-v5-0-442b711cde2e@linutronix.de> To: Masahiro Yamada , Nathan Chancellor , Andrew Morton , Willy Tarreau , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Brendan Higgins , David Gow , Rae Moar , Shuah Khan , Jonathan Corbet , Nicolas Schier , Kees Cook , Alexander Viro , Christian Brauner , Jan Kara , Christoph Hellwig , Luis Chamberlain Cc: Christophe Leroy , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, workflows@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Nicolas Schier X-Developer-Signature: v=1; a=ed25519-sha256; t=1752742130; l=2830; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=a/wJSYwyt34G89SNmJ3zmx0DFBABaWN8wJwhGB4qj6M=; b=tXs02f7ND1lQX/On+HUIDoFSH9res3NJSpIasrWk/3xCX1p1/YCA88ILiipewxL8ogZjRAXqs GyK9GF5hcoxA0mNtn0zx+aEe753J9xMt29ch1IS66MaLxZyLP3bUVp6 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= X-Stat-Signature: xzdcqm4stchsyqqb81ie8teutk6ohaeq X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: BFF10C0006 X-Rspam-User: X-HE-Tag: 1752742138-134291 X-HE-Meta: U2FsdGVkX19M7aQa4HiYLlCby6T10TSgbmyQSUuOtYfU8Nnlyr+HXn/Ox9r6W2fcZrKMDiHTJazCo7VmrjQPdbU6mavlBn8NBN9A/flXJHbsTLFM7u2ixxaUL4doWyoYX2TRwTbSygiUQMc2EaEBY29hL58pKX+Z9J2PBSm1+de8Pp7SjLI9pQGTNpQiViDhuOVRtJF20gdSIaWNCk+pPWzpF9+YSc7fbf5H5pSUiX9sRTeHd+KS9gGXKRcZai3EPOw8SdYP9c4jb4JmrPJT438skbuHhLW+Kjb77YCKdbHe1A4rDn8Q+3H5qxmFSA5nMHOjGf03ixxMrHespikHkpihnvyXOl/XjKyv8HE+LYv8ZKnkhmP91PXl/PDWrlb4axEs/KVqJhcYC0P7IOuYWQ6Osw+yMS0NjxhbFwJb37b78859sXYNMlZ8oYkGbNlQRP9b1HX6o4zpd9O5YfNMS9o2L1C1V7eOvfZVjZdhaXPn92omkcUAsYWZSuVn8OjWwBKHPP58czqiSLKfRMBUBZdkKuy0FKhJpAVVfidUZ+IX3a8e/yPLSXQwb+0+14VBC9p335Yg6SQpQ0abq87IziPnAQ8PM6hjahPtqzeK6Wjjh9pvQOU2I+naRDx6Dpr25KGcy7Iwov+dwFiibRwk5GokawEP8k6uNqiVx5ypt11Bq0PzsW7Dy16C4D+TTOI5pu569VBi3Wvf2m45rqt5c+iN0ym+Edpt2NrZLmFz2DtMacOFkTHz2V1gI7lSFHX3MZcmLCfKH90jURWU/GYyiNSJ14r/m/J1s8u3x+XPpn5uW+vg+ff0lOcd/+1SZBTEr3pTiyVALwV6KYMqNIodQSHZ1851C2G6zEKYHw209a0y8KIUWieI2hNC9kiMCsaKK3ksm/FXsSZ96XyjNWzP0nlhRB1ngZMO4nxrN58Pxx8QGCE3fqRo5LKqXV5J1m+HTRMaW0ciAPLGHkSNuWh jr6VPBSI 4TNAy7n1y7LO1ns/Mnbj9EPTOxgPucD3LD/UTihr5J3ELHCtVEpW5RQteTocnECyybueKVojCuskRfpvp9NpGMGKuFCee+zr4ntTmdqud5V7Wd/PKJfDfeidFdlr6fvFNH9ja2IF+fMUSMKfqOs8RWSYflfkCEFrev+IkLM7F+4sWmdyDpHyKX+JgRdmubZbZWH1U+RKcsaf+DKIrp2zUcQS92sXn2h5BXUE+2M1JQRqbOuU9NR0sqFS/ighdh4oN6FAXrZ5jrSkCWe8fI7WO/Bw9826GGRUpo7UsndW9PuYBt8+FU0sfk6TB4SqNzxKtUSVr5ZYhYTZ70DHgCUNkibqQB35BQ8AOQufNvhMenaXQaQaVzIPlLP8neCYpUH1IIN2OioOnSR6dgylEqNuZ1R6Ak1moHj66D0bFxVd8H5M7dnHmnXfWfDv7xZ52ohD9eqZuvoQBjSG3ULEMSjTRLr/w4CM7gyREfB/CNLlt0DPo0qPJJ1Dbr0Piyg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If a subtest itself reports success, but the outer testcase fails, the whole testcase should be reported as a failure. However the status is recalculated based on the test counts, overwriting the outer test result. Synthesize a failed test in this case to make sure the failure is not swallowed. Signed-off-by: Thomas Weißschuh Reviewed-by: David Gow --- tools/testing/kunit/kunit_parser.py | 3 +++ tools/testing/kunit/kunit_tool_test.py | 1 + tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log | 3 +++ 3 files changed, 7 insertions(+) diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py index c176487356e6c94882046b19ea696d750905b8d5..a7a61e627e348db14b953080ec8789994fba955a 100644 --- a/tools/testing/kunit/kunit_parser.py +++ b/tools/testing/kunit/kunit_parser.py @@ -687,6 +687,9 @@ def bubble_up_test_results(test: Test) -> None: elif test.counts.get_status() == TestStatus.TEST_CRASHED: test.status = TestStatus.TEST_CRASHED + if status == TestStatus.FAILURE and test.counts.get_status() == TestStatus.SUCCESS: + counts.add_status(status) + def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: bool, printer: Printer) -> Test: """ Finds next test to parse in LineStream, creates new Test object, diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index b74dc05fc2fe5b3ff629172fc7aafeb5c3d29fb3..d5bbcb95ab6abb1a8ee91439d87daaf29d159294 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -172,6 +172,7 @@ class KUnitParserTest(unittest.TestCase): self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) self.assertEqual(result.counts.failed, 2) self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[0].status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.subtests[0].subtests[0].status) self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].status) self.assertEqual(kunit_parser.TestStatus.FAILURE, result.subtests[1].subtests[0].status) diff --git a/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log b/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log index 2e528da39ab5b2be0fca6cf9160c10929fba3c9e..5498dfd0b0db24663e1a1e9bf78c587de6746522 100644 --- a/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log +++ b/tools/testing/kunit/test_data/test_is_test_passed-failure-nested.log @@ -1,5 +1,8 @@ KTAP version 1 1..2 + KTAP version 1 + 1..1 + ok 1 test 1 not ok 1 subtest 1 KTAP version 1 1..1 -- 2.50.0