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-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 078AC1F62E for ; Thu, 17 Jan 2019 10:18:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbfAQKSi (ORCPT ); Thu, 17 Jan 2019 05:18:38 -0500 Received: from mout.gmx.net ([212.227.15.15]:40425 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfAQKSh (ORCPT ); Thu, 17 Jan 2019 05:18:37 -0500 Received: from [10.49.97.215] ([95.208.59.108]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0M4002-1h2I7x3RII-00rcSW; Thu, 17 Jan 2019 11:18:31 +0100 Date: Thu, 17 Jan 2019 11:18:15 +0100 (STD) From: Johannes Schindelin X-X-Sender: virtualbox@gitforwindows.org To: Johannes Schindelin via GitGitGadget cc: git@vger.kernel.org, Junio C Hamano Subject: Re: [PATCH v3 15/21] tests: include detailed trace logs with --write-junit-xml upon failure In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K1:tnIZo/xEPUHED2kE1Tc4j1vQ+wZFb3uPsBIol8oRmmq0JwTRHVD g4KFuBwBNpoYnKUTiFA8U6JrPXPcNWPZqAJbrw5TwstNQe1roOG73RsT1v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RGwFjXey1jekotOISsgx6HN7aHkXb0P/5gZQrPLTJu6H2FZsFGfjYj2 zWzKwVwHikA== Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi, On Wed, 16 Jan 2019, Johannes Schindelin via GitGitGadget wrote: > diff --git a/t/test-lib.sh b/t/test-lib.sh > index e9782b6b32..f5371f505a 100644 > --- a/t/test-lib.sh > +++ b/t/test-lib.sh > @@ -503,8 +503,18 @@ test_failure_ () { > junit_insert=" junit_insert="$junit_insert $(xml_attr_encode "$1")\">" > junit_insert="$junit_insert $(xml_attr_encode \ > - "$(printf '%s\n' "$@" | sed 1d)")" > + "$(if test -n "$GIT_TEST_TEE_OUTPUT_FILE" > + then > + cut -c "$GIT_TEST_TEE_OFFSET-" <"$GIT_TEST_TEE_OUTPUT_FILE" Ooops. This does not work. The intention of this patch was to remember the file size of the tee output file at the point when the previous test case was done, and skip that part (so that the first thing the user sees is the detailed trace of *just* the failed test case, with the complete trace being attached as `Standard_Error_Output.log`). However, I totally misunderstood that `cut` is *always* line based. So this `cut -c` (which should have been a `cut -b` to begin with) is just plain wrong. And since there is no easy Unix shell tool to just skip a bunch of bytes (`dd` comes close, but you have to abuse the buffer size to specify the number of bytes, or use buffer size 1, neither of which I like), I will just add a dozen lines to the `test-path-utils.c` to get problem fixed. > + else > + printf '%s\n' "$@" | sed 1d > + fi)")" > junit_insert="$junit_insert" > + if test -n "$GIT_TEST_TEE_OUTPUT_FILE" > + then > + junit_insert="$junit_insert$(xml_attr_encode \ > + "$(cat "$GIT_TEST_TEE_OUTPUT_FILE")")" > + fi > write_junit_xml_testcase "$1" " $junit_insert" > fi > test_failure=$(($test_failure + 1)) > @@ -872,6 +882,11 @@ write_junit_xml_testcase () { > write_junit_xml "$(printf '%s\n' \ > " " "$@" " ")" > junit_have_testcase=t > + if test -n "$GIT_TEST_TEE_OUTPUT_FILE" > + then > + GIT_TEST_TEE_OFFSET=$(test-tool path-utils file-size \ > + "$GIT_TEST_TEE_OUTPUT_FILE") > + fi > } > > test_done () { > @@ -1153,6 +1168,11 @@ then > date +%Y-%m-%dT%H:%M:%S)\"" > write_junit_xml --truncate "" " " > junit_suite_start=$(test-tool date getnanos) > + if test -n "$GIT_TEST_TEE_OUTPUT_FILE" > + then > + GIT_TEST_TEE_OFFSET=0 > + GIT_TEST_TEE_ERR_OFFSET=0 Also, in case anybody wonders, this `GIT_TEST_TEE_ERR_OFFSET` variable is no longer used, and I should have removed it. Oh well, I will just queue up the fixes in preparation for v4. Ciao, Dscho > + fi > fi > > # Provide an implementation of the 'yes' utility > -- > gitgitgadget > >