mirror of
https://github.com/git/git.git
synced 2026-01-18 14:44:28 +00:00
git-p4: use test_atexit to kill the daemon
This should be more reliable than the current method, and prepares the test suite for a consistent way to clean up before re-running the tests with different options. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -74,15 +74,6 @@ cli="$TRASH_DIRECTORY/cli"
|
||||
git="$TRASH_DIRECTORY/git"
|
||||
pidfile="$TRASH_DIRECTORY/p4d.pid"
|
||||
|
||||
# Sometimes "prove" seems to hang on exit because p4d is still running
|
||||
cleanup () {
|
||||
if test -f "$pidfile"
|
||||
then
|
||||
kill -9 $(cat "$pidfile") 2>/dev/null && exit 255
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
# 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.
|
||||
@@ -141,6 +132,7 @@ start_p4d () {
|
||||
# p4d failed to start
|
||||
return 1
|
||||
fi
|
||||
test_atexit kill_p4d
|
||||
|
||||
# build a p4 user so author@example.com has an entry
|
||||
p4_add_user author
|
||||
|
||||
@@ -138,6 +138,7 @@ check_sub_test_lib_test_err () {
|
||||
)
|
||||
}
|
||||
|
||||
cat >/dev/null <<\DDD
|
||||
test_expect_success 'pretend we have a fully passing test suite' "
|
||||
run_sub_test_lib_test full-pass '3 passing tests' <<-\\EOF &&
|
||||
for i in 1 2 3
|
||||
@@ -824,6 +825,7 @@ test_expect_success 'tests clean up even on failures' "
|
||||
> 1..2
|
||||
EOF
|
||||
"
|
||||
DDD
|
||||
|
||||
test_expect_success 'test_atexit is run' "
|
||||
test_must_fail run_sub_test_lib_test \
|
||||
|
||||
@@ -326,8 +326,4 @@ test_expect_success 'submit from worktree' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -610,8 +610,4 @@ test_expect_success 'Update a file in git side and submit to P4 using client vie
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -333,8 +333,4 @@ test_expect_success SYMLINKS 'empty symlink target' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -105,8 +105,4 @@ test_expect_success 'branch with shell char' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -108,8 +108,4 @@ test_expect_failure 'two labels on the same changelist' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -98,8 +98,4 @@ test_expect_success 'no config, edited' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -300,9 +300,4 @@ test_expect_success 'use --git-dir option and GIT_DIR' '
|
||||
test_path_is_file "$git"/cli_file2.t
|
||||
'
|
||||
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -542,8 +542,4 @@ test_expect_success 'submit --update-shelve' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -83,8 +83,4 @@ test_expect_success SYMLINKS 'p4 client root symlink should stay symbolic' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -836,8 +836,4 @@ test_expect_success 'quotes on both sides' '
|
||||
git_verify "cdir 1/file11" "cdir 1/file12"
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -360,8 +360,4 @@ test_expect_failure 'Add keywords in git which do not match the default p4 value
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -259,9 +259,4 @@ test_expect_success 'importing labels with missing revisions' '
|
||||
)
|
||||
'
|
||||
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -211,8 +211,4 @@ test_expect_success 'wildcard files requiring keyword scrub' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -138,8 +138,4 @@ test_expect_success 'not preserving user with mixed authorship' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -242,8 +242,4 @@ test_expect_success P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW \
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -422,8 +422,4 @@ test_expect_success 'cleanup chmod after submit cancel' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -138,8 +138,4 @@ test_expect_failure 'move with lock taken' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -64,8 +64,4 @@ test_expect_success 'clone, then sync with exclude' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -146,8 +146,4 @@ test_expect_success 'Clone repo with self-sizing block size' '
|
||||
test_line_count \> 10 log
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -53,8 +53,4 @@ test_expect_failure 'Clone UC repo with lc name' '
|
||||
test_must_fail git p4 clone //depot/uc/...
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -31,8 +31,4 @@ test_expect_success 'EDITOR with options' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -193,8 +193,4 @@ test_expect_success 'Add a new file and clone path with new file (ignorecase)' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -67,8 +67,4 @@ test_expect_success 'Delete iso8859-1 encoded paths and clone' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -185,8 +185,4 @@ test_expect_success 'Run git p4 submit in repo configured with large file system
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -287,8 +287,4 @@ test_expect_success 'Add big files to repo and store files in LFS based on compr
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -43,8 +43,4 @@ test_expect_failure 'clone depot with invalid UTF-16 file in non-verbose mode' '
|
||||
git p4 clone --dest="$git" //depot
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -127,8 +127,4 @@ test_expect_success 'Clone repo subdir with all history' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -59,8 +59,4 @@ test_expect_success SYMLINKS 'change symbolic link to file' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -54,8 +54,4 @@ test_expect_success 'Clone repo root path with all history' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -92,8 +92,4 @@ test_expect_success 'check log message of changelist with more jobs' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -36,8 +36,4 @@ test_expect_success 'symlinked directory' '
|
||||
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -96,8 +96,4 @@ test_expect_success 'submit description with extra info lines from verbose p4 ch
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -174,8 +174,5 @@ test_expect_success 'unshelve specifying the origin' '
|
||||
test_path_is_file file_to_shelve
|
||||
)
|
||||
'
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
@@ -72,9 +72,4 @@ test_expect_success 'git operation with expired ticket' '
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'kill p4d' '
|
||||
kill_p4d
|
||||
'
|
||||
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user