{"thread":{"id":"53066","subject":"[PATCH] tests(junit-xml): avoid invalid XML","startedAt":"2020-03-23T12:44:40Z","lastAt":"2020-03-23T20:56:14Z","messageCount":3,"participants":["Johannes Schindelin via GitGitGadget","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"393761","messageId":"pull.732.git.git.1584967475669.gitgitgadget@gmail.com","threadId":"53066","inReplyTo":null,"subject":"[PATCH] tests(junit-xml): avoid invalid XML","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-03-23T12:44:35Z","receivedAt":"2020-03-23T12:44:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhen a test case is run in a subshell, we finalize the JUnit-style XML\nwhen said subshell exits. But then we continue to write into that XML as\nif nothing had happened.\n\nThis leads to Azure Pipelines' Publish Test Results task complaining:\n\n\tFailed to read /home/vsts/work/1/s/t/out/TEST-t0000-basic.xml.\n\tError : Unexpected end tag. Line 110, position 5.\n\nAnd indeed, the resulting XML is incorrect.\n\nLet's \"re-open\" the XML in such a case, i.e. remove the previously added\nclosing tags.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    Fix Azure Pipelines for t0000\n    \n    When running t0000 in our Azure Pipeline, the \"Publish Test Results\"\n    step complains about an invalid JUnit-style XML, and it is correct.\n    Let's fix that.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-732%2Fdscho%2Fci-xml-error-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-732/dscho/ci-xml-error-v1\nPull-Request: https://github.com/git/git/pull/732\n\n t/test-lib.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 0ea1e5a05ed..7f0c02c016b 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -1085,6 +1085,7 @@ finalize_junit_xml () {\n \t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n \t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n \t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n+\t\t\t-e '/^ *<\\/testsuite/d' \\\n \t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n \t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n \n\nbase-commit: be8661a3286c67a5d4088f4226cbd7f8b76544b0\n-- \ngitgitgadget\n"},{"id":"393782","messageId":"xmqqlfnr5945.fsf@gitster.c.googlers.com","threadId":"53066","inReplyTo":"pull.732.git.git.1584967475669.gitgitgadget@gmail.com","subject":"Re: [PATCH] tests(junit-xml): avoid invalid XML","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-03-23T16:28:10Z","receivedAt":"2020-03-23T16:28:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\nwrites:\n\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> When a test case is run in a subshell, we finalize the JUnit-style XML\n> when said subshell exits. But then we continue to write into that XML as\n> if nothing had happened.\n>\n> This leads to Azure Pipelines' Publish Test Results task complaining:\n>\n> \tFailed to read /home/vsts/work/1/s/t/out/TEST-t0000-basic.xml.\n> \tError : Unexpected end tag. Line 110, position 5.\n>\n> And indeed, the resulting XML is incorrect.\n>\n> Let's \"re-open\" the XML in such a case, i.e. remove the previously added\n> closing tags.\n>\n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> ---\n>     Fix Azure Pipelines for t0000\n>     \n>     When running t0000 in our Azure Pipeline, the \"Publish Test Results\"\n>     step complains about an invalid JUnit-style XML, and it is correct.\n>     Let's fix that.\n\nHmph, I have a vague recollection that I've seen this one, looked at\nthe patch and even understood the issue.  Did I then forget to apply\nit back then?  If so, apologies for failing to do so before the\nrelease.\n\nWill queue.\n\nThanks.\n\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-732%2Fdscho%2Fci-xml-error-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-732/dscho/ci-xml-error-v1\n> Pull-Request: https://github.com/git/git/pull/732\n>\n>  t/test-lib.sh | 1 +\n>  1 file changed, 1 insertion(+)\n>\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index 0ea1e5a05ed..7f0c02c016b 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -1085,6 +1085,7 @@ finalize_junit_xml () {\n>  \t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n>  \t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n>  \t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n> +\t\t\t-e '/^ *<\\/testsuite/d' \\\n>  \t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n>  \t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n>  \n>\n> base-commit: be8661a3286c67a5d4088f4226cbd7f8b76544b0\n"},{"id":"393817","messageId":"nycvar.QRO.7.76.6.2003232153350.46@tvgsbejvaqbjf.bet","threadId":"53066","inReplyTo":"xmqqlfnr5945.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] tests(junit-xml): avoid invalid XML","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2020-03-23T20:56:07Z","receivedAt":"2020-03-23T20:56:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Mon, 23 Mar 2020, Junio C Hamano wrote:\n\n> \"Johannes Schindelin via GitGitGadget\" <gitgitgadget@gmail.com>\n> writes:\n>\n> > From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> >\n> > When a test case is run in a subshell, we finalize the JUnit-style XML\n> > when said subshell exits. But then we continue to write into that XML as\n> > if nothing had happened.\n> >\n> > This leads to Azure Pipelines' Publish Test Results task complaining:\n> >\n> > \tFailed to read /home/vsts/work/1/s/t/out/TEST-t0000-basic.xml.\n> > \tError : Unexpected end tag. Line 110, position 5.\n> >\n> > And indeed, the resulting XML is incorrect.\n> >\n> > Let's \"re-open\" the XML in such a case, i.e. remove the previously added\n> > closing tags.\n> >\n> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n> > ---\n> >     Fix Azure Pipelines for t0000\n> >\n> >     When running t0000 in our Azure Pipeline, the \"Publish Test Results\"\n> >     step complains about an invalid JUnit-style XML, and it is correct.\n> >     Let's fix that.\n>\n> Hmph, I have a vague recollection that I've seen this one, looked at\n> the patch and even understood the issue.  Did I then forget to apply\n> it back then?  If so, apologies for failing to do so before the\n> release.\n\nI suspect that you think of 076ee3e8a2a6 (tests: fix --write-junit-xml\nwith subshells, 2020-02-12) which you indeed applied. This patch addresses\na different issue that I had not noticed until two weeks ago. I\npurposefully held back on contributing it during the feature freeze phase.\n\n> Will queue.\n\nThanks,\nDscho\n\n>\n> Thanks.\n>\n> > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-732%2Fdscho%2Fci-xml-error-v1\n> > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-732/dscho/ci-xml-error-v1\n> > Pull-Request: https://github.com/git/git/pull/732\n> >\n> >  t/test-lib.sh | 1 +\n> >  1 file changed, 1 insertion(+)\n> >\n> > diff --git a/t/test-lib.sh b/t/test-lib.sh\n> > index 0ea1e5a05ed..7f0c02c016b 100644\n> > --- a/t/test-lib.sh\n> > +++ b/t/test-lib.sh\n> > @@ -1085,6 +1085,7 @@ finalize_junit_xml () {\n> >  \t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n> >  \t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n> >  \t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n> > +\t\t\t-e '/^ *<\\/testsuite/d' \\\n> >  \t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n> >  \t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n> >\n> >\n> > base-commit: be8661a3286c67a5d4088f4226cbd7f8b76544b0\n>\n>\n"}]}