Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2255517iof; Wed, 8 Jun 2022 00:36:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaKkNeUDxlmTRqVibmHovioX/HvQEBy0vrE270hdoTLqC/fKTXsZtXJnPd4Q8loCNCvgzy X-Received: by 2002:a17:90b:3b88:b0:1e6:7aa2:4301 with SMTP id pc8-20020a17090b3b8800b001e67aa24301mr35903197pjb.118.1654673792547; Wed, 08 Jun 2022 00:36:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654673792; cv=none; d=google.com; s=arc-20160816; b=VJB+tFX2Y4khW5ssYAKh9G3+TJ1r8rnVoxqBf2najbIuQYpdGNAmtphIFmoowxEoIX 8nyS6W5eapPaTceu+M/wm0zWKUKG6qE4chx7HKOCYJjz13ljz8B6A75LajJ0z5N1TfzG +iDxpkgyBDaznll0Q40+siOo9y9C88Dh6vofLB4Tgo89gKE6ehk3uZeWK6svL7Rdh/tm UiPJDw0hf3jvb9dc7OqpyAfh/KhFN1keKvwvUQtJQ3mBLHvYPQYcJbF6ElkuxoLL/eJ6 vsWW6n0gtRgADN+7c0ruezUx3lHIyGepcrxURqjLG5XPvcT+FgWNHMkdgTyNST7H3ef/ 80cA== 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=nXE/21FAmBxm0xGX7XIiLtwiyMVht9x7ZCmJ0BCyPB0=; b=zcHPtEgTX+kZpHZ+Bd9HDp+Fsm27AX2ZxQTPpRCpSYRCduIyiD5ssyJufFMH42wf0C FoMcQRYNqhMj3aT8H0UDMh4cMSuB5lYKY3iY74mfq3ghq9y0QG5Acn+3/KUYHb8P3kw5 RE/59pigWHNGBhNQLgp1PsDXXviTXkbO2xzBKrTwVvQS+j4Q4AmDek6MK1mcnuOmsnco eOp5GJgv6SrpUSCk7iWaqs6DuUQZEnM5fr6OT+nvM4o/lEKHH0yMcjwi5lCuMFsVBGAq G2y9dGfSyNq9/Uiu5DFsPYGPrsYE2Z/yTTtNrzBujYTxNjGOW0K2tdzBaozMEygop0nB Dz2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4KfNUxj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q13-20020a170902eb8d00b0016793c0c4b7si4278401plg.225.2022.06.08.00.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 00:36:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4KfNUxj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71C9C248254; Wed, 8 Jun 2022 00:07:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377437AbiFGUmJ (ORCPT + 99 others); Tue, 7 Jun 2022 16:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357905AbiFGTmc (ORCPT ); Tue, 7 Jun 2022 15:42:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DA60CE1E; Tue, 7 Jun 2022 11:17:08 -0700 (PDT) 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 0939760C7F; Tue, 7 Jun 2022 18:17:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA6BDC385A2; Tue, 7 Jun 2022 18:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654625827; bh=xRzVVb9dp3AfJuQgs6IuBJGSwSqg0aexqaH6UBZReSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4KfNUxjmJ83C0vj0Cfqjzaj0WFZRm+cvnhmt7pJTQ6gjQI8SQ4+AcPkik93srJ9x tc0zp99E5i2Dc1WYvadENLwiCna6Pqv9rLYEu4MGDlIwaYNDTL6IYTid5vrwkj+E+a c7f63hO6CffPEcCj1FrueFAvCEdK6Bp4MxSK55uQ= 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.17 157/772] kunit: tool: make parser stop overwriting status of suites w/ no_tests Date: Tue, 7 Jun 2022 18:55:49 +0200 Message-Id: <20220607164953.669543194@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164948.980838585@linuxfoundation.org> References: <20220607164948.980838585@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Latypov [ Upstream commit dbf0b0d53a2b5afa6ef7372dcedf52302669fc2c ] Consider this invocation $ ./tools/testing/kunit/kunit.py parse < parent_test = parse_test_header(lines, test) where we have special handling when we see "# Subtest" and we ignore the explicit reported "not ok 1" status! Also, NO_TESTS at a suite-level only results in a non-zero status code where then there's only one suite atm. This change is the minimal one to make sure we don't overwrite it. 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_parser.py | 7 +++++-- .../test_data/test_is_test_passed-no_tests_no_plan.log | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/kunit/kunit_parser.py b/tools/testing/kunit/kunit_parser.py index 05ff334761dd..2f93ed1d7f99 100644 --- a/tools/testing/kunit/kunit_parser.py +++ b/tools/testing/kunit/kunit_parser.py @@ -789,8 +789,11 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str]) -> Test: # Check for there being no tests if parent_test and len(subtests) == 0: - test.status = TestStatus.NO_TESTS - test.add_error('0 tests run!') + # Don't override a bad status if this test had one reported. + # Assumption: no subtests means CRASHED is from Test.__init__() + if test.status in (TestStatus.TEST_CRASHED, TestStatus.SUCCESS): + test.status = TestStatus.NO_TESTS + test.add_error('0 tests run!') # Add statuses to TestCounts attribute in Test object bubble_up_test_results(test) diff --git a/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log b/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log index dd873c981108..4f81876ee6f1 100644 --- a/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log +++ b/tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log @@ -3,5 +3,5 @@ TAP version 14 # Subtest: suite 1..1 # Subtest: case - ok 1 - case # SKIP + ok 1 - case ok 1 - suite -- 2.35.1