Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp482814pxj; Fri, 7 May 2021 13:07:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0cfLzDedLUNGXupYi+fGdnffNBDAiuHPaE9BNpilMj239Zzv7K7bcDnBMbnRkZnXS/1Yq X-Received: by 2002:aa7:90d4:0:b029:28e:b912:acf with SMTP id k20-20020aa790d40000b029028eb9120acfmr12454970pfk.43.1620418029062; Fri, 07 May 2021 13:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620418029; cv=none; d=google.com; s=arc-20160816; b=eowVXewwA2bSTQOlu5J9fINbzZ4O6gXjz4am1Bv8HW2/smzIKnbtwGdKdIYwiS6XIZ 68zzVKDd8fw78/W5S7YOz6p5+n7KaJgK5trNhwKOEpHUtmpxiPzVeenb9pr9YxXXvT6d fpPdapp0ogS4tLFjIh6gBA+32x+JTMfFEAGaAPKCZz0JHP8TKN3OQMA5a00/M3pjW0g3 ZpgAC9PrE0PqrPDWjlGApYtq6RIAaErlx1piD22l0ItuY1iram4Gb38S7/tenTX4oDfU QokA47ghZb8WYrVgWr3GRatoBckdCK6izDOu+5o4vfz0KH9kbtXeIkWO5cASswmkn7oe n4Zg== 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=c3juDObqVzsjpQ4zt+KRVnMaIqtk76tzs1eXGfnrfq0=; b=C0AG43BSjjjsNj8gDV2s/JoOEDbZdVFYMD7e08BfelwyTMTf4/ts1ZXAHIh4HZSjs/ 1uy7MSU/0tt2cWhjaQxWXKwxvc6BRSFSMeQ05YaSku/3Rxyr/fdh8UUEF9uMNrLpaaQa hE7Mvj187TsjlbEp7Y7C2apVRkbDrEBxMfked7Xwl/IAsmyRNfMxI0z6hNAaIAW8rfY6 Qkbs7STexFA0PWiUJ3wcADx9JDjWSKN7FgdsHFK03NuuoKS4NAU1KOqpu4JZmJeObcW7 N4sv15oFhBtaqnqAndATZkKDCH5ddxEXBT4AfEPffcYs1xA8dYExAnAgg+dO9ik2dCWp 4d6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FqxuI7G4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id t12si7792488pgh.581.2021.05.07.13.06.56; Fri, 07 May 2021 13:07:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FqxuI7G4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230112AbhEGUG1 (ORCPT + 99 others); Fri, 7 May 2021 16:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbhEGUG1 (ORCPT ); Fri, 7 May 2021 16:06:27 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15935C061574 for ; Fri, 7 May 2021 13:05:24 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id z16so8189878pga.1 for ; Fri, 07 May 2021 13:05:24 -0700 (PDT) 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=c3juDObqVzsjpQ4zt+KRVnMaIqtk76tzs1eXGfnrfq0=; b=FqxuI7G4lXRX59JzUWXtHjI8iQkPShk8Z9b5qVLOOQTKRkJJVOSKDxSKCaiK5vMORh 5E7bzyvNmy2OKHKKEpIVkjxi0I9yNEYuMvobYYLlvn1+EUmrmvOi45s7Otq2Wnjw2CFR lQ5ZUBZvYJPnGH1bvPaqEW5vOXIAAhArW5+S+oSH4603z+3lViWx1mgQWPdBtSv223uf 3ProgKg0seuTL7ZpI0eRv1cEom3fx2mUQe2bWucvPpMTyJwqnBgVDchau2mnHWjQ1RU8 3Q0774OP9a2CS103Y6+0MBQ02OXsUOjW/6qwkqXoDFNWZagNjp6UN1L9xOd2qGvx2pgF Hv2Q== 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=c3juDObqVzsjpQ4zt+KRVnMaIqtk76tzs1eXGfnrfq0=; b=etmqX8TgzJOvakYlfhTrgfn0/xglPgI/IUaogJ3rfU8KsSqcizJYDZS+T/21WHab0m UlRfAD/9XUqBzmJs4TQFtcVzp1KKZ90v6/dMOupOt6KYCZVsYzr/5bUDqg4MCvI5xVUt Mm/M7JvnG7edLmTq14J8HEHSR2LJoC0YktV0S7tvByydxsqf9UYctEq9mJmyAxhXqgy4 cd+7v1j2OEbHGIZyGoU0WYuBWj4NqDxYZsEUXfG7JGcsCmxJlxxu4iqwrZp8GnN5aUIa i1xR6CquJLY4BeAvFzjewjzqCDrVWthbXRFoT0qOvsMkzG8Yp3oaSpKS1qPt/UQrMMtw Nm8g== X-Gm-Message-State: AOAM531xmlYrU2AU6968hShSteUoDmPFjMOhAYqHQt5i1pirtTDwG21z eTh01Yza6EjPRQKhNtv2qmbzQ1+wQMPWskwYzgABQA== X-Received: by 2002:a63:cc11:: with SMTP id x17mr11645132pgf.159.1620417923430; Fri, 07 May 2021 13:05:23 -0700 (PDT) MIME-Version: 1.0 References: <20210507050908.1008686-1-davidgow@google.com> In-Reply-To: <20210507050908.1008686-1-davidgow@google.com> From: Brendan Higgins Date: Fri, 7 May 2021 13:05:12 -0700 Message-ID: Subject: Re: [PATCH 1/2] kunit: Do not typecheck binary assertions To: David Gow Cc: Daniel Latypov , Shuah Khan , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 6, 2021 at 10:09 PM David Gow wrote: > > The use of typecheck() in KUNIT_EXPECT_EQ() and friends is causing more > problems than I think it's worth. Things like enums need to have their > values explicitly cast, and literals all need to be very precisely typed > for the code to compile. nit: I have not had the typecheck() call prevent any code from compiling, just generating warnings. I guess you can have a build set to cause any warning to be promoted to an error; still, I think this statement is misleading. > While typechecking does have its uses, the additional overhead of having > lots of needless casts -- combined with the awkward error messages which > don't mention which types are involved -- makes tests less readable and > more difficult to write. > > By removing the typecheck() call, the two arguments still need to be of > compatible types, but don't need to be of exactly the same time, which > seems a less confusing and more useful compromise. > > Signed-off-by: David Gow Looks good to me. Reviewed-by: Brendan Higgins > --- > > I appreciate that this is probably a bit controversial (and, indeed, I > was a bit hesitant about sending it out myself), but after sitting on it > for a few days, I still think this is probably an improvement overall. > > The second patch does fix what I think is an actual bug, though, so even > if this isn't determined to be a good idea, it (or some equivalent) > should probably go through. I don't remember being a huge fan of the typecheck when it was asked for either. I think I am a little bit more indifferent than you; nevertheless, I support this change.