Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp550060imn; Wed, 3 Aug 2022 15:14:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR41SMBs+fdtZQwFWlJA7xzVOWeTrsm6hPA1lyR5eTnzVMmlsuqL3YtPlYJFqyXWZwXw4B6h X-Received: by 2002:a17:902:7e47:b0:16c:7115:84d6 with SMTP id a7-20020a1709027e4700b0016c711584d6mr28807930pln.93.1659564861538; Wed, 03 Aug 2022 15:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659564861; cv=none; d=google.com; s=arc-20160816; b=AkctU0nyJQbdkLBwCo0z+OTCYWshdF5vM+DBjbF2CnrsQQ7OzPwU/C+EQJ7/NKpNhp Kgtm4kZkP2nOGzSz17728bZdlob1PsJd5Cr1ADrbKuVDooW5EeqbMVSDK7fAzBgtEoVj XAweS1Xno2XchER2dixN055rDqohtn80ksu0Q252BowrVliSF2qcPyGvgZE6WLcZgfUa uY12XeQY9ZDIw7jUaAslDQeIx4urQP+ph9hiQebm1+HJTyJtzd1sHqvemNlU+2O/I40B m2ArcMVBeFJUSSe2WcEUxppZS2BoAIibAhUKAktub6oxLofSFkTUOwD48JZTiNN8L2hG 3Mhg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4GIV6GHW/gw84Ym45MjfW70omonddLKk41LLq5bv/fg=; b=mj8E/t8gb4tn3Eb1wDQ57zW1Pc4BDW+FSrwqBTZHORgczsWWzxmpB7F8C20KpP0iJf EvFOu3rk7y3eWvrVglj26wmzOeDPzfnxOwpPAI7Y6bJqNahhVOLT68Bm8+j/I/h3kO3q lKldnz1yTzxhTdo8I6oDldlY1S8SsSUVFghhkKavLaX7aZV7rApv1ZWPtbHQNYQ89loZ K6L1zcdyjhCuzfjSy1jsSP/Iz895uPtFRrmeEtaqBqzkfkPiGNXTaPF/Ioet+zi9kN3G LCBs3yjy+/82g7kB9FNyICiX9eO7Vpjsi31iFSSakHEIn5uJi//WMkhNUpYmaS2Lj/yZ b5MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@riseup.net header.s=squak header.b=lwKy0nEg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=riseup.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u2-20020a17090282c200b0016daa0c3ab5si2989567plz.406.2022.08.03.15.14.07; Wed, 03 Aug 2022 15:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@riseup.net header.s=squak header.b=lwKy0nEg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=riseup.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238383AbiHCV7g (ORCPT + 99 others); Wed, 3 Aug 2022 17:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238501AbiHCV72 (ORCPT ); Wed, 3 Aug 2022 17:59:28 -0400 Received: from mx0.riseup.net (mx0.riseup.net [198.252.153.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 513EC5C9D6; Wed, 3 Aug 2022 14:59:27 -0700 (PDT) Received: from fews2.riseup.net (fews2-pn.riseup.net [10.0.1.84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx0.riseup.net (Postfix) with ESMTPS id 4Lym3f4tmrz9t4M; Wed, 3 Aug 2022 21:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1659563966; bh=46QMNNu+FK8isynfWdGkGqc+HS477sp2/1QXbvEgpxg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwKy0nEglZFjSrWXbCi+YN3PgxPSU54SKWCfW0GdbtSrKpbGhjKsq34U29UBrAIJ4 cJSIzAxnHVl0CimnwMxd5lksKmH/p0BN5TuHnyX7TWEDjlqONoolucf8xBFVHN9/gz kmLdLAfsOamGY0mxo/jP6D6vr/OjdnKeyrlDPIHg= X-Riseup-User-ID: 932639AD08357356C2A742C45BE4863C0B8E1F17DB734F891B927579ABF1588D Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews2.riseup.net (Postfix) with ESMTPSA id 4Lym3Z104Sz1ySb; Wed, 3 Aug 2022 21:59:21 +0000 (UTC) From: =?UTF-8?q?Ma=C3=ADra=20Canal?= To: Brendan Higgins , davidgow@google.com, Daniel Latypov , airlied@linux.ie, daniel@ffwll.ch, davem@davemloft.net, kuba@kernel.org, jose.exposito89@gmail.com, javierm@redhat.com Cc: andrealmeid@riseup.net, melissa.srw@gmail.com, siqueirajordao@riseup.net, Isabella Basso , magalilemes00@gmail.com, tales.aparecida@gmail.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, =?UTF-8?q?Ma=C3=ADra=20Canal?= Subject: [PATCH v3 3/3] kunit: Use KUNIT_EXPECT_MEMEQ macro Date: Wed, 3 Aug 2022 18:58:55 -0300 Message-Id: <20220803215855.258704-4-mairacanal@riseup.net> In-Reply-To: <20220803215855.258704-1-mairacanal@riseup.net> References: <20220803215855.258704-1-mairacanal@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham 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 Use KUNIT_EXPECT_MEMEQ to compare memory blocks in replacement of the KUNIT_EXPECT_EQ macro. Therefor, the statement KUNIT_EXPECT_EQ(test, memcmp(foo, bar, size), 0); is replaced by: KUNIT_EXPECT_MEMEQ(test, foo, bar, size); Signed-off-by: MaĆ­ra Canal Acked-by: Daniel Latypov --- v1 -> v2: - Change the macro KUNIT_EXPECT_ARREQ to KUNIT_EXPECT_MEMEQ, in order to make it easier for users to infer the right size unit (Daniel Latypov). v2 -> v3: No changes. --- drivers/gpu/drm/tests/drm_format_helper_test.c | 6 +++--- net/core/dev_addr_lists_test.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_format_helper_test.c b/drivers/gpu/drm/tests/drm_format_helper_test.c index 26ecf3b4b137..482136282273 100644 --- a/drivers/gpu/drm/tests/drm_format_helper_test.c +++ b/drivers/gpu/drm/tests/drm_format_helper_test.c @@ -217,7 +217,7 @@ static void xrgb8888_to_rgb332_test(struct kunit *test) drm_fb_xrgb8888_to_rgb332(dst, result->dst_pitch, src, &fb, ¶ms->clip); - KUNIT_EXPECT_EQ(test, memcmp(dst, result->expected, dst_size), 0); + KUNIT_EXPECT_MEMEQ(test, dst, result->expected, dst_size); } static void xrgb8888_to_rgb565_test(struct kunit *test) @@ -245,11 +245,11 @@ static void xrgb8888_to_rgb565_test(struct kunit *test) drm_fb_xrgb8888_to_rgb565(dst, result->dst_pitch, src, &fb, ¶ms->clip, false); - KUNIT_EXPECT_EQ(test, memcmp(dst, result->expected, dst_size), 0); + KUNIT_EXPECT_MEMEQ(test, dst, result->expected, dst_size); drm_fb_xrgb8888_to_rgb565(dst, result->dst_pitch, src, &fb, ¶ms->clip, true); - KUNIT_EXPECT_EQ(test, memcmp(dst, result->expected_swab, dst_size), 0); + KUNIT_EXPECT_MEMEQ(test, dst, result->expected_swab, dst_size); } static struct kunit_case drm_format_helper_test_cases[] = { diff --git a/net/core/dev_addr_lists_test.c b/net/core/dev_addr_lists_test.c index 049cfbc58aa9..90e7e3811ae7 100644 --- a/net/core/dev_addr_lists_test.c +++ b/net/core/dev_addr_lists_test.c @@ -71,11 +71,11 @@ static void dev_addr_test_basic(struct kunit *test) memset(addr, 2, sizeof(addr)); eth_hw_addr_set(netdev, addr); - KUNIT_EXPECT_EQ(test, 0, memcmp(netdev->dev_addr, addr, sizeof(addr))); + KUNIT_EXPECT_MEMEQ(test, netdev->dev_addr, addr, sizeof(addr)); memset(addr, 3, sizeof(addr)); dev_addr_set(netdev, addr); - KUNIT_EXPECT_EQ(test, 0, memcmp(netdev->dev_addr, addr, sizeof(addr))); + KUNIT_EXPECT_MEMEQ(test, netdev->dev_addr, addr, sizeof(addr)); } static void dev_addr_test_sync_one(struct kunit *test) -- 2.37.1