Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6601761yba; Wed, 1 May 2019 16:03:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGqXOyz8QEieushqhhVbdUjJ4k0ifqb3Mj3EMuis0AWfjAqHtRs62Q09EP701o0N7wxoEX X-Received: by 2002:a17:902:f205:: with SMTP id gn5mr200739plb.207.1556751797298; Wed, 01 May 2019 16:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556751797; cv=none; d=google.com; s=arc-20160816; b=CStAcqgU3Pj2QJuVxBfphmR4lJj3KTU5cDqmHeDBZX9iAGKco/5iTlmg05XHTP11jK CoJPYCrOnE3w1SW8py034cXga4/hTtIAkZ/QfXZSiCkW7tK9tLdjqH4naX/82p5Qr64b U+lbbKXmxYZbXL8LoCvxWYFo4irSFpDAW4wmARKfCyQg8Slq8jJL/wMs8UVIGst1x1+D irrR4wewUjz9ju4Q/C1cHTRiL5K8KkhPftfNZwVqTUVPQ6mCTm5G/yA8RBdfJsB9M3j3 QM6DP7axuj7olG484+gbJmcwe1/QZ4JRktztsFHFqnwo2EjSouvMVQ4jPq7fEgnRko02 c24A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=De7JrG6+3XL344zZMScSqunmKbgZceVjMJC0FL9AbxY=; b=wHT3NhJxPTFX6qrp2wkYNyaDd9/uBkadM2OYn1c9W8DEwMMvSo0GWQS5fm8YvUG2Yc 2/mzLde+go+5KZ09ZbcZcJWgW+zZ5EbpQDAhvaPXhyJdz4dcoj1SX/O6gQQQ5Ic8hrH6 4a2y+aMLSEQaWwCzWeN+vw2QASg7j5I5gGHDC6KPTpaGqwzWyLt6i6IyoFvWS449GJ/l qT1HHLQfF8f/WbKOQYWsSD6gUCDEDjTu4rq+P3eou7EgbXu4WyLpXwIrjr3IT+/WrDyU Nm9xAJb4qYH2rOUAxORwsc2PB4VcftZuuXBk31+TSBy9kwGFPcm9DJvfnMDbT7+9cQV/ dbYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qtzfVeeP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f67si1833152pfb.36.2019.05.01.16.03.01; Wed, 01 May 2019 16:03:17 -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=@google.com header.s=20161025 header.b=qtzfVeeP; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726191AbfEAXCL (ORCPT + 99 others); Wed, 1 May 2019 19:02:11 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:54888 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfEAXCL (ORCPT ); Wed, 1 May 2019 19:02:11 -0400 Received: by mail-vk1-f201.google.com with SMTP id r132so238501vke.21 for ; Wed, 01 May 2019 16:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=De7JrG6+3XL344zZMScSqunmKbgZceVjMJC0FL9AbxY=; b=qtzfVeePMbJhJqE+Yf+Kv1DhoZE9ng7nvFaWF8RJXgdCikBdWv36SI916RGwYzUukq xZ9iRq7CanllZWM7N5EMvSrH76h/QHHPUoEYCnmM+oUL1rzrZdP/C9kf6bQfkkH2oii8 V97WCJiEG/EbkMT96CrHZ3ULLAQCRx09BXRHAZU8A+nmmtZPD4qqi9tcI9XX7ENyOW6Q pByKUepLMJrt85M4mkzTyPvyDYRRbm2pwYxrVTb6Gm/Oqz+saBFL/hmmcJKeXHcDy2/O 6eNpA52lwMEF/MP27yaxHbVokdjjs1RKVkQH0OPZY00rCv9fgG3G1mGLf74KJ8HBy8CY U+lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=De7JrG6+3XL344zZMScSqunmKbgZceVjMJC0FL9AbxY=; b=g/R4QVtriEDzxTix5VaOkWxFO1ZV8bB735D3XAiG3qg5q3MRzYRB2f1PNM34x5qoO/ SqoHedHFJEEgFh9w1whD9QVyS3/RfwM0u+QIgZdhnQaicxDNpz7Lu0kjvPRohnc/fIGf SPcXs6T2mDK5FS98zqtewgP9Xsm7sL1R2Z9T2J16mYNQGrx3kBgENhgumUMRvlxSEqib LFCSil4aiERC/xbUE2JeZZbBDirTRVWfi2ba6IV+N45MRRB+BqQYotzFnkBTQXnPOWbg C++a+QBKOQSLRK3ECRbQ5Fghit8KxtiNOUmULIHYi5PUR5r9YLepMvYKZCBMrTK5dXXR bBYw== X-Gm-Message-State: APjAAAUeVvC/5O0eF/JZPQOvF4OOvvNQfceSz2L0mIy8Pwf+CEt0xXEM g3bydVank9Oagargqae6ZbKtctQ+l6ZHGat3z7Jcmw== X-Received: by 2002:ab0:20a1:: with SMTP id y1mr213208ual.101.1556751729917; Wed, 01 May 2019 16:02:09 -0700 (PDT) Date: Wed, 1 May 2019 16:01:09 -0700 Message-Id: <20190501230126.229218-1-brendanhiggins@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.593.g511ec345e18-goog Subject: [PATCH v2 00/17] kunit: introduce KUnit, the Linux kernel unit testing framework From: Brendan Higgins To: frowand.list@gmail.com, gregkh@linuxfoundation.org, keescook@google.com, kieran.bingham@ideasonboard.com, mcgrof@kernel.org, robh@kernel.org, sboyd@kernel.org, shuah@kernel.org 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, dan.j.williams@intel.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, richard@nod.at, rientjes@google.com, rostedt@goodmis.org, wfg@linux.intel.com, Brendan Higgins 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 ## TLDR I rebased the last patchset on 5.1-rc7 in hopes that we can get this in 5.2. Shuah, I think you, Greg KH, and myself talked off thread, and we agreed we would merge through your tree when the time came? Am I remembering correctly? ## Background This patch set proposes KUnit, a lightweight unit testing and mocking framework for the Linux kernel. Unlike Autotest and kselftest, KUnit is a true unit testing framework; it does not require installing the kernel on a test machine or in a VM and does not require tests to be written in userspace running on a host kernel. Additionally, KUnit is fast: From invocation to completion KUnit can run several dozen tests in under a second. Currently, the entire KUnit test suite for KUnit runs in under a second from the initial invocation (build time excluded). KUnit is heavily inspired by JUnit, Python's unittest.mock, and Googletest/Googlemock for C++. KUnit provides facilities for defining unit test cases, grouping related test cases into test suites, providing common infrastructure for running tests, mocking, spying, and much more. ## What's so special about unit testing? A unit test is supposed to test a single unit of code in isolation, hence the name. There should be no dependencies outside the control of the test; this means no external dependencies, which makes tests orders of magnitudes faster. Likewise, since there are no external dependencies, there are no hoops to jump through to run the tests. Additionally, this makes unit tests deterministic: a failing unit test always indicates a problem. Finally, because unit tests necessarily have finer granularity, they are able to test all code paths easily solving the classic problem of difficulty in exercising error handling code. ## Is KUnit trying to replace other testing frameworks for the kernel? No. Most existing tests for the Linux kernel are end-to-end tests, which have their place. A well tested system has lots of unit tests, a reasonable number of integration tests, and some end-to-end tests. KUnit is just trying to address the unit test space which is currently not being addressed. ## More information on KUnit There is a bunch of documentation near the end of this patch set that describes how to use KUnit and best practices for writing unit tests. For convenience I am hosting the compiled docs here: https://google.github.io/kunit-docs/third_party/kernel/docs/ Additionally for convenience, I have applied these patches to a branch: https://kunit.googlesource.com/linux/+/kunit/rfc/v5.1-rc7/v1 The repo may be cloned with: git clone https://kunit.googlesource.com/linux This patchset is on the kunit/rfc/v5.1-rc7/v1 branch. ## Changes Since Last Version None. I just rebased the last patchset on v5.1-rc7. -- 2.21.0.593.g511ec345e18-goog