summaryrefslogtreecommitdiff
path: root/t/lib-git-p4.sh
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2014-01-21 23:16:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-01-22 16:06:19 (GMT)
commit0cf1b72a38e6190a7e614bbc53fbb81704a3d4af (patch)
treeb9cc9161d83b70a11387bd0691ddfc7b3928c30f /t/lib-git-p4.sh
parent0055b56e10f77b1b5f5521b8ba3614f962a09288 (diff)
downloadgit-0cf1b72a38e6190a7e614bbc53fbb81704a3d4af.zip
git-0cf1b72a38e6190a7e614bbc53fbb81704a3d4af.tar.gz
git-0cf1b72a38e6190a7e614bbc53fbb81704a3d4af.tar.bz2
git p4 test: do not pollute /tmp
Generating the submit template for p4 uses tempfile.mkstemp(), which by default puts files in /tmp. For a test that fails, possibly on purpose, this is not cleaned up. Run with TMPDIR pointing into the trash directory so the temp files go away with the test results. To do this required some other minor changes. First, the editor is launched using system(editor + " " + template_file), using shell expansion to build the command string. This doesn't work if editor has a space in it. And is generally unwise as it's easy to fool the shell into doing extra work. Exec the args directly, without shell expansion. Second, without shell expansion, the trick of "P4EDITOR=:" used in the tests doesn't work. Use a real command, true, as the non-interactive editor for testing. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/lib-git-p4.sh')
-rw-r--r--t/lib-git-p4.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/t/lib-git-p4.sh b/t/lib-git-p4.sh
index 4ff2bb1..5aa8adc 100644
--- a/t/lib-git-p4.sh
+++ b/t/lib-git-p4.sh
@@ -48,7 +48,7 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))
P4PORT=localhost:$P4DPORT
P4CLIENT=client
P4USER=author
-P4EDITOR=:
+P4EDITOR=true
unset P4CHARSET
export P4PORT P4CLIENT P4USER P4EDITOR P4CHARSET
@@ -57,6 +57,12 @@ cli="$TRASH_DIRECTORY/cli"
git="$TRASH_DIRECTORY/git"
pidfile="$TRASH_DIRECTORY/p4d.pid"
+# git p4 submit generates a temp file, which will
+# not get cleaned up if the submission fails. Don't
+# clutter up /tmp on the test machine.
+TMPDIR="$TRASH_DIRECTORY"
+export TMPDIR
+
start_p4d() {
mkdir -p "$db" "$cli" "$git" &&
rm -f "$pidfile" &&