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 X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7706C31E40 for ; Mon, 12 Aug 2019 23:57:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BADF62070C for ; Mon, 12 Aug 2019 23:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565654227; bh=Bqdkmnp6mwn7+uGtiuDRkW/S4L7BPoXk0yV/X+vBL54=; h=In-Reply-To:References:Subject:From:Cc:To:Date:List-ID:From; b=0oI1rjpI23feHT52nV5MqplQu90jskvKpJHO2K2FstzG+quFU9qt2e5Eg6u5hHHsq 7AS8qnfpHzSJUdoChQin222LAnH1fW7E2CABFgb7MdCoe2OJyCQPn0eS7PZeVIfhRM 85sflSQ9gfC8Qp9kT96e8j32tDjXr8BWGC//+08s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727153AbfHLX5D (ORCPT ); Mon, 12 Aug 2019 19:57:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:41698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727144AbfHLX5C (ORCPT ); Mon, 12 Aug 2019 19:57:02 -0400 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 533E82063F; Mon, 12 Aug 2019 23:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565654221; bh=Bqdkmnp6mwn7+uGtiuDRkW/S4L7BPoXk0yV/X+vBL54=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=xH5Jr1y+zA4g2T4Lqz5yO5pV+3YI+m+g1R3ck6bSJoBiMnDkJSdrB5821koEnOM1x ozemBUqGL2ni/PA36r1U7ZN9xHwvK3C4GSABt23yhMwa/Dx7vomqnds0asZ6RIkXYl YOqHX4j25oAAbX9XJcyROx5ez17nbuRYexkCgIEQ= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190812182421.141150-6-brendanhiggins@google.com> References: <20190812182421.141150-1-brendanhiggins@google.com> <20190812182421.141150-6-brendanhiggins@google.com> Subject: Re: [PATCH v12 05/18] kunit: test: add the concept of expectations From: Stephen Boyd Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, kunit-dev@googlegroups.com, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-nvdimm@lists.01.org, linux-um@lists.infradead.org, Alexander.Levin@microsoft.com, Tim.Bird@sony.com, amir73il@gmail.com, dan.carpenter@oracle.com, daniel@ffwll.ch, jdike@addtoit.com, joel@jms.id.au, julia.lawall@lip6.fr, khilman@baylibre.com, knut.omang@oracle.com, logang@deltatee.com, mpe@ellerman.id.au, pmladek@suse.com, rdunlap@infradead.org, richard@nod.at, rientjes@google.com, rostedt@goodmis.org, wfg@linux.intel.com, Brendan Higgins To: Brendan Higgins , frowand.list@gmail.com, gregkh@linuxfoundation.org, jpoimboe@redhat.com, keescook@google.com, kieran.bingham@ideasonboard.com, mcgrof@kernel.org, peterz@infradead.org, robh@kernel.org, shuah@kernel.org, tytso@mit.edu, yamada.masahiro@socionext.com User-Agent: alot/0.8.1 Date: Mon, 12 Aug 2019 16:57:00 -0700 Message-Id: <20190812235701.533E82063F@mail.kernel.org> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Quoting Brendan Higgins (2019-08-12 11:24:08) > Add support for expectations, which allow properties to be specified and > then verified in tests. >=20 > Signed-off-by: Brendan Higgins > Reviewed-by: Greg Kroah-Hartman > Reviewed-by: Logan Gunthorpe Reviewed-by: Stephen Boyd Just some minor nits again. > diff --git a/include/kunit/test.h b/include/kunit/test.h > index d0bf112910caf..2625bcfeb19ac 100644 > --- a/include/kunit/test.h > +++ b/include/kunit/test.h > @@ -9,8 +9,10 @@ > #ifndef _KUNIT_TEST_H > #define _KUNIT_TEST_H > =20 > +#include > #include > #include > +#include Can you alphabet sort these? > =20 > struct kunit_resource; > =20 > @@ -319,4 +321,845 @@ void __printf(3, 4) kunit_printk(const char *level, > #define kunit_err(test, fmt, ...) \ > kunit_printk(KERN_ERR, test, fmt, ##__VA_ARGS__) > =20 > +/* > + * Generates a compile-time warning in case of comparing incompatible ty= pes. > + */ > +#define __kunit_typecheck(lhs, rhs) \ > + ((void) __typecheck(lhs, rhs)) Is there a reason why this can't be inlined and the __kunit_typecheck() macro can't be removed? > + > +/** > + * KUNIT_SUCCEED() - A no-op expectation. Only exists for code clarity. > + * @test: The test context object. [...] > + * @condition: an arbitrary boolean expression. The test fails when this= does > + * not evaluate to true. > + * > + * This and expectations of the form `KUNIT_EXPECT_*` will cause the tes= t case > + * to fail when the specified condition is not met; however, it will not= prevent > + * the test case from continuing to run; this is otherwise known as an > + * *expectation failure*. > + */ > +#define KUNIT_EXPECT_TRUE(test, condition) \ > + KUNIT_TRUE_ASSERTION(test, KUNIT_EXPECTATION, condition) A lot of these macros seem double indented. > + > +#define KUNIT_EXPECT_TRUE_MSG(test, condition, fmt, ...) = \ > + KUNIT_TRUE_MSG_ASSERTION(test, = \ > + KUNIT_EXPECTATION, = \ > + condition, = \ > + fmt, = \ > + ##__VA_ARGS__) > +