Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3629111pxb; Mon, 24 Jan 2022 13:55:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0fsdl2JNSm6v5KrqtEEByn0NDn086hstmaZk55qzhA89VbqqH/qzBd16SmpzMlRYhFKo6 X-Received: by 2002:a63:1d5:: with SMTP id 204mr13199383pgb.623.1643061320155; Mon, 24 Jan 2022 13:55:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061320; cv=none; d=google.com; s=arc-20160816; b=EJlj+Psu8iD4m0Sjyu8pYtrfcCTIfZlrDXK7P8KpymHnQ33nB8XfJu9q3CIjQWp488 eZ9z3TnUl56P/qbW8lwcShqjHfXzTCtqLN3sar47A3drGNkLyOZDng5aSzjs6H1zVFvm RaEY93+NyCm55j6hAJngKL+3meVFpyEJkgpmMqvebLdU3rM28oGZig5O79nJrt+WijeP KsabY42dwN/wXuxRjE7wigywKhwDBGKoIh9u7iyP6xWBWSYX75RUV9DdPMlt0qgLn9Vf xmwowVka4CJR0KN/FwtVXtVhwaA74m12PJCX5GIyb+ekCCJdHuxrCGA7pHrd5iy7iI6K wt5g== 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=LozxbbKteTc2EYDlYOS0QV/nskBquAQlpFS8JinoXuw=; b=UTLvPjtXw5Ol5g3TH/EZ3M86GMidZK+rYFxZFGH32eoUo3e/QvtCKz/0DVLw2sd4jv 3eG/+Cm6/JYobFUPWC9Iv7Jv203REbdvIlTzWK2Pyzxy6hg0FWS9+a/9hAVmjdO+FdvY HHU+W7/ISZq+KeoMmwSGO5Hjr53vRZy+7B3dOwyAZFHRh4SuLIMsJXvUBt4EBizlJibB Odh7ueDJRfM1nd4VJcVcZ/WX3x7XVLbsL3afkibJh2JInUKCx6giYKM9OFJq+eybfCp4 TqwodinuGWDv/wLiGcRmKiE9cXlglkQWUOkUS31sHtKfqtrewULT/+KYJLUp3xwEUhuM POdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="l/kWXL/B"; 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 b8si1974943plz.397.2022.01.24.13.55.08; Mon, 24 Jan 2022 13:55:20 -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="l/kWXL/B"; 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 S1378825AbiAXVoC (ORCPT + 99 others); Mon, 24 Jan 2022 16:44:02 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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)); -- 2.34.1