* [PATCH] lib-httpd.sh: print error.log on error
@ 2016-06-12 10:41 Nguyễn Thái Ngọc Duy
2016-06-12 12:59 ` Jeff King
0 siblings, 1 reply; 6+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2016-06-12 10:41 UTC (permalink / raw)
To: git; +Cc: Nguyễn Thái Ngọc Duy
Failure to bring up httpd for testing is not considered an error, so the
trash directory, which contains this error.log file, is removed and we
don't know what made httpd fail to start. Improve the situation a bit.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/lib-httpd.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index f9f3e5f..5b8de38 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -180,6 +180,7 @@ start_httpd() {
if test $? -ne 0
then
trap 'die' EXIT
+ cat "$HTTPD_ROOT_PATH"/error.log 2>/dev/null
test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
fi
}
--
2.8.2.524.g6ff3d78
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] lib-httpd.sh: print error.log on error
2016-06-12 10:41 [PATCH] lib-httpd.sh: print error.log on error Nguyễn Thái Ngọc Duy
@ 2016-06-12 12:59 ` Jeff King
2016-06-13 11:40 ` Duy Nguyen
0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2016-06-12 12:59 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
On Sun, Jun 12, 2016 at 05:41:54PM +0700, Nguyễn Thái Ngọc Duy wrote:
> Failure to bring up httpd for testing is not considered an error, so the
> trash directory, which contains this error.log file, is removed and we
> don't know what made httpd fail to start. Improve the situation a bit.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> t/lib-httpd.sh | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
> index f9f3e5f..5b8de38 100644
> --- a/t/lib-httpd.sh
> +++ b/t/lib-httpd.sh
> @@ -180,6 +180,7 @@ start_httpd() {
> if test $? -ne 0
> then
> trap 'die' EXIT
> + cat "$HTTPD_ROOT_PATH"/error.log 2>/dev/null
> test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
> fi
I like the idea of giving more data on error, but I think this will
break the TAP output and confuse anything parsing the output of the
tests, like prove (I think arbitrary output should have "#" prepended).
Also (or alternatively), it should probably only happen when we are in
verbose mode (it's not taken care of for us as usual because tests call
start_httpd outside of a test_expect_ block). I think this eliminates
the need to deal with the TAP thing (because our usual "-v" output is
not TAP-compliant).
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] lib-httpd.sh: print error.log on error
2016-06-12 12:59 ` Jeff King
@ 2016-06-13 11:40 ` Duy Nguyen
2016-06-13 11:56 ` Jeff King
0 siblings, 1 reply; 6+ messages in thread
From: Duy Nguyen @ 2016-06-13 11:40 UTC (permalink / raw)
To: Jeff King; +Cc: git
On Sun, Jun 12, 2016 at 08:59:21AM -0400, Jeff King wrote:
> On Sun, Jun 12, 2016 at 05:41:54PM +0700, Nguyễn Thái Ngọc Duy wrote:
>
> > Failure to bring up httpd for testing is not considered an error, so the
> > trash directory, which contains this error.log file, is removed and we
> > don't know what made httpd fail to start. Improve the situation a bit.
> >
> > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> > ---
> > t/lib-httpd.sh | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
> > index f9f3e5f..5b8de38 100644
> > --- a/t/lib-httpd.sh
> > +++ b/t/lib-httpd.sh
> > @@ -180,6 +180,7 @@ start_httpd() {
> > if test $? -ne 0
> > then
> > trap 'die' EXIT
> > + cat "$HTTPD_ROOT_PATH"/error.log 2>/dev/null
> > test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
> > fi
>
> I like the idea of giving more data on error, but I think this will
> break the TAP output and confuse anything parsing the output of the
> tests, like prove (I think arbitrary output should have "#" prepended).
>
> Also (or alternatively), it should probably only happen when we are in
> verbose mode (it's not taken care of for us as usual because tests call
> start_httpd outside of a test_expect_ block). I think this eliminates
> the need to deal with the TAP thing (because our usual "-v" output is
> not TAP-compliant).
I like the verbose route, so here's v2
-- 8< --
Subject: [PATCH v2] lib-httpd.sh: print error.log on error
Failure to bring up httpd for testing is not considered an error, so
the trash directory, which contains this error.log file, is removed
and we don't know why httpd failed. Improve the situation a bit, print
error.log but only in verbose mode.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
t/lib-httpd.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index f9f3e5f..67bc7ad 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -180,6 +180,8 @@ start_httpd() {
if test $? -ne 0
then
trap 'die' EXIT
+ test "$verbose" = t && \
+ cat "$HTTPD_ROOT_PATH"/error.log 2>/dev/null
test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
fi
}
--
2.8.2.524.g6ff3d78
-- 8< --
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] lib-httpd.sh: print error.log on error
2016-06-13 11:40 ` Duy Nguyen
@ 2016-06-13 11:56 ` Jeff King
2016-06-13 12:35 ` [PATCH v3] " Nguyễn Thái Ngọc Duy
0 siblings, 1 reply; 6+ messages in thread
From: Jeff King @ 2016-06-13 11:56 UTC (permalink / raw)
To: Duy Nguyen; +Cc: git
On Mon, Jun 13, 2016 at 06:40:14PM +0700, Duy Nguyen wrote:
> I like the verbose route, so here's v2
I think this is OK, though...
> diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
> index f9f3e5f..67bc7ad 100644
> --- a/t/lib-httpd.sh
> +++ b/t/lib-httpd.sh
> @@ -180,6 +180,8 @@ start_httpd() {
> if test $? -ne 0
> then
> trap 'die' EXIT
> + test "$verbose" = t && \
> + cat "$HTTPD_ROOT_PATH"/error.log 2>/dev/null
I think you can just spell this:
cat >&4 ...
(I had originally thought that we set up those fds only inside the
test_expect blocks, but it is the redirection 2>&4 that we set up there;
you can always use fd 4 as necessary).
It does incur a useless "cat" when we are not verbose, but I don't think
that's a big deal for the error path like this.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3] lib-httpd.sh: print error.log on error
2016-06-13 11:56 ` Jeff King
@ 2016-06-13 12:35 ` Nguyễn Thái Ngọc Duy
2016-06-13 17:08 ` Jeff King
0 siblings, 1 reply; 6+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2016-06-13 12:35 UTC (permalink / raw)
To: git; +Cc: Jeff King, Nguyễn Thái Ngọc Duy
Failure to bring up httpd for testing is not considered an error, so the
trash directory, which contains this error.log file, is removed and we
don't know what made httpd fail to start. Improve the situation a bit,
print error.log but only in verbose mode.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Redirect stdout to "verbose stderr" instead of testing $verbose.
t/lib-httpd.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index f9f3e5f..ac2cbee 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -180,6 +180,7 @@ start_httpd() {
if test $? -ne 0
then
trap 'die' EXIT
+ cat "$HTTPD_ROOT_PATH"/error.log >&4 2>/dev/null
test_skip_or_die $GIT_TEST_HTTPD "web server setup failed"
fi
}
--
2.8.2.524.g6ff3d78
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] lib-httpd.sh: print error.log on error
2016-06-13 12:35 ` [PATCH v3] " Nguyễn Thái Ngọc Duy
@ 2016-06-13 17:08 ` Jeff King
0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2016-06-13 17:08 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
On Mon, Jun 13, 2016 at 07:35:09PM +0700, Nguyễn Thái Ngọc Duy wrote:
> Failure to bring up httpd for testing is not considered an error, so the
> trash directory, which contains this error.log file, is removed and we
> don't know what made httpd fail to start. Improve the situation a bit,
> print error.log but only in verbose mode.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Looks good to me. Thanks.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-06-13 17:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-12 10:41 [PATCH] lib-httpd.sh: print error.log on error Nguyễn Thái Ngọc Duy
2016-06-12 12:59 ` Jeff King
2016-06-13 11:40 ` Duy Nguyen
2016-06-13 11:56 ` Jeff King
2016-06-13 12:35 ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2016-06-13 17:08 ` Jeff King
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 NNTP newsgroup(s).