git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH] tests: fix incorrect --write-junit-xml code
Date: Thu, 14 Jul 2022 09:00:34 +0000	[thread overview]
Message-ID: <pull.1288.git.1657789234416.gitgitgadget@gmail.com> (raw)

From: Johannes Schindelin <johannes.schindelin@gmx.de>

In 78d5e4cfb4b (tests: refactor --write-junit-xml code, 2022-05-21),
this developer refactored the `--write-junit-xml` code a bit, including
the part where the current test case's title was used in a `set`
invocation, but failed to account for the fact that some test cases'
titles start with a long option, which the `set` misinterprets as being
intended for parsing.

Let's fix this by using the `set -- <...>` form.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    tests(JUnit): fix a regression introduced by refactoring
    
    As if another data point was needed to corroborate my claim that
    refactorings are neither free of cost nor of risk, this patch fixes a
    regression I myself introduced while refactoring the JUnit XML output
    code. At least this refactoring was motivated by an ulterior goal to
    improve Git's contributor experience, not just refactoring for
    refactoring's sake.
    
    Unfortunately, I noticed this regression no earlier than when I needed
    to validate Git for Windows v2.37.1. Since v2.37.1 was an embargoed
    release, I could not use GitHub Actions for the CI testing, so I had to
    reinstate Git's Azure Pipeline.
    
    It will probably surprise only few, if at all, that this is far from the
    only regression in the CI code that I had to fix just so I could run the
    Azure Pipeline successfully. I plan on contributing all of these
    regression fixes, of course, packaged into neat little,
    logically-separate patch series that should be easy on reviewers.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1288%2Fdscho%2Ffix-junit-xml-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1288/dscho/fix-junit-xml-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1288

 t/test-lib-junit.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh
index c959183c7e2..79c31c788b9 100644
--- a/t/test-lib-junit.sh
+++ b/t/test-lib-junit.sh
@@ -46,7 +46,7 @@ finalize_test_case_output () {
 	shift
 	case "$test_case_result" in
 	ok)
-		set "$*"
+		set -- "$*"
 		;;
 	failure)
 		junit_insert="<failure message=\"not ok $test_count -"
@@ -65,17 +65,17 @@ finalize_test_case_output () {
 			junit_insert="$junit_insert<system-err>$(xml_attr_encode \
 				"$(cat "$GIT_TEST_TEE_OUTPUT_FILE")")</system-err>"
 		fi
-		set "$1" "      $junit_insert"
+		set -- "$1" "      $junit_insert"
 		;;
 	fixed)
-		set "$* (breakage fixed)"
+		set -- "$* (breakage fixed)"
 		;;
 	broken)
-		set "$* (known breakage)"
+		set -- "$* (known breakage)"
 		;;
 	skip)
 		message="$(xml_attr_encode --no-lf "$skipped_reason")"
-		set "$1" "      <skipped message=\"$message\" />"
+		set -- "$1" "      <skipped message=\"$message\" />"
 		;;
 	esac
 

base-commit: 4e2a4d1dd44367d7783f33b169698f2930ff13c0
-- 
gitgitgadget

             reply	other threads:[~2022-07-14  9:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  9:00 Johannes Schindelin via GitGitGadget [this message]
2022-07-14 16:14 ` [PATCH] tests: fix incorrect --write-junit-xml code Junio C Hamano
2022-07-15  9:25   ` Ævar Arnfjörð Bjarmason
2022-08-08 13:40   ` Johannes Schindelin
2022-08-08 16:47     ` Junio C Hamano
2022-08-09  8:42       ` Johannes Schindelin
2022-08-10 18:44         ` Junio C Hamano
2022-08-12 21:00           ` Johannes Schindelin
2022-07-15  9:35 ` never refactor v.s. testing (was: [PATCH] tests: fix incorrect --write-junit-xml code) Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1288.git.1657789234416.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).