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: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 3D27D1F4D7 for ; Sat, 21 May 2022 22:19:18 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="pnpgYtzE"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347182AbiEUWTM (ORCPT ); Sat, 21 May 2022 18:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346344AbiEUWTD (ORCPT ); Sat, 21 May 2022 18:19:03 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E58AA4EF7A for ; Sat, 21 May 2022 15:19:02 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id e28so15307994wra.10 for ; Sat, 21 May 2022 15:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=iGAE3SZGJU7eojvkhG0qydiDez1X+uPg8UYp38uGbF0=; b=pnpgYtzE8eCl+OV5Z9Qsot3aHuK9I6XMOW/tXVdFGMfKAkllTarp/scudzRP9H0ued VPwdEEC6MD1MlkEpNyA0A+t/YNo+pAwNujSTbb9vwsI31hZz95aY8eJXEbR5ZCPR2LjR 8oDwzNeebh2Bv4DCjRy8BQ39RwtHidFQOYsfWjbk3d5Mu7GmLlqAZqyv6jXDebh3pnGY LY+SnkNJe4odJypUtd+kRPYKpnCXb1it5zga0neekjyQyINb96uIKNKWmH6q9QavvHwI kik1cx6gAyt3HxR7amy4fIBINZcrm62J+wHTzL23dCbrYgomVPYdCYHqrDzYComfWQ+C /fow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=iGAE3SZGJU7eojvkhG0qydiDez1X+uPg8UYp38uGbF0=; b=shP1R27ZZPo3u7ZJlFyR6e3e0HIfxK3DXbZ22/rqvwk/rXzS+6R+I4c96lm4ivXMcI d8/Utanlij5sPIfDaH5OjNUG+9yb4j5Vh/T4ajtYOTsBo6G24dZDUUX+Incfr4I72D8X lz+7r3eqq7amfVZ60PpDq2U+YYaPqkueldYYEHPIGCgTgQ0mLmSzh4pF/rMY84rWWG6w HxvQf2t9TV/IoSBtjd5osPB6dANhPl61TCexHKaFHZWCLhKo2NHaG+gISLxRE0Nho/rP phLKb6y3lrkCj3r64gEJmOmGfs8mmx4TRVxS348upObolu1j+R8BO7bIObdmgehGYGjb PVxw== X-Gm-Message-State: AOAM533zafciX/cGwFmI30QrowMSCfXPQHUYELBHHL097frxPhJGzlQD kMMaxY5qbYCwogmheBAwAzxwFjJFfGk= X-Google-Smtp-Source: ABdhPJxTDJ4ii3jI9F4cZ4CuUf6SrbDt2lWOtgtamp6IuAzYvc29b/mKFDukgB48zi2tcpTXt9eQVA== X-Received: by 2002:a05:6000:1841:b0:20c:788b:9306 with SMTP id c1-20020a056000184100b0020c788b9306mr13129820wri.369.1653171541147; Sat, 21 May 2022 15:19:01 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w9-20020adf8bc9000000b0020d07958bb3sm6119835wra.3.2022.05.21.15.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 15:19:00 -0700 (PDT) Message-Id: <30ccd602108fea74d64a5b81e6665fcc7efb6f0a.1653171536.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Date: Sat, 21 May 2022 22:18:47 +0000 Subject: [PATCH v3 03/12] test(junit): avoid line feeds in XML attributes Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: Eric Sunshine , =?UTF-8?Q?=C3=86var_Arnfj=C3=B6r=C3=B0?= Bjarmason , Phillip Wood , Victoria Dye , Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin In the test case's output, we do want newline characters, but in the XML attributes we do not want them. However, the `xml_attr_encode` function always adds a Line Feed at the end (which are then encoded as ` `, even for XML attributes. This seems not to faze Azure Pipelines' XML parser, but it still is incorrect, so let's fix it. Signed-off-by: Johannes Schindelin --- t/test-lib-junit.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh index 9d55d74d764..c959183c7e2 100644 --- a/t/test-lib-junit.sh +++ b/t/test-lib-junit.sh @@ -50,7 +50,7 @@ finalize_test_case_output () { ;; failure) junit_insert="" + junit_insert="$junit_insert $(xml_attr_encode --no-lf "$1")\">" junit_insert="$junit_insert $(xml_attr_encode \ "$(if test -n "$GIT_TEST_TEE_OUTPUT_FILE" then @@ -74,12 +74,12 @@ finalize_test_case_output () { set "$* (known breakage)" ;; skip) - message="$(xml_attr_encode "$skipped_reason")" + message="$(xml_attr_encode --no-lf "$skipped_reason")" set "$1" " " ;; esac - junit_attrs="name=\"$(xml_attr_encode "$this_test.$test_count $1")\"" + junit_attrs="name=\"$(xml_attr_encode --no-lf "$this_test.$test_count $1")\"" shift junit_attrs="$junit_attrs classname=\"$this_test\"" junit_attrs="$junit_attrs time=\"$(test-tool \ @@ -122,5 +122,11 @@ write_junit_xml () { } xml_attr_encode () { - printf '%s\n' "$@" | test-tool xml-encode + if test "x$1" = "x--no-lf" + then + shift + printf '%s' "$*" | test-tool xml-encode + else + printf '%s\n' "$@" | test-tool xml-encode + fi } -- gitgitgadget