Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp110054ybl; Mon, 27 Jan 2020 23:21:32 -0800 (PST) X-Google-Smtp-Source: APXvYqzDp8PA3LrDovFau5JiJAs5bmHcAmy0DXd1Rc9DsB8/kn4dUT0DfGdKJL6pECcIIMS66ssc X-Received: by 2002:a9d:7757:: with SMTP id t23mr15899582otl.315.1580196092111; Mon, 27 Jan 2020 23:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580196092; cv=none; d=google.com; s=arc-20160816; b=isIb47z6Z2EHI0wbJpB4ZJTRpquf78MugrPwQO1Ct40mSp1u1SJoR4tsU3LDsWz664 Nq4RcRa9evJBmHPx/vvRZP7M99ULmKs3GZ91OT/DDlSiwA+0/ISXq9Vfpqr6t3zurquG PbgOPUVvCMbkomkeQ61pYSn/U/ARnrHaBL5E40qNiR3Ke7uSLkrN6JdusodG5nZdDRt7 aUFH1IlDC6S9P1q7jTwspDHeSoWJhR55gjzzz4WYD6fJ3MIbGlXKGvh4p4Kym7zrmJHF /LXpohWjN5c4F20jTV4Ppdztt1EEgigxfX71TxWii4kiiTVi4/rq+L8XF0nxjRcnOU0j wzPQ== 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=geIt7NTj15qXn0Pd7vHPLbcleORDZqpFgUWoIN42PEM=; b=wQIpgNYwOjjjIRDu8OTOyj9f1+bcnqo4iBMkSlAA5ZqVTMVtgQftKijgSum4u51gh1 X3o5GUxvKxTM0nlfH18Xk/+C9RPXRrOML179HPHtK+z/P71yI9jx8gyfj/4Sc85oYhRp yXozoP9UKFp9z3iwnnDwCYN4h+P+uOtA1Zadk4no0A6HkARSeIEUzAAIpvcNiZaYptN2 tJYqUO9Fffm68LJu8656r9mOtW9HVkHf07EO6MHcU41fQvCgg9mYDQqytTErV5FP84i4 liw3x/KzDEdsLd5a75KdbX1OQhVwspmfBrbhi5fHGSvbRftrgx7hHrDcn3Gpp9NmbbNy GdkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QvEXh6vx; 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 g26si8414715otk.324.2020.01.27.23.21.18; Mon, 27 Jan 2020 23:21:32 -0800 (PST) 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=QvEXh6vx; 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 S1726007AbgA1HUR (ORCPT + 99 others); Tue, 28 Jan 2020 02:20:17 -0500 Received: from mail-pl1-f202.google.com ([209.85.214.202]:35070 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbgA1HUQ (ORCPT ); Tue, 28 Jan 2020 02:20:16 -0500 Received: by mail-pl1-f202.google.com with SMTP id v24so5186318plo.2 for ; Mon, 27 Jan 2020 23:20:16 -0800 (PST) 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=geIt7NTj15qXn0Pd7vHPLbcleORDZqpFgUWoIN42PEM=; b=QvEXh6vx1uu5+MqSyqNpYaqM0+WH+gnl/II2vETCPrUPXtj+INkYpNvum2xVSiePqx t2/NWdcygIobxjQwa6b1OnLgvNTscgcCzwk3Kw36NhrFIWMkNB+UMzrLz77/vEJkezdN 15guaSPb7ab1mnGvB+LtN0ErleZfv4RBuk2g7w4q3DMM5WCH/e9o2GfN///ZX1kp+P2k 9OtN5uEDF4qS+QZEf323rO0sMLIeC/Xw2+dPQ0tCmivr5rQ4PxRJoq7SiQXxSHuWxBpw M/ivCrQQeOhdoSDO7BN4ynNQSAV+TGlgrrSPB/kV0uDwtRpyqiwvZ/W28+FQICH5XA89 pVVA== 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=geIt7NTj15qXn0Pd7vHPLbcleORDZqpFgUWoIN42PEM=; b=rlF0elF/7gGoeQ9dX1jgENT+zfL/D/wg6ZB0xE9ixC/QhK0OW3OzTa5RibzV/pUUSU 8DWRv5ADMn8Y5oxpO6ZwtS6O0CXulmrX5fWUcnQ44BfLLuRsVzJ3j7UrC+Em+pR6pCtS 88i6CXY2O9FdwJJK9U7YpLl3ZBswezV+pao/wj5tR3S3LRpP6p4qUaxYdmJFiM1sH+jx bsURCdC0MMYlPb+4J0bMdMUXcJBBl36RvHG4ZzrZQI1WpyanTRjEAAhAYIPEj8E0MC7l LLEzyzL9HrD+BHiwi7zUH7J74f6HfcPbNiGCIMeg+qa20FTd8gopr3bMaker4ovgPwol BikQ== X-Gm-Message-State: APjAAAVewQ3AJsr5IaN++qMT7jMKkDbuHeOs0jVSiXJjrDlrWFLiZpof fsHcskWm0woRIzBggZXohKZ13c6RXVjZujfKNe3ORw== X-Received: by 2002:a65:4b89:: with SMTP id t9mr9307336pgq.102.1580196015485; Mon, 27 Jan 2020 23:20:15 -0800 (PST) Date: Mon, 27 Jan 2020 23:19:55 -0800 Message-Id: <20200128072002.79250-1-brendanhiggins@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog Subject: [PATCH v1 0/7] kunit: create a centralized executor to dispatch all KUnit tests From: Brendan Higgins To: jdike@addtoit.com, richard@nod.at, anton.ivanov@cambridgegreys.com, arnd@arndb.de, keescook@chromium.org, skhan@linuxfoundation.org, alan.maguire@oracle.com, yzaikin@google.com, davidgow@google.com, akpm@linux-foundation.org, rppt@linux.ibm.com, frowand.list@gmail.com Cc: gregkh@linuxfoundation.org, sboyd@kernel.org, logang@deltatee.com, mcgrof@kernel.org, knut.omang@oracle.com, linux-um@lists.infradead.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, 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 ## TL;DR This patchset adds a centralized executor to dispatch tests rather than relying on late_initcall to schedule each test suite separately along with a couple of new features that depend on it. ## What am I trying to do? Conceptually, I am trying to provide a mechanism by which test suites can be grouped together so that they can be reasoned about collectively. The last two of three patches in this series add features which depend on this: PATCH 5/7 Prints out a test plan right before KUnit tests are run[1]; this is valuable because it makes it possible for a test harness to detect whether the number of tests run matches the number of tests expected to be run, ensuring that no tests silently failed. PATCH 6/7 Add a new kernel command-line option which allows the user to specify that the kernel poweroff, halt, or reboot after completing all KUnit tests; this is very handy for running KUnit tests on UML or a VM so that the UML/VM process exits cleanly immediately after running all tests without needing a special initramfs. In addition, by dispatching tests from a single location, we can guarantee that all KUnit tests run after late_init is complete, which was a concern during the initial KUnit patchset review (this has not been a problem in practice, but resolving with certainty is nevertheless desirable). Other use cases for this exist, but the above features should provide an idea of the value that this could provide. Alan Maguire (1): kunit: test: create a single centralized executor for all tests Brendan Higgins (5): vmlinux.lds.h: add linker section for KUnit test suites arch: um: add linker section for KUnit test suites init: main: add KUnit to kernel init kunit: test: add test plan to KUnit TAP format Documentation: Add kunit_shutdown to kernel-parameters.txt David Gow (1): kunit: Add 'kunit_shutdown' option .../admin-guide/kernel-parameters.txt | 7 ++ arch/um/include/asm/common.lds.S | 4 + include/asm-generic/vmlinux.lds.h | 8 ++ include/kunit/test.h | 82 ++++++++++++------- init/main.c | 4 + lib/kunit/Makefile | 3 +- lib/kunit/executor.c | 71 ++++++++++++++++ lib/kunit/test.c | 11 --- tools/testing/kunit/kunit_kernel.py | 2 +- tools/testing/kunit/kunit_parser.py | 76 ++++++++++++++--- .../test_is_test_passed-all_passed.log | 1 + .../test_data/test_is_test_passed-crash.log | 1 + .../test_data/test_is_test_passed-failure.log | 1 + 13 files changed, 217 insertions(+), 54 deletions(-) create mode 100644 lib/kunit/executor.c -- 2.25.0.341.g760bfbb309-goog