Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3971790pxb; Tue, 25 Jan 2022 00:19:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsmJGKMiM94tndH3DNXMhAacNxMN14jVp/Y8t9iT86sgPUX1Ps0HItLHllOrhzN+lpxhzu X-Received: by 2002:a05:6402:51d3:: with SMTP id r19mr1216199edd.116.1643098753795; Tue, 25 Jan 2022 00:19:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643098753; cv=none; d=google.com; s=arc-20160816; b=hv69AF7Db8OvTkhooC5C2ujHCos9iPbN5cYB9lYXSypODP64O7U8C1rFH8Lc2DOH/M 7YBOCbh5x786kfidYErclQFjFkzRCK365EG9A3ARULqaHzIGr5uuP4qrBg2tG7noxzsj d1Tr3NHvmOJxL4OOa+Kdx9j4sz4AqDyuf3kvX/vCCg0vEbu+hbR5yWFYRb1L6ORB826I h2tJGlR3ySzxkCx7101V5c049gwJgD+chRoNiCknXq0GFqqE0LfTM6UjBGKl9cPDiINZ lURNButFTAx329fLB96TnRTl7lexMZGbmOTKjlbxZNyN/Aa3D5ZUH/rCnkU1PPgrL90D ddnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0F4iemKEVjfZDAFDn1bpKG8uTuxGJWcsieg7/GdoK84=; b=DV+UKcnJ122BN0NoYtZCZo7JLfo+43yEdzkDefjAitoZTjym7q/iQ9agmnI5pMa3RN Qx/vyg7neSMGnTKeIXQaBXdK1LcPz6InGYOI/NlvZWdoXdOPuBqiHcoEi4HFkIDJ+wtA JmWvrqmt66dEiDw6WV/AvrFKd+DDBR+1OXxqAkoQJb+LgFcaVvx44yVN6ZB8gITct0en Bihk6ME5xzlTGTZBNmW9olOyoRyqm7GbO2J+d8Dz3RvdHCE+M7Ts0qZyqbqCMuTbr/vL E8lKIWFpUPzWTsodf7poiXti48IHlQGjrwkXmmiVysIOqEqmZ7/Fy0+PC6kyCbSZmnQT vlRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rslqiSlF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o21si4724298edc.423.2022.01.25.00.18.48; Tue, 25 Jan 2022 00:19:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rslqiSlF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3413150AbiAYAia (ORCPT + 99 others); Mon, 24 Jan 2022 19:38:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59470 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444318AbiAXVG7 (ORCPT ); Mon, 24 Jan 2022 16:06:59 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC29061451; Mon, 24 Jan 2022 21:06:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AB5C340E5; Mon, 24 Jan 2022 21:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058417; bh=aJ5YBxeO/4QRHT8rngDaLNVmp8PG20YzWHTts758vWY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rslqiSlF3EKnu4qdJkIu3l5J51yFtfNPjEtbrzwV9Hhl3zifJ5GN8vjYpIUxrIveO ENH6GYsThmlkg9LOA3Snc9YMeDw8vC8i0hpThdyHpBS1lEo6qBDwQ/EKT8ao7EYOrn wWj2J2w/XqsdEl8suObpbhZxkXI7POqny9QVrYew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Latypov , David Gow , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0282/1039] kunit: tool: fix --json output for skipped tests Date: Mon, 24 Jan 2022 19:34:31 +0100 Message-Id: <20220124184134.768342225@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Latypov [ Upstream commit 9a6bb30a8830bb868b09629f0b9ad5d2b5fbb2f9 ] Currently, KUnit will report SKIPPED tests as having failed if one uses --json. Add the missing if statement to set the appropriate status ("SKIP"). See https://api.kernelci.org/schema-test-case.html: "status": { "type": "string", "description": "The status of the execution of this test case", "enum": ["PASS", "FAIL", "SKIP", "ERROR"], "default": "PASS" }, with this, we now can properly produce all four of the statuses. Fixes: 5acaf6031f53 ("kunit: tool: Support skipped tests in kunit_tool") Signed-off-by: Daniel Latypov Reviewed-by: David Gow Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/kunit/kunit_json.py | 2 ++ tools/testing/kunit/kunit_tool_test.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/tools/testing/kunit/kunit_json.py b/tools/testing/kunit/kunit_json.py index 746bec72b9ac2..b6e66c5d64d14 100644 --- a/tools/testing/kunit/kunit_json.py +++ b/tools/testing/kunit/kunit_json.py @@ -30,6 +30,8 @@ def _get_group_json(test: Test, def_config: str, test_case = {"name": subtest.name, "status": "FAIL"} if subtest.status == TestStatus.SUCCESS: test_case["status"] = "PASS" + elif subtest.status == TestStatus.SKIPPED: + test_case["status"] = "SKIP" elif subtest.status == TestStatus.TEST_CRASHED: test_case["status"] = "ERROR" test_cases.append(test_case) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 9c41267314573..34cb0a12ba180 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -383,6 +383,12 @@ class KUnitJsonTest(unittest.TestCase): {'name': 'example_simple_test', 'status': 'ERROR'}, result["sub_groups"][1]["test_cases"][0]) + def test_skipped_test_json(self): + result = self._json_for('test_skip_tests.log') + self.assertEqual( + {'name': 'example_skip_test', 'status': 'SKIP'}, + result["sub_groups"][1]["test_cases"][1]) + def test_no_tests_json(self): result = self._json_for('test_is_test_passed-no_tests_run_with_header.log') self.assertEqual(0, len(result['sub_groups'])) -- 2.34.1