{"thread":{"id":"42582","subject":"[PATCH] lib-httpd.sh: print error.log on error","startedAt":"2016-06-16T02:19:52Z","lastAt":"2016-06-16T06:55:51Z","messageCount":6,"participants":["Nguyễn Thái Ngọc Duy","Jeff King","Duy Nguyen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"289025","messageId":"20160612104154.31446-1-pclouds@gmail.com","threadId":"42582","inReplyTo":null,"subject":"[PATCH] lib-httpd.sh: print error.log on error","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-06-12T10:41:54Z","receivedAt":"2016-06-16T02:19:52Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Failure to bring up httpd for testing is not considered an error, so the\ntrash directory, which contains this error.log file, is removed and we\ndon't know what made httpd fail to start. Improve the situation a bit.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/lib-httpd.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\nindex f9f3e5f..5b8de38 100644\n--- a/t/lib-httpd.sh\n+++ b/t/lib-httpd.sh\n@@ -180,6 +180,7 @@ start_httpd() {\n \tif test $? -ne 0\n \tthen\n \t\ttrap 'die' EXIT\n+\t\tcat \"$HTTPD_ROOT_PATH\"/error.log 2>/dev/null\n \t\ttest_skip_or_die $GIT_TEST_HTTPD \"web server setup failed\"\n \tfi\n }\n-- \n2.8.2.524.g6ff3d78\n"},{"id":"289056","messageId":"20160612125921.GA15289@sigill.intra.peff.net","threadId":"42582","inReplyTo":"20160612104154.31446-1-pclouds@gmail.com","subject":"Re: [PATCH] lib-httpd.sh: print error.log on error","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-12T12:59:21Z","receivedAt":"2016-06-16T02:19:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jun 12, 2016 at 05:41:54PM +0700, Nguyễn Thái Ngọc Duy wrote:\n\n> Failure to bring up httpd for testing is not considered an error, so the\n> trash directory, which contains this error.log file, is removed and we\n> don't know what made httpd fail to start. Improve the situation a bit.\n> \n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  t/lib-httpd.sh | 1 +\n>  1 file changed, 1 insertion(+)\n> \n> diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\n> index f9f3e5f..5b8de38 100644\n> --- a/t/lib-httpd.sh\n> +++ b/t/lib-httpd.sh\n> @@ -180,6 +180,7 @@ start_httpd() {\n>  \tif test $? -ne 0\n>  \tthen\n>  \t\ttrap 'die' EXIT\n> +\t\tcat \"$HTTPD_ROOT_PATH\"/error.log 2>/dev/null\n>  \t\ttest_skip_or_die $GIT_TEST_HTTPD \"web server setup failed\"\n>  \tfi\n\nI like the idea of giving more data on error, but I think this will\nbreak the TAP output and confuse anything parsing the output of the\ntests, like prove (I think arbitrary output should have \"#\" prepended).\n\nAlso (or alternatively), it should probably only happen when we are in\nverbose mode (it's not taken care of for us as usual because tests call\nstart_httpd outside of a test_expect_ block). I think this eliminates\nthe need to deal with the TAP thing (because our usual \"-v\" output is\nnot TAP-compliant).\n\n-Peff\n"},{"id":"289100","messageId":"20160613114014.GA15562@ash","threadId":"42582","inReplyTo":"20160612125921.GA15289@sigill.intra.peff.net","subject":"Re: [PATCH] lib-httpd.sh: print error.log on error","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2016-06-13T11:40:14Z","receivedAt":"2016-06-16T02:19:53Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Jun 12, 2016 at 08:59:21AM -0400, Jeff King wrote:\n> On Sun, Jun 12, 2016 at 05:41:54PM +0700, Nguyễn Thái Ngọc Duy wrote:\n> \n> > Failure to bring up httpd for testing is not considered an error, so the\n> > trash directory, which contains this error.log file, is removed and we\n> > don't know what made httpd fail to start. Improve the situation a bit.\n> > \n> > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> > ---\n> >  t/lib-httpd.sh | 1 +\n> >  1 file changed, 1 insertion(+)\n> > \n> > diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\n> > index f9f3e5f..5b8de38 100644\n> > --- a/t/lib-httpd.sh\n> > +++ b/t/lib-httpd.sh\n> > @@ -180,6 +180,7 @@ start_httpd() {\n> >  \tif test $? -ne 0\n> >  \tthen\n> >  \t\ttrap 'die' EXIT\n> > +\t\tcat \"$HTTPD_ROOT_PATH\"/error.log 2>/dev/null\n> >  \t\ttest_skip_or_die $GIT_TEST_HTTPD \"web server setup failed\"\n> >  \tfi\n> \n> I like the idea of giving more data on error, but I think this will\n> break the TAP output and confuse anything parsing the output of the\n> tests, like prove (I think arbitrary output should have \"#\" prepended).\n> \n> Also (or alternatively), it should probably only happen when we are in\n> verbose mode (it's not taken care of for us as usual because tests call\n> start_httpd outside of a test_expect_ block). I think this eliminates\n> the need to deal with the TAP thing (because our usual \"-v\" output is\n> not TAP-compliant).\n\nI like the verbose route, so here's v2\n\n-- 8< --\nSubject: [PATCH v2] lib-httpd.sh: print error.log on error\n\nFailure to bring up httpd for testing is not considered an error, so\nthe trash directory, which contains this error.log file, is removed\nand we don't know why httpd failed. Improve the situation a bit, print\nerror.log but only in verbose mode.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n t/lib-httpd.sh | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\nindex f9f3e5f..67bc7ad 100644\n--- a/t/lib-httpd.sh\n+++ b/t/lib-httpd.sh\n@@ -180,6 +180,8 @@ start_httpd() {\n \tif test $? -ne 0\n \tthen\n \t\ttrap 'die' EXIT\n+\t\ttest \"$verbose\" = t && \\\n+\t\t\tcat \"$HTTPD_ROOT_PATH\"/error.log 2>/dev/null\n \t\ttest_skip_or_die $GIT_TEST_HTTPD \"web server setup failed\"\n \tfi\n }\n-- \n2.8.2.524.g6ff3d78\n-- 8< --\n"},{"id":"289101","messageId":"20160613115608.GA5652@sigill.intra.peff.net","threadId":"42582","inReplyTo":"20160613114014.GA15562@ash","subject":"Re: [PATCH] lib-httpd.sh: print error.log on error","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-13T11:56:08Z","receivedAt":"2016-06-16T02:19:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 13, 2016 at 06:40:14PM +0700, Duy Nguyen wrote:\n\n> I like the verbose route, so here's v2\n\nI think this is OK, though...\n\n> diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\n> index f9f3e5f..67bc7ad 100644\n> --- a/t/lib-httpd.sh\n> +++ b/t/lib-httpd.sh\n> @@ -180,6 +180,8 @@ start_httpd() {\n>  \tif test $? -ne 0\n>  \tthen\n>  \t\ttrap 'die' EXIT\n> +\t\ttest \"$verbose\" = t && \\\n> +\t\t\tcat \"$HTTPD_ROOT_PATH\"/error.log 2>/dev/null\n\nI think you can just spell this:\n\n  cat >&4 ...\n\n(I had originally thought that we set up those fds only inside the\ntest_expect blocks, but it is the redirection 2>&4 that we set up there;\nyou can always use fd 4 as necessary).\n\nIt does incur a useless \"cat\" when we are not verbose, but I don't think\nthat's a big deal for the error path like this.\n\n-Peff\n"},{"id":"289110","messageId":"20160613123509.22412-1-pclouds@gmail.com","threadId":"42582","inReplyTo":"20160613115608.GA5652@sigill.intra.peff.net","subject":"[PATCH v3] lib-httpd.sh: print error.log on error","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2016-06-13T12:35:09Z","receivedAt":"2016-06-16T02:19:53Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Failure to bring up httpd for testing is not considered an error, so the\ntrash directory, which contains this error.log file, is removed and we\ndon't know what made httpd fail to start. Improve the situation a bit,\nprint error.log but only in verbose mode.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n Redirect stdout to \"verbose stderr\" instead of testing $verbose.\n\n t/lib-httpd.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/lib-httpd.sh b/t/lib-httpd.sh\nindex f9f3e5f..ac2cbee 100644\n--- a/t/lib-httpd.sh\n+++ b/t/lib-httpd.sh\n@@ -180,6 +180,7 @@ start_httpd() {\n \tif test $? -ne 0\n \tthen\n \t\ttrap 'die' EXIT\n+\t\tcat \"$HTTPD_ROOT_PATH\"/error.log >&4 2>/dev/null\n \t\ttest_skip_or_die $GIT_TEST_HTTPD \"web server setup failed\"\n \tfi\n }\n-- \n2.8.2.524.g6ff3d78\n"},{"id":"289155","messageId":"20160613170832.GA7283@sigill.intra.peff.net","threadId":"42582","inReplyTo":"20160613123509.22412-1-pclouds@gmail.com","subject":"Re: [PATCH v3] lib-httpd.sh: print error.log on error","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-06-13T17:08:33Z","receivedAt":"2016-06-16T06:55:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 13, 2016 at 07:35:09PM +0700, Nguyễn Thái Ngọc Duy wrote:\n\n> Failure to bring up httpd for testing is not considered an error, so the\n> trash directory, which contains this error.log file, is removed and we\n> don't know what made httpd fail to start. Improve the situation a bit,\n> print error.log but only in verbose mode.\n> \n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n\nLooks good to me. Thanks.\n\n-Peff\n"}]}