From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 5CCA11F5AE for ; Tue, 23 Jun 2020 18:40:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387466AbgFWSkN (ORCPT ); Tue, 23 Jun 2020 14:40:13 -0400 Received: from cloud.peff.net ([104.130.231.41]:40662 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387459AbgFWSkN (ORCPT ); Tue, 23 Jun 2020 14:40:13 -0400 Received: (qmail 12985 invoked by uid 109); 23 Jun 2020 18:40:12 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Tue, 23 Jun 2020 18:40:12 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19577 invoked by uid 111); 23 Jun 2020 18:40:12 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Tue, 23 Jun 2020 14:40:12 -0400 Authentication-Results: peff.net; auth=none Date: Tue, 23 Jun 2020 14:40:11 -0400 From: Jeff King To: Denton Liu Cc: Git Mailing List , Junio C Hamano , Taylor Blau , Johannes Sixt , Eric Sunshine Subject: Re: [PATCH v5 0/4] t: replace incorrect test_must_fail usage (part 5) Message-ID: <20200623184011.GC1444619@coredump.intra.peff.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Jun 23, 2020 at 06:28:01AM -0400, Denton Liu wrote: > I've taken your suggestions and rerolled the last patch. Notably, I > combined $before and $command into a single function and then passed in > `test_must_fail` as the second argument if it's expected to fail. I also > decided to use a helper function to reduce the duplication of the > calling logic but it's still a little verbose because I opted to make > use of argument passing over global variables where possible. > > One thing that I'm leaning towards is completely removing $after. We can > combine $after with $command like I did in the first few iterations of > this series and just write it as: > > git_test_thing () { > # before... > $2 git do-the-thing "$1" && > if test -n "$2" > then > return > fi && > # after... > } > > but I'm also okay with leaving it as is. Yeah, as soon as I saw "combined $before and $command", then I wondered why we needed to split anything (since clearly we're passing responsibility to handle must_fail to the callback function). So I think we should either have the full before/command/after split, or have a single callback function which understands that it has to respect "$2" as a prefix). I'm OK with either. I do like both of them better than the magic $OVERWRITING_FAIL thing, but this series seems to be taking a lot more energy than I think its outcome is worth. Let's resolve it somehow and work on something more exciting. ;) > Also, one problem that's present is that for tests that use > test_submodule_switch() and test_submodule_forced_switch(), $command > will be listed as git_test_func, which might make debugging more > difficult. I think I'd prefer the version we currently have queued for > this reason (and why I did the whole song and dance of $OVERWRITING_FAIL > in the first place), but if you think that this is fine, I'm fine with > this approach as well. I agree it's not ideal, but I don't think it's too bad. There are lots of tests that have output you can't just cut-and-paste due to code generation, helper functions, etc. -Peff