git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t7610: clean up foo.* tmpdir
@ 2016-11-27  6:34 Jeff King
  0 siblings, 0 replies; only message in thread
From: Jeff King @ 2016-11-27  6:34 UTC (permalink / raw)
  To: git; +Cc: Armin Kunaschik

[resend; the original subject with foo.XXXXXX was bounced by vger for
being too sexy]

-- >8 --
Subject: [PATCH] t7610: clean up foo.XXXXXX tmpdir

The lazy prereq for MKTEMP uses "mktemp -t" to see if
mergetool's internal mktemp call will be able to run. But
unlike the call inside mergetool, we do not ever bother to
clean up the result, and the /tmp of git developers will
slowly fill up with "foo.XXXXXX" directories as they run the
test suite over and over.  Let's clean up the directory
after we've verified its creation.

Note that we don't use test_when_finished here, and instead
just make rmdir part of the &&-chain. We should only remove
something that we're confident we just created. A failure in
the middle of the chain either means there's nothing to
clean up, or we are very confused and should err on the side
of caution.

Signed-off-by: Jeff King <peff@peff.net>
---
This has been happening since c578a09bd (t7610: test for mktemp before
test execution, 2016-07-02). I have noticed the foo.* directories
building in /tmp, but I never bothered to track it down before.  I just
assumed from the name it was one of my personal hacky scripts. :)

It does make me wonder if test-lib.sh ought to just set $TMPDIR inside
the trash directory so that any cruft we fail to cleanup is contained.

 t/t7610-mergetool.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh
index 6d9f21511..63d36fb28 100755
--- a/t/t7610-mergetool.sh
+++ b/t/t7610-mergetool.sh
@@ -591,7 +591,8 @@ test_expect_success 'filenames seen by tools start with ./' '
 
 test_lazy_prereq MKTEMP '
 	tempdir=$(mktemp -d -t foo.XXXXXX) &&
-	test -d "$tempdir"
+	test -d "$tempdir" &&
+	rmdir "$tempdir"
 '
 
 test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToTemp' '
-- 
2.11.0.rc3.315.gde8259a

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-27  6:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-27  6:34 [PATCH] t7610: clean up foo.* tmpdir Jeff King

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).