Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp775167iog; Fri, 24 Jun 2022 13:56:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uY2LOFNs/czmXDxcwbKrUD7Nd1sOSn4RZgEphOe68WPtunD5iQDFToNisqyk9VuZB5VL8i X-Received: by 2002:aa7:81d4:0:b0:525:1ead:17af with SMTP id c20-20020aa781d4000000b005251ead17afmr994300pfn.71.1656104217593; Fri, 24 Jun 2022 13:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656104217; cv=none; d=google.com; s=arc-20160816; b=wSUwI3rCrB8dH4/vy5Z5Cw6MwroXEWvp1WF/4gOtSndIx9eoMkX5n6bv78wgEcWv0c o+zZju1OCLItk5/DQotcXCXqSRzHFjQuHa6iroApgkXke7P3ZG68FadMkZGVniXgo6to gjvvIy1x8pWXQo90hO1X3gPCh88pmqMaszfCjBuPhOv1KVgw6j5i5cGVtCLI+n/+5i3r Jmq86V3WMwPDwWlmOc25MSQNqHOlx61WUEH1mv2llgCmsgyaEgNFxTlWT6UkfZoiNEoC lM5MDG18RacP7ucBEV3Qp7c9KBwDHYG7sWVEzqvoxFOCfZtkZnF4YlmbeABlNMf2FIF6 4qqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QaqOm6r23E52n00DqSK54VWl2Yplfk1mrrUTg1NuA0Q=; b=ksTCsfxzlNxFBBnlQ8c3ujQBJ6NfFi7VJPR28jW9Us90SQxxVujmUidqj6DTIlAa05 L/2/S9nMPaNVuJIvQpAEGLSU7JHehTEsCtsgv9USP4ZR+SYhSTfHa45TU7p+NVrnSiUE pZ85WKPDtJL/aTF2Fo0pGGTxhJK9V+XZ+gW8wvEHZghyzCjLwwXzd1pelfg4oJUzMZM5 EdPgf7Zvb36/PZamOLhCeQ1sPH8NNkuVPe4UxhCYFXkrrHp23dqRqXwAVIzK5mqCCwmF 7j41ENmCfK7TOb2hqHRemVNxW6wRFQH9AXrXV4X0R10SjH2xxo5mfHxIqJUsQc2odWep JfHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=TVZPEDxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a17090aa88200b001ecc45fc899si3552340pjq.65.2022.06.24.13.56.45; Fri, 24 Jun 2022 13:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=TVZPEDxt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231438AbiFXUYg (ORCPT + 99 others); Fri, 24 Jun 2022 16:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229912AbiFXUYf (ORCPT ); Fri, 24 Jun 2022 16:24:35 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5428A7C875 for ; Fri, 24 Jun 2022 13:24:34 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id t5so6968866eje.1 for ; Fri, 24 Jun 2022 13:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QaqOm6r23E52n00DqSK54VWl2Yplfk1mrrUTg1NuA0Q=; b=TVZPEDxtfS05fPbh8C5E5tf1DF+QrfO2B4EhpbHdnJb7NHfSX8s+jM0td0YNOCim8Q 3U2R1Tfe7es0drm9BXWVihEXLWf9kXLQd3By4K5WPPMF3Mr2EcVbUHX9FALfxYILOgbQ HmCjm86JoKw0r19/SI2xcExQPg3Y/Xj6RyB3JK/mf061FdBnO/aL8s6aV7fNoix9BLgK RQmS9nBAFyIC+ORoxBRAVDZQ08f/1hqfxXTCNHrCL8rfHlNEzXW3HqRjKcP3XB4TVFmX +XQyC5cH47V0ZYERMP8D5+MLQ5vQvVY1DKtNtnqOGGlM3ysw8PPlLqbeEPGAN/UafsKj iYDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QaqOm6r23E52n00DqSK54VWl2Yplfk1mrrUTg1NuA0Q=; b=MPUN3Zw1rlFPArdPeWvRkNXqrfG46E65eRzZQGn6d1oiOlYINrfsCirHW5Pqoi/rOR HQ+Z4ll1dry7B1G4TmDcKUSaWjSZrmEqL/jbJhbEziBlNVSWs9zbndqQ/dMDYHf/fWIY csf13xyTKjzXjA8GFMcVB8Hksq87AP1VEU8TaHajHvxbSQMMoyxpmx5po0QFyH4cRYfX KKkYQS68gRTjFvUXa1yGy6qgOUeydIvpahDFusSw9odnquyhBxvcB8PrdygvtvqpGik0 zGMApGMVGzA3R0OH8ebA7ZckpVIaWIx0NOV95recTTW6Q8Qf2kSO11JH4jnTpSVfXNDO g5Sg== X-Gm-Message-State: AJIora8py0uVnWabUwtd3YFDUPiflCTlDuh4C/D7iJZ8o07Ol50J/+ev clXYYT52uLEm4379wJ3xBGUFvxW1EleEQEXT7zQ4XA== X-Received: by 2002:a17:906:308f:b0:709:af33:9fa7 with SMTP id 15-20020a170906308f00b00709af339fa7mr736816ejv.369.1656102272733; Fri, 24 Jun 2022 13:24:32 -0700 (PDT) MIME-Version: 1.0 References: <20220520224200.3764027-1-dlatypov@google.com> In-Reply-To: From: Daniel Latypov Date: Fri, 24 Jun 2022 13:24:21 -0700 Message-ID: Subject: Re: [PATCH v2] kunit: tool: refactor internal kconfig handling, allow overriding To: David Gow Cc: Brendan Higgins , Linux Kernel Mailing List , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 24, 2022 at 12:55 AM David Gow wrote: > > > > + def set_diff(self, other: 'Kconfig') -> Set[KconfigEntry]: > > + return set(self._as_entries()) - set(other._as_entries()) > > + > > It took me a couple of goes to realise that this was looking at the > difference between sets, not trying to set the difference. Maybe > different_entries() or something like that'd be clearer, but I can't > say it bothers me enough to be worth a new version. Wdyt about `set_difference()`? Or maybe adding a verb: `get_set_diff()`, `compute_set_diff()`? But we do want to make it clear it has set (asymmetric) difference semantics, see below. > > Then again (as noted below), the direct set difference isn't exactly > what we want, it's more the equivalent of is_subset_of(). The > follow-up repeated-kunitconfig patch adds differing_options(), which > is closer to what we'd want, I think: > https://lore.kernel.org/linux-kselftest/20220624001247.3255978-1-dlatypov@google.com/ differing_options() does not have the right semantics. For this, we do explicitly want a set difference. Context: This is the func used to print out these warnings: $ .../kunit.py run --kconfig_add=CONFIG_PCI=y ... Missing: CONFIG_PCI=y That comes from invalid = self._kconfig.set_diff(validated_kconfig) Using differing_options() to get our version of the configs: invalid = (want for want, got in self._kconfig.differing_options(validated_kconfig)) we instead get an empty list. The problem is that differing_options() only shows config options that are explicitly to different values. There's probably a way I can name these functions better to make the difference more clear. Or perhaps we should move set_diff() out of this class and have kunit_kernel.py itself due the computation. E.g. // make as_entries() "public", s/invalid/missing missing = set(self._kconfig.as_entries()) - set(validated_config.as_entries()) Thoughts? Daniel