All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Cc: "Stefan Beller" <sbeller@google.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"David Turner" <dturner@twosigma.com>,
	git@vger.kernel.org, "SZEDER Gábor" <szeder.dev@gmail.com>
Subject: [PATCH] test-lib: abort when can't remove trash directory
Date: Thu, 20 Apr 2017 18:52:30 +0200	[thread overview]
Message-ID: <20170420165230.5951-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <CAM0VKjm1m4v9vTpwFEejBuD3NuGm+kAdEV-_rzCXCz2G4m5NGw@mail.gmail.com>

We had two similar bugs in the tests sporadically triggering error
messages during the removal of the trash directory, see commits
bb05510e5 (t5510: run auto-gc in the foreground, 2016-05-01) and
ef09036cf (t6500: wait for detached auto gc at the end of the test
script, 2017-04-13).  The test script succeeded nonetheless, because
these errors are ignored during housekeeping in 'test_done'.

However, such an error is a sign that something is fishy in the test
script.  Print an error message and abort the test script when the
trash directory can't be removed successfully or is already removed,
because that's unexpected and we woud prefer somebody notice and
figure out why.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
---

Note, that the commit message references ef09036cf (t6500: wait for
detached auto gc at the end of the test script, 2017-04-13), which
is still only in 'pu'.

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

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 13b569682..e9e6f677d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -761,9 +761,12 @@ test_done () {
 			say "1..$test_count$skip_all"
 		fi
 
-		test -d "$remove_trash" &&
+		test -d "$remove_trash" ||
+		error "Tests passed but trash directory already removed before test cleanup; aborting"
+
 		cd "$(dirname "$remove_trash")" &&
-		rm -rf "$(basename "$remove_trash")"
+		rm -rf "$(basename "$remove_trash")" ||
+		error "Tests passed but test cleanup failed; aborting"
 
 		test_at_end_hook_
 
-- 
2.12.2.613.g9c5b79913


  parent reply	other threads:[~2017-04-20 16:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10 12:59 [PATCH] t6500: don't run detached auto gc at the end of the test script SZEDER Gábor
2017-04-10 13:58 ` Jeff King
2017-04-10 16:31   ` SZEDER Gábor
2017-04-10 16:35     ` Jeff King
2017-04-10 16:56       ` SZEDER Gábor
2017-04-10 17:01         ` Jeff King
2017-04-11 21:32           ` Johannes Sixt
2017-04-12  0:27             ` SZEDER Gábor
2017-04-12  0:50               ` Jeff King
2017-04-12 22:03                 ` SZEDER Gábor
2017-04-12 22:07                   ` [PATCHv2] " SZEDER Gábor
2017-04-13 10:31                     ` [PATCHv2.1] t6500: wait for " SZEDER Gábor
2017-04-13 16:06                       ` David Turner
2017-04-13 16:44                       ` Jeff King
2017-04-13 18:08                         ` SZEDER Gábor
2017-04-13 18:12                           ` Jeff King
2017-04-13 16:37                   ` [PATCH] t6500: don't run " Jeff King
2017-04-13 17:55                     ` Stefan Beller
2017-04-13 17:57                       ` Jeff King
2017-04-13 19:03                         ` SZEDER Gábor
2017-04-13 19:12                           ` Jeff King
2017-04-13 19:35                             ` SZEDER Gábor
2017-04-14 20:08                               ` Jeff King
2017-04-20 16:42                                 ` SZEDER Gábor
2017-04-20 16:45                                   ` Jeff King
2017-04-20 16:52                                   ` SZEDER Gábor [this message]
2017-04-20 19:06                                     ` [PATCH] test-lib: abort when can't remove trash directory Jeff King
2017-04-21  0:48                                     ` Junio C Hamano
2017-04-21 20:06                                       ` SZEDER Gábor
2017-04-21 20:15                                     ` Jeff King
2017-04-24  0:14                                       ` Junio C Hamano
2017-04-24  1:43                                         ` Jeff King
2017-04-24  2:58                                           ` Junio C Hamano
2017-04-24  4:02                                             ` Junio C Hamano
2017-04-24  7:52                                               ` Jeff King
2017-04-24  9:39                                                 ` Torsten Bögershausen
2017-04-24  9:46                                                   ` Jeff King
2017-04-25  2:31                                                   ` Junio C Hamano
2017-04-25  6:05                                                 ` Junio C Hamano
2017-04-25  6:07                                                   ` Jeff King
2017-04-25  6:31                                                     ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=20170420165230.5951-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=dturner@twosigma.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    --cc=sbeller@google.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.