From nobody Sat Feb 7 15:17:35 2026 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 D5687C54EE9 for ; Tue, 13 Sep 2022 14:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233282AbiIMOWp (ORCPT ); Tue, 13 Sep 2022 10:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233709AbiIMOTs (ORCPT ); Tue, 13 Sep 2022 10:19:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBE8B65555; Tue, 13 Sep 2022 07:14:07 -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 CE6B461497; Tue, 13 Sep 2022 14:12:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3D71C433D6; Tue, 13 Sep 2022 14:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663078369; bh=QQf0hwylFjIRj63wKXmW9XYh7DnbHSzJRNIvKsNtvDs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wBffrZ1x/ekWDQaPgGnysIJpMlb4EmeTeEehP/aZ9kqiXR2VG651RhFaAlKZDzGb0 oIBpMypDA4nolXiUU2E9TonhaHqGTjKYYmz5CaIZp4St/zYio0Onn3/inMHyfQYrM2 JdNi9GnIpWmLOxzXfIB/FCP/pRXI1EsyeczZwXaI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sander Vanheule , Daniel Latypov , Brendan Higgins , Shuah Khan , Sasha Levin Subject: [PATCH 5.19 113/192] kunit: fix assert_type for comparison macros Date: Tue, 13 Sep 2022 16:03:39 +0200 Message-Id: <20220913140415.604560974@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140410.043243217@linuxfoundation.org> References: <20220913140410.043243217@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sander Vanheule [ Upstream commit aded3cad909581c60335037112c4f86bbfe90f17 ] When replacing KUNIT_BINARY_*_MSG_ASSERTION() macros with KUNIT_BINARY_INT_ASSERTION(), the assert_type parameter was not always correctly transferred. Specifically, the following errors were introduced: - KUNIT_EXPECT_LE_MSG() uses KUNIT_ASSERTION - KUNIT_ASSERT_LT_MSG() uses KUNIT_EXPECTATION - KUNIT_ASSERT_GT_MSG() uses KUNIT_EXPECTATION A failing KUNIT_EXPECT_LE_MSG() test thus prevents further tests from running, while failing KUNIT_ASSERT_{LT,GT}_MSG() tests do not prevent further tests from running. This is contrary to the documentation, which states that failing KUNIT_EXPECT_* macros allow further tests to run, while failing KUNIT_ASSERT_* macros should prevent this. Revert the KUNIT_{ASSERTION,EXPECTATION} switches to fix the behaviour for the affected macros. Fixes: 40f39777ce4f ("kunit: decrease macro layering for integer asserts") Signed-off-by: Sander Vanheule Reviewed-by: Daniel Latypov Reviewed-by: Brendan Higgins Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- include/kunit/test.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/kunit/test.h b/include/kunit/test.h index 8ffcd7de96070..648dbb00a3008 100644 --- a/include/kunit/test.h +++ b/include/kunit/test.h @@ -863,7 +863,7 @@ do { \ =20 #define KUNIT_EXPECT_LE_MSG(test, left, right, fmt, ...) \ KUNIT_BINARY_INT_ASSERTION(test, \ - KUNIT_ASSERTION, \ + KUNIT_EXPECTATION, \ left, <=3D, right, \ fmt, \ ##__VA_ARGS__) @@ -1153,7 +1153,7 @@ do { \ =20 #define KUNIT_ASSERT_LT_MSG(test, left, right, fmt, ...) \ KUNIT_BINARY_INT_ASSERTION(test, \ - KUNIT_EXPECTATION, \ + KUNIT_ASSERTION, \ left, <, right, \ fmt, \ ##__VA_ARGS__) @@ -1194,7 +1194,7 @@ do { \ =20 #define KUNIT_ASSERT_GT_MSG(test, left, right, fmt, ...) \ KUNIT_BINARY_INT_ASSERTION(test, \ - KUNIT_EXPECTATION, \ + KUNIT_ASSERTION, \ left, >, right, \ fmt, \ ##__VA_ARGS__) --=20 2.35.1