2 # Library code for git p4 tests
7 if ! test_have_prereq PYTHON
; then
8 skip_all
='skipping git p4 tests; python not available'
11 ( p4
-h && p4d
-h ) >/dev
/null
2>&1 ||
{
12 skip_all
='skipping git p4 tests; no p4 or p4d'
16 # Try to pick a unique port: guess a large number, then hope
17 # no more than one of each test is running.
19 # This does not handle the case where somebody else is running the
20 # same tests and has chosen the same ports.
22 git_p4_test_start
=9800
23 P4DPORT
=$
((10669 + ($testid - $git_p4_test_start)))
25 export P4PORT
=localhost
:$P4DPORT
26 export P4CLIENT
=client
28 db
="$TRASH_DIRECTORY/db"
29 cli
="$TRASH_DIRECTORY/cli"
30 git
="$TRASH_DIRECTORY/git"
31 pidfile
="$TRASH_DIRECTORY/p4d.pid"
34 mkdir
-p "$db" "$cli" "$git" &&
36 p4d
-q -r "$db" -p $P4DPORT &
39 for i
in 1 2 3 4 5 ; do
40 p4 info
>/dev
/null
2>&1 && break || true
&&
41 echo waiting
for p4d to start
&&
44 # complain if it never started
52 View: //depot/... //client/...
59 # it had better exist for the first kill
61 for i
in 1 2 3 4 5 ; do
62 kill $pid >/dev
/null
2>&1 ||
break
65 # complain if it would not die
66 test_must_fail
kill $pid >/dev
/null
2>&1 &&
67 rm -rf "$db" "$cli" "$pidfile"