From mboxrd@z Thu Jan 1 00:00:00 1970 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 BE12BC43217 for ; Sat, 5 Feb 2022 06:16:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355385AbiBEGQ2 (ORCPT ); Sat, 5 Feb 2022 01:16:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239049AbiBEGQY (ORCPT ); Sat, 5 Feb 2022 01:16:24 -0500 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10780C061353 for ; Fri, 4 Feb 2022 22:16:11 -0800 (PST) Received: by mail-pg1-x54a.google.com with SMTP id b9-20020a63e709000000b00362f44b02aeso3853265pgi.17 for ; Fri, 04 Feb 2022 22:16:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=tmuYmC0m8mvbfJAxQIBdx9zkbWIC9B6I2Z9WuJhYmSE=; b=ITilSpV3LDAPKoHX4WCaVmDBD0RUDgc9gX30+niTgT6rdP6U6Hfi7J9r5kWQDJgSSx rTlShTgwa8Vr/bzieViJX5pXG4hD/ZFg/vJNbLwsF/EPHo1tIpdTh3Utl72TIH6I7ZXl KYFxYXoMdfMtCetm5wReVbMZbcDu+3Mk2YGA3qpA5CX2jB6rN08eNuiWuwZk/D8qTNmd y4N8cn9NZFJnuOrmleShnpS0ULwYOPlAB/jEduI96iqwGLm/bXA5aSUPRAMJK6ReJTZJ ldgW6OSsT64DcpUjZpyzgqenczLys15ImiJGE1MPitfk085VVEBfg1CblwY9ziPIY8ww 5BjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tmuYmC0m8mvbfJAxQIBdx9zkbWIC9B6I2Z9WuJhYmSE=; b=uqhLS6OBtRWCdE1CM5xVyY3GzJgxqTuDzuzQr4p95yzqgLNfcyh2ER3DiyussIHLPM eaZxOJGNpgie02m3NTC2D6jdr1QhIM/JQrE9fLD/ze+8OnDoCE9DK/xMnynA4RUknjM4 eosmaSkFm7ueOGeBSobvJKLdsXs6zCeFhgDNjrYXjBqb55qEHY2pB2TK3hFMHu7HB7rS ClJ6YNGXaQGahM7564aR1owKRog+0SVfepqct4NAOtEBktyBhP63bINr4eBzlCV/OGiB 1uR3tHxLIqL171Y5+ygDK5z/llo6EmYovgVh7JwbmRo0hH3lI3Anut9VYmYi7Lb5YNdz OAeQ== X-Gm-Message-State: AOAM531QSh7Gc9BnoGwUW/eZ7+Bvua/5uSCg9xboPDMYT8r1jKDpk40e evfwgGLVg6/W0ZgaqWiw55cCNc2fPovs8Q== X-Google-Smtp-Source: ABdhPJyBaPKfYTmrgkAQA/OZ1IQkSPEDinSUL3sEOCbMICLR3KqVHBu0JlUWx3tgTkdOfuy12G6K7r+jCwP/NQ== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a17:902:70ca:: with SMTP id l10mr6667232plt.174.1644041770536; Fri, 04 Feb 2022 22:16:10 -0800 (PST) Date: Sat, 5 Feb 2022 14:15:37 +0800 In-Reply-To: <20220205061539.273330-1-davidgow@google.com> Message-Id: <20220205061539.273330-2-davidgow@google.com> Mime-Version: 1.0 References: <20220205061539.273330-1-davidgow@google.com> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog Subject: [PATCH 2/3] list: test: Add a test for list_is_head() From: David Gow To: Shuah Khan , Andy Shevchenko , Linus Torvalds , Brendan Higgins Cc: David Gow , Daniel Latypov , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org list_is_head() was added recently[1], and didn't have a KUnit test. The implementation is trivial, so it's not a particularly exciting test, but it'd be nice to get back to full coverage of the list functions. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/list.h?id=0425473037db40d9e322631f2d4dc6ef51f97e88 Signed-off-by: David Gow --- lib/list-test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/list-test.c b/lib/list-test.c index 976e9ae1f3c5..7ce7eaebe060 100644 --- a/lib/list-test.c +++ b/lib/list-test.c @@ -252,6 +252,15 @@ static void list_test_list_bulk_move_tail(struct kunit *test) KUNIT_EXPECT_EQ(test, i, 2); } +static void list_test_list_is_head(struct kunit *test) +{ + struct list_head a, b; + + KUNIT_EXPECT_TRUE(test, list_is_head(&a, &a)); + KUNIT_EXPECT_FALSE(test, list_is_head(&a, &b)); +} + + static void list_test_list_is_first(struct kunit *test) { struct list_head a, b; @@ -729,6 +738,7 @@ static struct kunit_case list_test_cases[] = { KUNIT_CASE(list_test_list_move), KUNIT_CASE(list_test_list_move_tail), KUNIT_CASE(list_test_list_bulk_move_tail), + KUNIT_CASE(list_test_list_is_head), KUNIT_CASE(list_test_list_is_first), KUNIT_CASE(list_test_list_is_last), KUNIT_CASE(list_test_list_empty), -- 2.35.0.263.gb82422642f-goog