git-p4: test script
Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Pete Wyckoff committed
Feb 19, 2011 at 08:17 UTC
d00d2ed1c5bd41a26c61236e79e82764baad464b
1 file changed
+55
t/t9800-git-p4.sh
new
+55
@@ -0,0 +1,55 @@
1
+#!/bin/sh
2
+
3
+test_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
+
12
+GITP4=$GIT_BUILD_DIR/contrib/fast-import/git-p4
13
+P4DPORT=10669
14
+
15
+db="$TRASH_DIRECTORY/db"
16
+cli="$TRASH_DIRECTORY/cli"
17
+git="$TRASH_DIRECTORY/git"
18
+
19
+test_debug 'echo p4d -q -d -r "$db" -p $P4DPORT'
20
+test_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
+
28
+test_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
+
43
+test_expect_success 'basic git-p4 clone' '
44
+ "$GITP4" clone --dest="$git" //depot &&
45
+ rm -rf "$git" && mkdir "$git"
46
+'
47
+
48
+test_expect_success 'shutdown' '
49
+ pid=`pgrep -f p4d` &&
50
+ test -n "$pid" &&
51
+ test_debug "ps wl `echo $pid`" &&
52
+ kill $pid
53
+'
54
+
55
+test_done