Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1373584yba; Thu, 16 May 2019 20:33:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoGph3H37lmDjXGfiJKSfTTEfqeVgyaA9Sfg1953M5qw2bWabFNatgvGnsnPFBZuwpr6zN X-Received: by 2002:a17:902:ca4:: with SMTP id 33mr17151373plt.107.1558064011665; Thu, 16 May 2019 20:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558064011; cv=none; d=google.com; s=arc-20160816; b=uK9L4Y4OONSRNuYxtmi2GJ9aO1OTdGplNPhlfdDgleGnGuIqYNZRqCUj03L59wgi9y 6xtQp8Q4/WMBSi0skK0tCHiqasBSc1VpjdMgV9f9DZUZ8Cn9AISu8xBAOTtJRq5gUAPM OEvRNgSQmeTSNkkWvFK3IxiFpovpb+g04uptnxPZLhe8jI0nUSMgrdBQMMhnYxBOUvdh snpvwAW6yGtU9TyP9nmTYFmtlNCZZbLJxDYBy8MaseOXtSyUkwuiOpqlJ2bd0FLRVfmI p9ZRveGFG0GM2UGEl7xFUQ76xFjD+1ngUzPz+K0st2nP1JmTFQdVpRvJGsjDnu29IZPr VY7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:user-agent:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=GxxKZu8mmwpbv9Q3uE4jxIekBGgYv9RtNEj+lgGGxmA=; b=L6QEEhwNp8z/PujjfmMcFabJRTFstmxexmJWA2WMbIfY4lQ4M5HJAeQraGjHVsz4ww hmhMbLpcGPCNRjAcJL3gY6X2AnLI6b8IT8GSdSNYSUgVvaGj6vVkP2Y+T0PdG+/JrRSC eIod5uxAb3PzW2Q6KTdfentvY/MaL+TGdyTbVvZGhAx1njEHY0nSe4f+SBpLW3ynf0HJ CAyvpIdd9oUJLRZDFTsMaaDVqTQs1tDAaFyaXZ8BCJMeThjSsiEB3Snw9Fv19+p2lz8A XPkoNJKcbSw89utPnboH1Q/j+nLVQMaeIZt01+fnGMqMJ1UUZwXvVyHJrAMv1kRAi5AW uIwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2IVzgl9A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si6773982pgd.370.2019.05.16.20.33.14; Thu, 16 May 2019 20:33:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2IVzgl9A; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbfEQAfY (ORCPT + 99 others); Thu, 16 May 2019 20:35:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:47334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726241AbfEQAfX (ORCPT ); Thu, 16 May 2019 20:35:23 -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 A48A7206BF; Fri, 17 May 2019 00:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558053322; bh=7TW9YRtA+zrn9bZVhm3pRMCNMOGMBXRGC3+aYbhED+Q=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=2IVzgl9AIPO++Ch2lD+HPwvhsbPyCjqMp1srxLDmXKAwP6rd65u7Wus1PDx6ERIac JgIJlEX6orOSTCbWhyMS/r6KVO9ATGZRYWIsOwLBH7NuKkS7fRkhmj+govo4YPjBBW njgrIlohapBLa9e+A8WE0GpgY53wrangCoB5QG44= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190514221711.248228-2-brendanhiggins@google.com> References: <20190514221711.248228-1-brendanhiggins@google.com> <20190514221711.248228-2-brendanhiggins@google.com> Subject: Re: [PATCH v4 01/18] kunit: test: add KUnit test runner core 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: Thu, 16 May 2019 17:35:21 -0700 Message-Id: <20190517003522.A48A7206BF@mail.kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Brendan Higgins (2019-05-14 15:16:54) > diff --git a/include/kunit/test.h b/include/kunit/test.h > new file mode 100644 > index 0000000000000..e682ea0e1f9a5 > --- /dev/null > +++ b/include/kunit/test.h > @@ -0,0 +1,162 @@ [..] > +/** > + * struct kunit - represents a running instance of a test. > + * @priv: for user to store arbitrary data. Commonly used to pass data c= reated > + * in the init function (see &struct kunit_module). > + * > + * Used to store information about the current context under which the t= est is > + * running. Most of this data is private and should only be accessed ind= irectly > + * via public functions; the one exception is @priv which can be used by= the > + * test writer to store arbitrary data. > + */ > +struct kunit { > + void *priv; > + > + /* private: internal use only. */ > + const char *name; /* Read only after initialization! */ > + spinlock_t lock; /* Gaurds all mutable test state. */ > + bool success; /* Protected by lock. */ Is this all the spinlock protects? Doesn't seem useful if it's just protecting access to the variable being set or not because code that reads it will have a stale view of the value. > diff --git a/kunit/test.c b/kunit/test.c > new file mode 100644 > index 0000000000000..86f65ba2bcf92 > --- /dev/null > +++ b/kunit/test.c > @@ -0,0 +1,229 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Base unit test (KUnit) API. > + * > + * Copyright (C) 2019, Google LLC. > + * Author: Brendan Higgins > + */ > + > +#include > +#include > +#include > + [...] > + > +size_t kunit_module_counter =3D 1; static?