Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4174787ybg; Mon, 8 Jun 2020 00:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe91UQpiSIla6EBZ9Rg+g1awtT5jDmSXLjWyT7UJukD0QvKgHKCpqzt9v4LVpwPkPKUsMi X-Received: by 2002:a50:9fc2:: with SMTP id c60mr21573640edf.319.1591601763738; Mon, 08 Jun 2020 00:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591601763; cv=none; d=google.com; s=arc-20160816; b=Eghh2QXCr4zC66SSb7aN3sxkx87ZztsJt06iSnl1dGE3VfDysCgcm7Vt1OpuSljtf6 D7nR2DF97ElBiWICM9CTSCliWAr3MLs4i51Gi5Ktolq4KJKFrqKBfegxsLnJEIINzaK3 C1nk+buJ+xZSV6swthL+q+DOApWzcc5hG5+d5tq2oM83QjOY33ttkYtFc3PDoDhlKAqk a2NwTwAda6yi+9Zsg8f8P9/2tRK4Yw019L8QL0uc8RPORDqVaQ6r36Bq6apAOlXbaRy0 ZFkRIKpTjZcesDx0rsdquWuAiFk5HK6OdSKThmEUKXJ3reJeT7UiSXiHxfAZuKYEEYZ2 ngLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=u0pDWBHAPx+7BsUGPboybuFRpJCeYypkd7+L0T1+1hA=; b=jI64vqhVVRnxa8it4dpz2atGSZB6s33lHq0Yue0+JzJVUVTKDR7IkX3+9h5+jdfUGt RUqtyMAZvQz5fxa82z5xkb8HUXYC7DXCRZJQ4bBW1n6pLrg3vz14NKXJOHkCauVUNwyl bgYSwbXDuyFLv2DQlFaYWIMA8FT85sZ7HNGM/MEdFHang1pyX74f5XprXnbBg4GFRm2m C+h+Iies11fGEM1ozykg6yLdSJDu99s4wseFSE8LrNQjgYwMkTHzFU+VaOto4p1iHUB7 R2qSvEGjJmov3UqXLcdznCAjWokghteHsDQDo5b7tjiNzs9LdXT3SBHvBTAvhfUhlogW NRgQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u9si8311011ejx.370.2020.06.08.00.35.40; Mon, 08 Jun 2020 00:36:03 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbgFHHdT (ORCPT + 99 others); Mon, 8 Jun 2020 03:33:19 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40808 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728954AbgFHHdS (ORCPT ); Mon, 8 Jun 2020 03:33:18 -0400 Received: by mail-ot1-f68.google.com with SMTP id s13so12843918otd.7; Mon, 08 Jun 2020 00:33:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u0pDWBHAPx+7BsUGPboybuFRpJCeYypkd7+L0T1+1hA=; b=oZJFmRsqkC7WVTHqG37nSrj9cpZvlLLmeRnii8D45+r9WBxgzLzEIKzacBiGOC+xSc 7QLSX3Aet+6nV/MxcVW0IQc0cc/GuJTaw+XDGJLstyqFIKmqZuxCZaFsFAcg7ZLVb8fO HES2ogGz5Bq5SQFVL1ICq+ghpGrVjZvO0Bz1qicIsd7QhXwD/vzPfmbTIyS+W6/nBGQx MIIml8uCZ/jFFpLH4COlBShjagMPW1Js/J3rWN89i2weyumVGFL6lvhzXNmr+WaT8KlT 1utWOQX8NZ6BjEKnfdLEnU0Zkc/BFdmO3wyyP6j7nZXXavnjQhREJK8/6+BEte40a18V HQBg== X-Gm-Message-State: AOAM530gwEGePNLYuJZxwcfPChzmudmm7VD0yI78xPheMv3GAc4ovHbb uGEksWUWsvehUNIk/or9zUs0stPklsOOTLODtgo= X-Received: by 2002:a9d:c29:: with SMTP id 38mr15586831otr.107.1591601597506; Mon, 08 Jun 2020 00:33:17 -0700 (PDT) MIME-Version: 1.0 References: <20200604233003.GA102768@rikard> <20200607203411.70913-1-rikard.falkeborn@gmail.com> <20200607203411.70913-2-rikard.falkeborn@gmail.com> In-Reply-To: <20200607203411.70913-2-rikard.falkeborn@gmail.com> From: Geert Uytterhoeven Date: Mon, 8 Jun 2020 09:33:05 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] bits: Add tests of GENMASK To: Rikard Falkeborn Cc: Andrew Morton , Andy Shevchenko , Arnd Bergmann , emil.l.velikov@gmail.com, Kees Cook , Linus Walleij , Linux-Arch , Linux Kernel Mailing List , kbuild test robot , syednwaris@gmail.com, William Breathitt Gray , Masahiro Yamada Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Richard, Thanks for your patch! On Sun, Jun 7, 2020 at 10:35 PM Rikard Falkeborn wrote: > Add tests of GENMASK and GENMASK_ULL. > > A few test cases that should fail compilation are provided under ifdef. It doesn't hurt to mention the name of the #ifdef here. > Suggested-by: Andy Shevchenko > Signed-off-by: Rikard Falkeborn > --- /dev/null > +++ b/lib/test_bits.c > @@ -0,0 +1,73 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Test cases for functions and macrso in bits.h > + */ > + > +#include > +#include > + > + > +void genmask_test(struct kunit *test) > +{ > + KUNIT_EXPECT_EQ(test, 1ul, GENMASK(0, 0)); > + KUNIT_EXPECT_EQ(test, 3ul, GENMASK(1, 0)); > + KUNIT_EXPECT_EQ(test, 6ul, GENMASK(2, 1)); > + KUNIT_EXPECT_EQ(test, 0xFFFFFFFFul, GENMASK(31, 0)); > + > +#ifdef TEST_BITS_COMPILE "#ifdef TEST_GENMASK_FAILURES"? > + /* these should fail compilation */ > + GENMASK(0, 1); > + GENMASK(0, 10); > + GENMASK(9, 10); > +#endif Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds