From patchwork Thu Nov 3 17:47:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Latypov X-Patchwork-Id: 621916 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E226C4332F for ; Thu, 3 Nov 2022 17:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230410AbiKCRsj (ORCPT ); Thu, 3 Nov 2022 13:48:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231908AbiKCRsT (ORCPT ); Thu, 3 Nov 2022 13:48:19 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 882B21D30B for ; Thu, 3 Nov 2022 10:47:48 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id n4-20020a17090a2fc400b002132adb9485so1266260pjm.0 for ; Thu, 03 Nov 2022 10:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=x5UDPV/B3DbeeLLd5UNbXGu4AbVddR846UKz8icVwAg=; b=ARL1Z+nO3QvcQjmNyeaET5LfZwzcYuge5A11iFR6e70VYgXXlHx0UmBGpYP+zmGc6G q9yFicoNpr1w5MlK6VCq3mcp7j7kvFdNBKYDrty3rK5Hnaj+v+lSK8WQDBmnkhyRA1LW sg4hbNrm7x+kJUaUyva3scLdS7rV6Vs9Q18AYTOYF2p9NTo8oE9y8xjMECrv1eR9fHo7 k4WAemX/5vei32E7ZnfyM+v2Kyatx8MOsT9Mxsk6Y+wbWIK+ItpVhSmafBOwCv4rrRV8 U4qyVaL/hEuq5tQj3ALAv4vAopBQ/kq9AyRbPEijppOJ/N1Xc8x3Wj13MP9SOGCtFzu7 Ztww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=x5UDPV/B3DbeeLLd5UNbXGu4AbVddR846UKz8icVwAg=; b=Dg9f2JPyqNKgTj9QImEet4VG/+EGB8OSEhIZI4x02VebdcVpPBeGRA4JDP9h2hKzeR FU3QLruRcrxeJWWGKlSXysQQDD+StW3LJQv5WmVRfFLkG6te65UZ1Guki/ZcCwiPose8 WfVcXm8LFVxJjpNu6po1pBW1MC6vfMwpSZwD5GRXOwMJMs6kpO/kMq1qcxwU4BBf923w +5Y2kgpV37CRIrU/TWKva/LmLlYs00ARqKoV26IINqarWUIL680rJ0HoKZjfe01q4LFw Sl4y2Fk8A5BkZmlB61o7S6YB5DRN75JUIWi3Xmp0mfw3qN5RDsc6bhbzEiqk96ZW3P/B 9RGQ== X-Gm-Message-State: ACrzQf0ust5HwGFMErsRV4IRfZNLvutvQHf3NJ/ArNfONBOv0jeCw6D2 Wq4NXWscorbgly5Gn5JTc2xgedIuVpXUZg== X-Google-Smtp-Source: AMsMyM4oTyeetb2fHUi/IMTtVZJbETiXu+iiifYy2OyaOkeY2IKWBmMNsJS3S8pcU87mpdisnUTHwNVbGpHEGw== X-Received: from dlatypov-spec.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3f35]) (user=dlatypov job=sendgmr) by 2002:a17:902:c949:b0:187:2be9:9f0a with SMTP id i9-20020a170902c94900b001872be99f0amr18975485pla.58.1667497668055; Thu, 03 Nov 2022 10:47:48 -0700 (PDT) Date: Thu, 3 Nov 2022 10:47:38 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221103174740.3492603-1-dlatypov@google.com> Subject: [PATCH v2 1/3] kunit: tool: make TestCounts a dataclass From: Daniel Latypov To: brendanhiggins@google.com, davidgow@google.com Cc: rmoar@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, Daniel Latypov Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Since we're using Python 3.7+, we can use dataclasses to tersen the code. It also lets us create pre-populated TestCounts() objects and compare them in our unit test. (Before, you could only create empty ones). Signed-off-by: Daniel Latypov Reviewed-by: David Gow --- v1 -> v2: just rebased onto linux-kselftest/kunit --- tools/testing/kunit/kunit_parser.py | 25 ++++++++----------------- tools/testing/kunit/kunit_tool_test.py | 4 +--- 2 files changed, 9 insertions(+), 20 deletions(-) base-commit: 29ad37f740d302d0f27374edaf85fe8978e45ba9 diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py index 94dba66feec5..a56c75a973b5 100644 --- a/tools/testing/kunit/kunit_parser.py +++ b/tools/testing/kunit/kunit_parser.py @@ -10,6 +10,7 @@ # Author: Rae Moar from __future__ import annotations +from dataclasses import dataclass import re import sys @@ -71,27 +72,17 @@ class TestStatus(Enum): NO_TESTS = auto() FAILURE_TO_PARSE_TESTS = auto() +@dataclass class TestCounts: """ Tracks the counts of statuses of all test cases and any errors within a Test. - - Attributes: - passed : int - the number of tests that have passed - failed : int - the number of tests that have failed - crashed : int - the number of tests that have crashed - skipped : int - the number of tests that have skipped - errors : int - the number of errors in the test and subtests - """ - def __init__(self): - """Creates TestCounts object with counts of all test - statuses and test errors set to 0. - """ - self.passed = 0 - self.failed = 0 - self.crashed = 0 - self.skipped = 0 - self.errors = 0 + """ + passed: int = 0 + failed: int = 0 + crashed: int = 0 + skipped: int = 0 + errors: int = 0 def __str__(self) -> str: """Returns the string representation of a TestCounts object.""" diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 7dcd67003b23..440a273f1d21 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -182,9 +182,7 @@ class KUnitParserTest(unittest.TestCase): kunit_parser.extract_tap_lines( file.readlines())) # A missing test plan is not an error. - self.assertEqual(0, result.counts.errors) - # All tests should be accounted for. - self.assertEqual(10, result.counts.total()) + self.assertEqual(result.counts, kunit_parser.TestCounts(passed=10, errors=0)) self.assertEqual( kunit_parser.TestStatus.SUCCESS, result.status) From patchwork Thu Nov 3 17:47:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Latypov X-Patchwork-Id: 621212 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D3C0C43217 for ; Thu, 3 Nov 2022 17:48:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbiKCRsm (ORCPT ); Thu, 3 Nov 2022 13:48:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbiKCRsU (ORCPT ); Thu, 3 Nov 2022 13:48:20 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F1891DDFD for ; Thu, 3 Nov 2022 10:47:50 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-36fde8f2cdcso24389837b3.23 for ; Thu, 03 Nov 2022 10:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=G4ZrAJks1xCoReobX1BLqMTv0anHxr6wjkZyjGEJdoM=; b=D/rXDwXMVuPgZlmiV3KxtME9c8EgCpstnqaN5WvmpVop8rbBVufyXInZIdkI3owvem ElnOm+L7ja7qvqZEduaW4vqnDk4ZEkSxjEFnWjKlMkFJItbrbqxJYItOkOEfEqVxeJtF +xG9zEI8S1nVdSf7DpZEpNrkai9XyZXiWgicBTcKLU46k4GemjWjCHS+2soidZWc4W4T EAaAfg96I3mwS2I4854xJaQM1VWLSn3O7ZvtwXpfV39hcwS22D+B9vXez43FvyN//7dX wM1ECFNx82uoS4NUEJKAKvv5gSp0hwvJO5AlmM39LMoW4JKS27iIicdqZ14bZPqQXz0f XBEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G4ZrAJks1xCoReobX1BLqMTv0anHxr6wjkZyjGEJdoM=; b=yy4fG0LcPSHu11XOXY+OlIHqMyUGs082dsbQx8NysvAeVkfCllcyi2FRt/ZL0AmSY9 +Pl7WlZp8WjlBQfynDnl9UzmxR+NO+GAjZ0yWzZJVEl1is2JV8H6LVbIVZuAaaH162a3 wHpbNw0fmPC81vpoTjXE3HrVFIVqRTelw4Ztt2fa2iKW16kooG5929vI0d5H7QQO9IAg FXgZI43HrZ6Y+uZdqZGoTj/VOlcATfa5HOrSoSfThSFWRRVd3efU7EieMwnow8+NghW1 3X+LKxiSYsG5Q2POvAdfpYwS2c3o46sLlp0jtl4LDBmIDbTY7zQ0la4eWb/z1MhkdSzL h0+g== X-Gm-Message-State: ACrzQf34rH5124D6q+UGXoOX7J967vH5xSAYtzbJbUWn2fuoLrLxmWOL Xsv3eL4Ue1igDw/vOwhS2OevhAd73C7kvg== X-Google-Smtp-Source: AMsMyM5eYGwBb2lOBv3WauL41kMicLHsighp2bPkzDEF5Qw73X74uIZgo2pbNUn6cByzLUOJKG31slBGCK+GKw== X-Received: from dlatypov-spec.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3f35]) (user=dlatypov job=sendgmr) by 2002:a5b:c42:0:b0:6d0:efa4:d136 with SMTP id d2-20020a5b0c42000000b006d0efa4d136mr1ybr.463.1667497669503; Thu, 03 Nov 2022 10:47:49 -0700 (PDT) Date: Thu, 3 Nov 2022 10:47:39 -0700 In-Reply-To: <20221103174740.3492603-1-dlatypov@google.com> Mime-Version: 1.0 References: <20221103174740.3492603-1-dlatypov@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221103174740.3492603-2-dlatypov@google.com> Subject: [PATCH v2 2/3] kunit: tool: unit tests all check parser errors, standardize formatting a bit From: Daniel Latypov To: brendanhiggins@google.com, davidgow@google.com Cc: rmoar@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, Daniel Latypov Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Let's verify that the parser isn't reporting any errors for valid inputs. This change also * does result.status checking on one line * makes sure we consistently do it outside of the `with` block Signed-off-by: Daniel Latypov Reviewed-by: David Gow --- v1 -> v2: just rebased onto linux-kselftest/kunit --- tools/testing/kunit/kunit_tool_test.py | 93 +++++++++++--------------- 1 file changed, 38 insertions(+), 55 deletions(-) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 440a273f1d21..5e3429a1202b 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -136,33 +136,29 @@ class KUnitParserTest(unittest.TestCase): all_passed_log = test_data_path('test_is_test_passed-all_passed.log') with open(all_passed_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual(result.counts.errors, 0) def test_parse_successful_nested_tests_log(self): all_passed_log = test_data_path('test_is_test_passed-all_passed_nested.log') with open(all_passed_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual(result.counts.errors, 0) def test_kselftest_nested(self): kselftest_log = test_data_path('test_is_test_passed-kselftest.log') with open(kselftest_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual(result.counts.errors, 0) def test_parse_failed_test_log(self): failed_log = test_data_path('test_is_test_passed-failure.log') with open(failed_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.FAILURE, - result.status) + self.assertEqual(kunit_parser.TestStatus.FAILURE, result.status) + self.assertEqual(result.counts.errors, 0) def test_no_header(self): empty_log = test_data_path('test_is_test_passed-no_tests_run_no_header.log') @@ -170,9 +166,8 @@ class KUnitParserTest(unittest.TestCase): result = kunit_parser.parse_run_tests( kunit_parser.extract_tap_lines(file.readlines())) self.assertEqual(0, len(result.subtests)) - self.assertEqual( - kunit_parser.TestStatus.FAILURE_TO_PARSE_TESTS, - result.status) + self.assertEqual(kunit_parser.TestStatus.FAILURE_TO_PARSE_TESTS, result.status) + self.assertEqual(result.counts.errors, 1) def test_missing_test_plan(self): missing_plan_log = test_data_path('test_is_test_passed-' @@ -183,9 +178,7 @@ class KUnitParserTest(unittest.TestCase): file.readlines())) # A missing test plan is not an error. self.assertEqual(result.counts, kunit_parser.TestCounts(passed=10, errors=0)) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) def test_no_tests(self): header_log = test_data_path('test_is_test_passed-no_tests_run_with_header.log') @@ -193,9 +186,8 @@ class KUnitParserTest(unittest.TestCase): result = kunit_parser.parse_run_tests( kunit_parser.extract_tap_lines(file.readlines())) self.assertEqual(0, len(result.subtests)) - self.assertEqual( - kunit_parser.TestStatus.NO_TESTS, - result.status) + self.assertEqual(kunit_parser.TestStatus.NO_TESTS, result.status) + self.assertEqual(result.counts.errors, 1) def test_no_tests_no_plan(self): no_plan_log = test_data_path('test_is_test_passed-no_tests_no_plan.log') @@ -206,7 +198,7 @@ class KUnitParserTest(unittest.TestCase): self.assertEqual( kunit_parser.TestStatus.NO_TESTS, result.subtests[0].subtests[0].status) - self.assertEqual(1, result.counts.errors) + self.assertEqual(result.counts, kunit_parser.TestCounts(passed=1, errors=1)) def test_no_kunit_output(self): @@ -218,6 +210,7 @@ class KUnitParserTest(unittest.TestCase): print_mock.assert_any_call(StrContains('could not find any KTAP output!')) print_mock.stop() self.assertEqual(0, len(result.subtests)) + self.assertEqual(result.counts.errors, 1) def test_skipped_test(self): skipped_log = test_data_path('test_skip_tests.log') @@ -225,18 +218,16 @@ class KUnitParserTest(unittest.TestCase): result = kunit_parser.parse_run_tests(file.readlines()) # A skipped test does not fail the whole suite. - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual(result.counts, kunit_parser.TestCounts(passed=4, skipped=1)) def test_skipped_all_tests(self): skipped_log = test_data_path('test_skip_all_tests.log') with open(skipped_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SKIPPED, - result.status) + self.assertEqual(kunit_parser.TestStatus.SKIPPED, result.status) + self.assertEqual(result.counts, kunit_parser.TestCounts(skipped=5)) def test_ignores_hyphen(self): hyphen_log = test_data_path('test_strip_hyphen.log') @@ -244,9 +235,7 @@ class KUnitParserTest(unittest.TestCase): result = kunit_parser.parse_run_tests(file.readlines()) # A skipped test does not fail the whole suite. - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) self.assertEqual( "sysctl_test", result.subtests[0].name) @@ -260,55 +249,49 @@ class KUnitParserTest(unittest.TestCase): prefix_log = test_data_path('test_config_printk_time.log') with open(prefix_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) - self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(result.counts.errors, 0) def test_ignores_multiple_prefixes(self): prefix_log = test_data_path('test_multiple_prefixes.log') with open(prefix_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) - self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(result.counts.errors, 0) def test_prefix_mixed_kernel_output(self): mixed_prefix_log = test_data_path('test_interrupted_tap_output.log') with open(mixed_prefix_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) - self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(result.counts.errors, 0) def test_prefix_poundsign(self): pound_log = test_data_path('test_pound_sign.log') with open(pound_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) - self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(result.counts.errors, 0) def test_kernel_panic_end(self): panic_log = test_data_path('test_kernel_panic_interrupt.log') with open(panic_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.TEST_CRASHED, - result.status) - self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(kunit_parser.TestStatus.TEST_CRASHED, result.status) + self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertGreaterEqual(result.counts.errors, 1) def test_pound_no_prefix(self): pound_log = test_data_path('test_pound_no_prefix.log') with open(pound_log) as file: result = kunit_parser.parse_run_tests(file.readlines()) - self.assertEqual( - kunit_parser.TestStatus.SUCCESS, - result.status) - self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(kunit_parser.TestStatus.SUCCESS, result.status) + self.assertEqual('kunit-resource-test', result.subtests[0].name) + self.assertEqual(result.counts.errors, 0) def test_summarize_failures(self): output = """ From patchwork Thu Nov 3 17:47:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Latypov X-Patchwork-Id: 621915 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15D85C4332F for ; Thu, 3 Nov 2022 17:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231336AbiKCRsp (ORCPT ); Thu, 3 Nov 2022 13:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbiKCRsU (ORCPT ); Thu, 3 Nov 2022 13:48:20 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBCAC1CB2D for ; Thu, 3 Nov 2022 10:47:51 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id c207-20020a624ed8000000b0056e3714b62cso1068219pfb.23 for ; Thu, 03 Nov 2022 10:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8f8dJb7CmxUii0k7ReZbO/xecf8YvrxT0ueHHyma1BU=; b=D28rs6T8OGKqTwv+0w2tiy+Wo2uFgszomXWqOdz4bK8oHd/bxnx+ygDF11Merktoeh W0x/tTWAy+1K4R3PBvAmW6StBWEh4cu44wlQ5LyUHpThEqN8JyKhrY2ReJcTBvWxXctN c7p7B7aknkrGsUM+sQ8VoC51Ja99SE9d0zKTb0LZRMMyqsZV+Hcc3tWGzdC8Cx4BaYXj Q9CwKe+1CpuIX73dKrvuIkNUu0j8EPQ5Pg5VIsESR4Ixa3K6vFdcHCYbaKvgxXFV59jb j2jy2YJh6CyY4ElDHkYBrbjJLVuqzKlskpFuivE9C34VpXsmDwdCPXTY88fXmz/gLC1t qn0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8f8dJb7CmxUii0k7ReZbO/xecf8YvrxT0ueHHyma1BU=; b=XZmUIX/QoeN6ulrmH6Qw+QJTSVn6t75x3ZsK0aBtbwF2e91s61QifqVTmmyl8Qkhpp eulb0f0GzTGseMRSQC5qILdVuX4gqv/O975z0h50jleTI7yfhIuIty0NGBMigaAWqAG1 xEEhOXABYfIQuUfLLLxtOAqrk5zXOM/+FMeaiyYX6Ca0JNHZv6vVAiw8Fjkbp/nEH0+0 XA33QYRuJssvWUtNG4iJiOlildsxuMWJlT77rjErkw2YgAdpFx3qlzv8/WayNvLCnrGL XNo+GVEqtgkPJ0XAuD/MrO4IDUWefGBRrmhD07Gi4MQQb8JPK4kh+xw7Mk43AkMBJvvd PR2Q== X-Gm-Message-State: ACrzQf2Tss6vY2WoPpzHeHU3aeZSqjoWnAdbRRHnzLaS5VyJhSMyvNMa 6tSILhJpTQHUIL0PsPA3QLVUR/O9flm3BA== X-Google-Smtp-Source: AMsMyM4Ls8UcrKSslT8x5WlYpTRZIayBCz8AJvQ97WsPxMXWt4gyd0VthhQSDtdpv7NGJeGnmrzlzFFtJYNjTA== X-Received: from dlatypov-spec.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:3f35]) (user=dlatypov job=sendgmr) by 2002:a17:90b:4c8a:b0:214:2ed8:6501 with SMTP id my10-20020a17090b4c8a00b002142ed86501mr9877245pjb.70.1667497671335; Thu, 03 Nov 2022 10:47:51 -0700 (PDT) Date: Thu, 3 Nov 2022 10:47:40 -0700 In-Reply-To: <20221103174740.3492603-1-dlatypov@google.com> Mime-Version: 1.0 References: <20221103174740.3492603-1-dlatypov@google.com> X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Message-ID: <20221103174740.3492603-3-dlatypov@google.com> Subject: [PATCH v2 3/3] kunit: tool: remove redundant file.close() call in unit test From: Daniel Latypov To: brendanhiggins@google.com, davidgow@google.com Cc: rmoar@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, Daniel Latypov Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org We're using a `with` block above, so the file object is already closed. Signed-off-by: Daniel Latypov Reviewed-by: David Gow --- v1 -> v2: just rebased onto linux-kselftest/kunit --- tools/testing/kunit/kunit_tool_test.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py index 5e3429a1202b..90c65b072be9 100755 --- a/tools/testing/kunit/kunit_tool_test.py +++ b/tools/testing/kunit/kunit_tool_test.py @@ -242,8 +242,6 @@ class KUnitParserTest(unittest.TestCase): self.assertEqual( "example", result.subtests[1].name) - file.close() - def test_ignores_prefix_printk_time(self): prefix_log = test_data_path('test_config_printk_time.log')