Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4642657ybc; Tue, 26 Nov 2019 12:11:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxyVvdTSnUKnR4IGjUWFTvdC4n2hHc5C2CjBMuI+SVvK6pqQKmGIVdaVizf2Is39ixMDoSa X-Received: by 2002:aa7:d294:: with SMTP id w20mr21090834edq.134.1574799079189; Tue, 26 Nov 2019 12:11:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574799079; cv=none; d=google.com; s=arc-20160816; b=M4NaOUkTC763DZConUmW3mWOV33GP3neYA5i2rs+7X07JGoAZhTzRWXizbHW/w10t3 48B4rX5pozNVVwUbJj5AxpTzFqxX6mti1IGmdtpubSPeDVcU3MIxh7D3AHbInfguB5Eu xOnxGcWsre19BaTAFtsmXbNw6PPmr7Id6VX4sqf6KUo6i4IHBnGKd4EwsJvAo+M+P4t9 HZFDHV1W+sQwTiQHqtA0sj3NRf4e0dHzKG7DVCRR9jSRHm3bnvpPSjNABCBQTgsLtahD v0QGYdQcByr01pQNoHHQiOewMrblswuNUK0CKpMIg/uBt6uOE2iUgMt09XobWVDvpnmv v0pQ== 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:dkim-signature; bh=a6GxmKDvAw1vLMbaYf9F6fSma425avbz24o+1odQiW8=; b=jlSvPMmazj4Z0Z2DobnCpPZEyJliajRZN4NxFNG1eMcFa3xQy/ByMepZtk2CKPcD2M 2yfNjAxN3qToBRorVchPy3sFa9JJGUcu3u9vdUBGGv1rgYwppZuBynySUOe/BGedl45M sEdsuU9nPgW1Iizt3eAJx4FSCZfVj60Nzsv2nT1VMI8XJvcVi3c2BfNoMM2QckiWeas7 tLXNR7hb2hGZrJv29GaybsylnfmxlMfbPEMJiyJnAT1BeaKkn++/CwXxeVNSZlW1Dn4Q xw50ZnQKgT9jgvgs5W2uvzN2lgWOBIgVyjcPb00la6UPcgE6YpdnzaovbvuYuRhfWoy3 8mLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kYQJO1E4; 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 g27si8817202eda.313.2019.11.26.12.10.53; Tue, 26 Nov 2019 12:11:19 -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=kYQJO1E4; 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 S1727047AbfKZUHd (ORCPT + 99 others); Tue, 26 Nov 2019 15:07:33 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44821 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbfKZUHc (ORCPT ); Tue, 26 Nov 2019 15:07:32 -0500 Received: by mail-pg1-f195.google.com with SMTP id e6so9522632pgi.11 for ; Tue, 26 Nov 2019 12:07:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a6GxmKDvAw1vLMbaYf9F6fSma425avbz24o+1odQiW8=; b=kYQJO1E4W2uuHPL5Xt55wCQ3MWajDBCrm0jA7QZ4dZUbiy0qykLO8o+veIsaLEoxXt pfjt817CQHNp6x+6IYPeeQmlFOtcfeIKHgQNugJd3twsD93I50yh8E0fYn0cLrJ1rlPn sooicOrr2ZAZmlh8o1KYEIqSBd2YEObh3DNg304EXxtvw3bYk3FywkGYpp3pFvdooshg TDdpxONLvxs5yE9jjCutSaWrN4ZdvyZgBr2G6TI/LMbhmdftq3K+5rpVuCHgb3pzkqcF iICNCzYY5a3tDZpRBnNgpXtApSnFF15lDLdvJwSQ9aZ/NBFBxA/NMHBa+gnXAFtkRS61 AuMQ== 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=a6GxmKDvAw1vLMbaYf9F6fSma425avbz24o+1odQiW8=; b=WTGa+gZpKmcyh6MVmnoV1v8nniJsxLfGbFp1p3Ron2HzMQwoY8uDTHbQ13ZYujfxAS IhM7kWKL/FNPgD5jSJnxio6h8eYzqgBba3y/uCUu9tnHqdzQ3CLjRF/Si0Ym1jeQC/C8 sns+umfP6NJTQtkeTQE7Oa7wkP08Dyh6n/LXHfE8OZvj7ca61EOnwfc/5O4TW1uOrnF/ Fngv9hdmtZ2dF/ccjnet9MbtfsbqfnjOyueeEcBOE7YNHnXAFjJ0o9Oiia8e25JGotn+ 8tdsvyl4vq5Lu2gTgbnyKad8ZukVXvopnjsUkMV+VWJi3zoSbLydnlQAH6JaPumR3iqq xcFA== X-Gm-Message-State: APjAAAXxzZef/GNJkLbnZVyrybswbK7niqJe0vYti0rGV1zvlJUQc/Ku +Hc/8N2ixOebq0gpl70ngxSIEXRKEtHJVTb3k+nIlA== X-Received: by 2002:a63:4721:: with SMTP id u33mr274648pga.159.1574798851462; Tue, 26 Nov 2019 12:07:31 -0800 (PST) MIME-Version: 1.0 References: <20191126193313.44181-1-heidifahim@google.com> In-Reply-To: <20191126193313.44181-1-heidifahim@google.com> From: Brendan Higgins Date: Tue, 26 Nov 2019 12:07:20 -0800 Message-ID: Subject: Re: [PATCH] kunit: test: Improve error messages for kunit_tool when kunitconfig is invalid To: Heidi Fahim , David Gow Cc: shuah , "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , Linux Kernel Mailing List 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 +David Gow On Tue, Nov 26, 2019 at 11:33 AM 'Heidi Fahim' via KUnit Development wrote: > > Previous error message for invalid kunitconfig was vague. Added to it so > that it lists invalid fields and prompts for them to be removed. Added > validate_config function returning whether or not this kconfig is valid. > > Signed-off-by: Heidi Fahim Reviewed-by: Brendan Higgins Tested-by: Brendan Higgins Looks good to me other than one minor nit below. > --- > tools/testing/kunit/kunit_kernel.py | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py > index bf3876835331..010d3f5030d2 100644 > --- a/tools/testing/kunit/kunit_kernel.py > +++ b/tools/testing/kunit/kunit_kernel.py > @@ -93,6 +93,19 @@ class LinuxSourceTree(object): > return False > return True > > + def validate_config(self, build_dir): > + kconfig_path = get_kconfig_path(build_dir) > + validated_kconfig = kunit_config.Kconfig() > + validated_kconfig.read_from_file(kconfig_path) > + if not self._kconfig.is_subset_of(validated_kconfig): > + invalid = self._kconfig.entries() - validated_kconfig.entries() > + message = 'Provided Kconfig is not contained in validated .config. Invalid fields found in kunitconfig: %s' % ( nit: Rather than "Invalid fields found in kunitconfig", how about something like "Following fields found in kunitconfig, but not .config:"? > + ', '.join([str(e) for e in invalid]) > + ) > + logging.error(message) > + return False > + return True > + > def build_config(self, build_dir): > kconfig_path = get_kconfig_path(build_dir) > if build_dir and not os.path.exists(build_dir): Thanks for the patch!