From patchwork Mon Jan 24 18:34:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 535559 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 603EDC433F5 for ; Mon, 24 Jan 2022 21:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1448744AbiAXVNo (ORCPT ); Mon, 24 Jan 2022 16:13:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:59782 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446371AbiAXVIF (ORCPT ); Mon, 24 Jan 2022 16:08:05 -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 ams.source.kernel.org (Postfix) with ESMTPS id A35BDB81057; Mon, 24 Jan 2022 21:08:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5D10C340EB; Mon, 24 Jan 2022 21:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058482; bh=qNBywZO7Q40NSzdO4zwsqXT66WdGUyNv/559Vflwzns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/kWXL/BG8VMaz1iVrc2MA9HIPzsyu0WB34PN2dc7gTw4UXYhRDtub7MWYeXcEGCC +7OxYmbabE6O7l4waKlgNBHiJY3jelKhIP5IFFY8h2dqm0jUkVnXHgaJ99cLh7A36y nyVusdeBXhr/uqTx1hElvzcwT0dwkd9t+trxargg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Shuah Khan , Sasha Levin Subject: [PATCH 5.16 0270/1039] selftests: harness: avoid false negatives if test has no ASSERTs Date: Mon, 24 Jan 2022 19:34:19 +0100 Message-Id: <20220124184134.380131577@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 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jakub Kicinski [ Upstream commit 3abedf4646fdc0036fcb8ebbc3b600667167fafe ] Test can fail either immediately when ASSERT() failed or at the end if one or more EXPECT() was not met. The exact return code is decided based on the number of successful ASSERT()s. If test has no ASSERT()s, however, the return code will be 0, as if the test did not fail. Start counting ASSERT()s from 1. Fixes: 369130b63178 ("selftests: Enhance kselftest_harness.h to print which assert failed") Signed-off-by: Jakub Kicinski Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/kselftest_harness.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index ae0f0f33b2a6e..79a182cfa43ad 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -969,7 +969,7 @@ void __run_test(struct __fixture_metadata *f, t->passed = 1; t->skip = 0; t->trigger = 0; - t->step = 0; + t->step = 1; t->no_print = 0; memset(t->results->reason, 0, sizeof(t->results->reason));