From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 4B4D51F516 for ; Mon, 2 Jul 2018 20:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349AbeGBU60 (ORCPT ); Mon, 2 Jul 2018 16:58:26 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:45094 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbeGBU6Z (ORCPT ); Mon, 2 Jul 2018 16:58:25 -0400 Received: by mail-yw0-f193.google.com with SMTP id 139-v6so1810281ywg.12 for ; Mon, 02 Jul 2018 13:58:24 -0700 (PDT) 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=C11HWWqGkcD12T1nE2FKpZ1nXgb8nFRIZd8Ximb2OUU=; b=LOcUCFKhCo4SOkMemw7sV+DjbyjoJJdzYNBLQVFWEore9LPMNSa/QGrCA+ytBv8HNc q974RgSSX8kKgH48Evj66mPoc6PPw646H7Zy65SsNflwh2tUnnYXefyiksjKk4F6JkAL UO9NmVGT9C6s8c3GzI5qNl4Y3hPTn/MlkpbsYl7v+yw4U1MtMhvv/kLZwrFLY10AZIyt KNHUB+m8TOgcGHndnKwn1I69aMEZ/rX6YuILPPBq+qSnkAwt6fLFx7BPNXQZQWi6C7SC ik70txGIk6vpeqI2/UO6fgJrpnA6ycX5B3IFE0ZJ2uH3lK0rCXMZAIir+o65/ZLQ8ips en8Q== X-Gm-Message-State: APt69E1IoY+8xzDebPz1njjc07ZFrq5wq8A0pL7xvD5D4JO5BAhGtFTz XJVdjQ9BbC3Ox4qdOOiResRtjX+Bn3hf9h5j4Yg= X-Google-Smtp-Source: AAOMgpdzuvSO5gA1AaeCPxrvtoueJRyr3CZzqOPMkWTwKx0yuxcZ2HVJe/K8Ek3Qw0rJOgUkNNCJFglEIhix98isFDg= X-Received: by 2002:a0d:c105:: with SMTP id c5-v6mr13334602ywd.131.1530565104307; Mon, 02 Jul 2018 13:58:24 -0700 (PDT) MIME-Version: 1.0 References: <20180702002405.3042-1-sunshine@sunshineco.com> <20180702002405.3042-2-sunshine@sunshineco.com> In-Reply-To: From: Eric Sunshine Date: Mon, 2 Jul 2018 16:58:13 -0400 Message-ID: Subject: Re: [PATCH 01/25] t: use test_might_fail() instead of manipulating exit code manually To: Stefan Beller Cc: Git List , Elijah Newren , Johannes Sixt , Jonathan Nieder , Jonathan Tan , Junio C Hamano , Luke Diamand , Jeff King Content-Type: text/plain; charset="UTF-8" Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Mon, Jul 2, 2018 at 1:44 PM Stefan Beller wrote: > > diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh > > test_expect_success 'diff --no-index with binary creation' ' > > echo Q | q_to_nul >binary && > > - (: hide error code from diff, which just indicates differences > > - git diff --binary --no-index /dev/null binary >current || > > - true > > - ) && > > + # hide error code from diff, which just indicates differences > > + test_might_fail git diff --binary --no-index /dev/null binary >current && > > I am not sure why we need to be non-deterministic here, i.e. I would rather > test for success or non-success error code and not just *any* error code. > > While I think this patch is a strict improvement for the test suite, > I do wonder if we can tighten the exit code check here (maybe in > a follow up series?). I agree that such a change is out of the scope of this patch series. But, do keep in mind that the exit code of git-diff doesn't indicate only "success" or "error". Various exit codes represent different conditions; for instance, 1 means differences were found, 0 means no differences, and -1 means error. The outcome of this test is based upon output generated by git-diff, so the test itself will fail overall if git-diff doesn't produce expected results. Also, there is an entire test script (t4017-diff-retval.sh) concerned with verifying git-diff exit code, so I'm not sure we need to worry about it too much here. (I'm not arguing against a follow-up patch, though, just thinking aloud about its potential value.)