git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>, "Todd Zullinger" <tmz@pobox.com>,
	"Martin Ågren" <martin.agren@gmail.com>,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Junio C Hamano" <gitster@pobox.com>,
	"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH v2 6/6] ci: fix AsciiDoc/Asciidoctor stderr check in the documentation build job
Date: Sun, 24 Mar 2019 22:55:34 +0100	[thread overview]
Message-ID: <20190324215534.9495-7-szeder.dev@gmail.com> (raw)
In-Reply-To: <20190324215534.9495-1-szeder.dev@gmail.com>

In our 'ci/*' build scripts we rely on 'set -e' aborting the build job
when a command exits with error, while in 'ci/test-documentation.sh'
we tried to check the emptiness of AsciiDoc's and Asciidoctor's
standard error with '! test -s stderr.log'.  Unfortunately, the
combination of the two doesn't work as intended, because, according to
POSIX [1]:

  "The -e setting shall be ignored when executing [...] a pipeline
  beginning with the ! reserved word" [2]

Watch and learn:

  $ cat e.sh
  #!/bin/sh
  set -ex
  echo unexpected >file
  ! test -s file
  test ! -s file
  echo "should not reach this"
  $ ./e.sh
  + echo unexpected
  + test -s file
  + test ! -s file
  $

This is why we haven't noticed the warnings from Asciidoctor that were
fixed in the first patches of this patch series, though some of them
were already there in the build of v2.18.0-rc0 [3].

Check the emptiness of that file with 'test ! -s' instead, which works
properly with 'set -e'.  Furthermore, dump the contents of that file
to the log for our convenience, so if it were to unexpectedly end up
being non-empty, then we wouldn't have to scroll through all that long
build log looking for warnings, but could see them right away near the
end of the log.

And one more thing: we build the docs with Asciidoctor right after a
'make clean', meaning that 'make doc' starts with running
'GIT-VERSION-GEN', which in turn prints the version to its standard
error.  This version then goes to 'stderr.log' as well, and a 'sed'
command is supposed to remove it to prevent it from interfering with
that (previously defunct) emptiness check.  Alas, this command doesn't
work as intended, either, because it leaves the file to be checked
intact, but the defunct emptiness check hid this issue, too...  This
patch deals with this as well.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#set

[2] POSIX doesn't discuss the meaning of '! cmd' in case of simple
    commands, but it defines that "A pipeline is a sequence of one or
    more commands separated by the control operator '|'", so
    apparently a simple command is considered as pipeline as well.

    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_02

[3] https://travis-ci.org/git/git/jobs/385932007#L1463

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---
 ci/test-documentation.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/ci/test-documentation.sh b/ci/test-documentation.sh
index 8f91f48c81..bd4a65e933 100755
--- a/ci/test-documentation.sh
+++ b/ci/test-documentation.sh
@@ -10,7 +10,8 @@ make check-docs
 
 # Build docs with AsciiDoc
 make doc > >(tee stdout.log) 2> >(tee stderr.log >&2)
-! test -s stderr.log
+cat stderr.log
+test ! -s stderr.log
 test -s Documentation/git.html
 test -s Documentation/git.xml
 test -s Documentation/git.1
@@ -21,13 +22,14 @@ check_unignored_build_artifacts
 
 # Build docs with AsciiDoctor
 make clean
-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.log >&2)
-sed '/^GIT_VERSION = / d' stderr.log
-! test -s stderr.log
+make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)
+sed '/^GIT_VERSION = / d' stderr.raw >stderr.log
+cat stderr.log
+test ! -s stderr.log
 test -s Documentation/git.html
 grep '<meta name="generator" content="Asciidoctor ' Documentation/git.html
 
-rm -f stdout.log stderr.log
+rm -f stdout.log stderr.log stderr.raw
 check_unignored_build_artifacts
 
 save_good_tree
-- 
2.21.0.539.g07239c3a71.dirty


  parent reply	other threads:[~2019-03-24 21:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-24 15:52 [PATCH 1/3] Documentation/git-diff-tree.txt: fix formatting SZEDER Gábor
2019-03-24 15:52 ` [PATCH 2/3] Documentation/technical/api-config.txt: " SZEDER Gábor
2019-03-24 15:52 ` [PATCH 3/3] Documentation/technical/protocol-v2.txt: " SZEDER Gábor
2019-03-24 15:58   ` SZEDER Gábor
2019-03-24 21:55 ` [PATCH v2 0/6] Asciidoctor-related formatting and CI fixes SZEDER Gábor
2019-03-24 21:55   ` [PATCH v2 1/6] Documentation/git-diff-tree.txt: fix formatting SZEDER Gábor
2019-03-24 21:55   ` [PATCH v2 2/6] Documentation/technical/api-config.txt: " SZEDER Gábor
2019-03-24 21:55   ` [PATCH v2 3/6] Documentation/technical/protocol-v2.txt: " SZEDER Gábor
2019-03-24 21:55   ` [PATCH v2 4/6] ci: install Asciidoctor in 'ci/install-dependencies.sh' SZEDER Gábor
2019-03-25 21:28     ` Johannes Schindelin
2019-03-25 21:46       ` SZEDER Gábor
2019-03-26 13:41         ` Johannes Schindelin
2019-03-24 21:55   ` [PATCH v2 5/6] ci: stick with Asciidoctor v1.5.8 for now SZEDER Gábor
2019-03-24 21:55   ` SZEDER Gábor [this message]
2019-03-26 16:24   ` [PATCH v2 0/6] Asciidoctor-related formatting and CI fixes Jeff King
2019-03-29 12:35   ` [PATCH v3 " SZEDER Gábor
2019-03-29 12:35     ` [PATCH v3 1/6] Documentation/git-diff-tree.txt: fix formatting SZEDER Gábor
2019-03-29 12:35     ` [PATCH v3 2/6] Documentation/technical/api-config.txt: " SZEDER Gábor
2019-03-29 12:35     ` [PATCH v3 3/6] Documentation/technical/protocol-v2.txt: " SZEDER Gábor
2019-03-29 12:35     ` [PATCH v3 4/6] ci: install Asciidoctor in 'ci/install-dependencies.sh' SZEDER Gábor
2019-03-29 12:35     ` [PATCH v3 5/6] ci: stick with Asciidoctor v1.5.8 for now SZEDER Gábor
2019-03-29 19:52       ` [PATCH v3.1 " SZEDER Gábor
2019-04-03 11:34         ` Martin Ågren
2019-03-29 12:35     ` [PATCH v3 6/6] ci: fix AsciiDoc/Asciidoctor stderr check in the documentation build job SZEDER Gábor
2019-03-29 15:56     ` [PATCH v3 0/6] Asciidoctor-related formatting and CI fixes Johannes Schindelin

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=20190324215534.9495-7-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=martin.agren@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    --cc=tmz@pobox.com \
    /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).