git p4 test: run as user "author"

The tests use author@example.com as the canonical submitter,
but he does not have an entry in the p4 users database.
This causes the generated change description to complain
that the git and p4 users disagree.  The complaint message
is still valid, but isn't useful in tests.  It was introduced
in 848de9c (git-p4: warn if git authorship won't be retained,
2011-05-13).

Fix t9813 to use @example.com instead of @localhost due to
change in p4_add_user().  Move the function into the git p4
test library so author can be added at initialization time.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Pete Wyckoff
2014-01-21 18:16:43 -05:00
committed by Junio C Hamano
parent 0577849d2b
commit 0055b56e10
2 changed files with 28 additions and 25 deletions

View File

@ -47,9 +47,10 @@ P4DPORT=$((10669 + ($testid - $git_p4_test_start)))
P4PORT=localhost:$P4DPORT
P4CLIENT=client
P4USER=author
P4EDITOR=:
unset P4CHARSET
export P4PORT P4CLIENT P4EDITOR P4CHARSET
export P4PORT P4CLIENT P4USER P4EDITOR P4CHARSET
db="$TRASH_DIRECTORY/db"
cli="$TRASH_DIRECTORY/cli"
@ -96,12 +97,24 @@ start_p4d() {
return 1
fi
# build a p4 user so author@example.com has an entry
p4_add_user author
# build a client
client_view "//depot/... //client/..." &&
return 0
}
p4_add_user() {
name=$1 &&
p4 user -f -i <<-EOF
User: $name
Email: $name@example.com
FullName: Dr. $name
EOF
}
kill_p4d() {
pid=$(cat "$pidfile")
# it had better exist for the first kill