2d354f86d04250e48c2e9fe9358282145a8c477e
1#!/bin/sh
2
3test_description='git-p4 tests'
4
5. ./test-lib.sh
6
7( p4 -h && p4d -h ) >/dev/null 2>&1 || {
8 skip_all='skipping git-p4 tests; no p4 or p4d'
9 test_done
10}
11
12GITP4=$GIT_BUILD_DIR/contrib/fast-import/git-p4
13P4DPORT=10669
14
15db="$TRASH_DIRECTORY/db"
16cli="$TRASH_DIRECTORY/cli"
17git="$TRASH_DIRECTORY/git"
18
19test_debug 'echo p4d -q -d -r "$db" -p $P4DPORT'
20test_expect_success setup '
21 mkdir -p "$db" &&
22 p4d -q -d -r "$db" -p $P4DPORT &&
23 mkdir -p "$cli" &&
24 mkdir -p "$git" &&
25 export P4PORT=localhost:$P4DPORT
26'
27
28test_expect_success 'add p4 files' '
29 cd "$cli" &&
30 p4 client -i <<-EOF &&
31 Client: client
32 Description: client
33 Root: $cli
34 View: //depot/... //client/...
35 EOF
36 export P4CLIENT=client &&
37 echo file1 >file1 &&
38 p4 add file1 &&
39 p4 submit -d "file1" &&
40 cd "$TRASH_DIRECTORY"
41'
42
43test_expect_success 'basic git-p4 clone' '
44 "$GITP4" clone --dest="$git" //depot &&
45 rm -rf "$git" && mkdir "$git"
46'
47
48test_expect_success 'shutdown' '
49 pid=`pgrep -f p4d` &&
50 test -n "$pid" &&
51 test_debug "ps wl `echo $pid`" &&
52 kill $pid
53'
54
55test_done