Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp815247pxj; Fri, 7 May 2021 22:58:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsJMLek5+HPRauYZahRWTd0LB1NyIbvI2NPlpY7BWE+fScFabgywYHmBo1zfyLiA1dpB0E X-Received: by 2002:a63:ba49:: with SMTP id l9mr6327700pgu.421.1620453479967; Fri, 07 May 2021 22:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620453479; cv=none; d=google.com; s=arc-20160816; b=s8VeTROS0vfbVyNx8v+PewxqEtLm5F8ZyyddDJuPkjch86HFtIw5WLRHA4elZiekUh diB5D1MQ/kra9KeQoZTw+zl183zegD/mnqXwBfMHbtLnXqVVsq2BcYCcE98UdU/IiKDi CSIs+rp25GSmOyOig1GOR0QzB/XPhJztBLlUcipQwlURgTIEE9F13mU/8ukfztd5SPKE WaCOHsXAkYzGCfU5XgTbaNydNLOaX/ogirDI4aUeTNls7k1k8oOB25hPR6Pr2k3XRFyY 2UBn3Xc5lP/skdAaiH7fC0g6n9dNPqzRj1lv4iQ/PMK2kk3HSX1/Cu3EYx6Em13QXHeN Jk8A== 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=vosraxFkn00s8YK0Ok8yeIjfxvEi7SrAy1o6wfrSSnU=; b=EROh8KKE8D+b2eZIA+QHwT8tVbCJoIiP1vpIlyadkw1nNuicBqPWX/Thv/G7F6MuuO JW4kfQbXH1WqnYWMNPjyS8OJbVGkYiwzwX//E5DmpYxb2fJu3SBp3KBzCABSxpCUigkL xTVlsX6S8JvDxCJ+7JhtAjnsVgMNCD9jSs7q33bGiRHRJL3xHgz2CCHrksKeLMYk6k9B F2wO+gd4S3ssbtmLIlLCJm6qLVSKZBvPvQ2yeVJhE1dfm6IHeUp/9RrzFAQmuNkhIzwG 4qz9GDa1k16BM10zFQ7qnc/TuG9mzBZ3KvehOf1SVagQuTANeo3VChU5Vc6bKqccTnE2 iZeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="nAW/nrD0"; 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 m21si17373686pjv.116.2021.05.07.22.57.45; Fri, 07 May 2021 22:57:59 -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="nAW/nrD0"; 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 S229481AbhEHF6I (ORCPT + 99 others); Sat, 8 May 2021 01:58:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbhEHF6H (ORCPT ); Sat, 8 May 2021 01:58:07 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65949C061574 for ; Fri, 7 May 2021 22:57:05 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id s8so11272653wrw.10 for ; Fri, 07 May 2021 22:57:05 -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=vosraxFkn00s8YK0Ok8yeIjfxvEi7SrAy1o6wfrSSnU=; b=nAW/nrD06ohhWs8zI0KsLLNcIpeVty0/9GEIig5WDBi4rrd0p0X3mInaOSV0zXIcrG K9dbja5C6Lx3QXIT9oH0H2FMmIAlWyjFEX4qD+d6LCISNAC51p4vuoyTtU8lT0d/Z7h5 krPTTMy8zml1kdXqnQWQzV3CQvNhg5ibSkr+2fJ0WSAH1Eaeh0sFOyqCFFEUQL1plWKB QK/X5ZAm9n1ZFnOJCdbRYT3NgnZsr+0yInot8xT5q0zGvll57nLBPn1Al+SV7F4a29VZ m26kM5D86/u74/mQuf1TrZMz2QWP4iogT/vcD78s4HelLZ1a8q58hZQwXWSb5BjJoXAD 1oUw== 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=vosraxFkn00s8YK0Ok8yeIjfxvEi7SrAy1o6wfrSSnU=; b=BWiZTT6Y3Q2q6cKjvRXpJugIiWs210C4i9lLfbyOZkA8im0CcBJi/fakJi4fD2AV6U hXVXLkLJPWVj9u35c+HlweLx36I6iPwWRDWfaGyhITj+yelHrlmAds3kHwt4wiTGvshw xdh+jrhdZXUbEJx4UtXfivxmfLKNfHQr229VmZSvz9RU99fs+BsbaszetIe/C2PQqMOI D6ChFq2HhxLNxP/4DiCZaNJOwZKOQowJqzbxfBVoWiy40Ot0JuXkOob7z5WUwoi/ovF6 wM2Vs7iskVZq4CD87v2AokuibK7M2KkkedKs7re1vf3IvnLTPiyE3qZ+XAmZlHrNFnK9 i/eA== X-Gm-Message-State: AOAM533Ej0IjGxqaPumvU/aXtbmDLeY+kBuiXoXh2Zn3ULit08hgeCzd ZIQ4ULN3aJrGjgmkj5YT8+CfUOkBN292kpCVY1FRrQ== X-Received: by 2002:a5d:500d:: with SMTP id e13mr17131455wrt.39.1620453423849; Fri, 07 May 2021 22:57:03 -0700 (PDT) MIME-Version: 1.0 References: <20210507050908.1008686-1-davidgow@google.com> In-Reply-To: From: David Gow Date: Sat, 8 May 2021 13:56:52 +0800 Message-ID: Subject: Re: [PATCH 1/2] kunit: Do not typecheck binary assertions To: Brendan Higgins Cc: Daniel Latypov , Shuah Khan , KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 8, 2021 at 4:05 AM 'Brendan Higgins' via KUnit Development wrote: > > 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. > Whoops -- it was the issue in patch 2 that was causing the error. This is indeed just a warning. I'll send out a second version with a more accurate description next week, assuming no further issues appear. > > 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. > > -- > You received this message because you are subscribed to the Google Groups "KUnit Development" group. > To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/CAFd5g44bot7S-Ya7s7QxnKfXHcy8WxUcNPsZuw_qWMaAQbqLCg%40mail.gmail.com.