mirror of
https://github.com/git/git.git
synced 2024-12-15 12:53:36 +08:00
99e37c2560
Use 'test_atexit' to run cleanup commands to stop 'p4d' at the end of the test script or upon interrupt or failure, as it is shorter, simpler, and more robust than registering such cleanup commands in the trap on EXIT in the test scripts. Note that one of the test scripts, 't9801-git-p4-branch.sh', stops and then re-starts 'p4d' twice in the middle of the script; take care that the cleanup functions to stop 'p4d' are only registered once. Note also that 'git p4' tests invoke different functions in the trap on EXIT ('cleanup') and in the last test before 'test_done' ('kill_p4d'). Register both of these functions with 'test_atexit' for now, and a a later patch in this series will then clean up the redundancy. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
96 lines
1.8 KiB
Bash
Executable File
96 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='git p4 retrieve job info'
|
|
|
|
. ./lib-git-p4.sh
|
|
|
|
test_expect_success 'start p4d' '
|
|
start_p4d
|
|
'
|
|
|
|
test_expect_success 'add p4 jobs' '
|
|
(
|
|
p4_add_job TESTJOB-A &&
|
|
p4_add_job TESTJOB-B
|
|
)
|
|
'
|
|
|
|
test_expect_success 'add p4 files' '
|
|
client_view "//depot/... //client/..." &&
|
|
(
|
|
cd "$cli" &&
|
|
>file1 &&
|
|
p4 add file1 &&
|
|
p4 submit -d "Add file 1"
|
|
)
|
|
'
|
|
|
|
test_expect_success 'check log message of changelist with no jobs' '
|
|
client_view "//depot/... //client/..." &&
|
|
test_when_finished cleanup_git &&
|
|
(
|
|
cd "$git" &&
|
|
git init . &&
|
|
git p4 clone --use-client-spec --destination="$git" //depot@all &&
|
|
cat >expect <<-\EOF &&
|
|
Add file 1
|
|
[git-p4: depot-paths = "//depot/": change = 1]
|
|
|
|
EOF
|
|
git log --format=%B >actual &&
|
|
test_cmp expect actual
|
|
)
|
|
'
|
|
|
|
test_expect_success 'add TESTJOB-A to change 1' '
|
|
(
|
|
cd "$cli" &&
|
|
p4 fix -c 1 TESTJOB-A
|
|
)
|
|
'
|
|
|
|
test_expect_success 'check log message of changelist with one job' '
|
|
client_view "//depot/... //client/..." &&
|
|
test_when_finished cleanup_git &&
|
|
(
|
|
cd "$git" &&
|
|
git init . &&
|
|
git p4 clone --use-client-spec --destination="$git" //depot@all &&
|
|
cat >expect <<-\EOF &&
|
|
Add file 1
|
|
Jobs: TESTJOB-A
|
|
[git-p4: depot-paths = "//depot/": change = 1]
|
|
|
|
EOF
|
|
git log --format=%B >actual &&
|
|
test_cmp expect actual
|
|
)
|
|
'
|
|
|
|
test_expect_success 'add TESTJOB-B to change 1' '
|
|
(
|
|
cd "$cli" &&
|
|
p4 fix -c 1 TESTJOB-B
|
|
)
|
|
'
|
|
|
|
test_expect_success 'check log message of changelist with more jobs' '
|
|
client_view "//depot/... //client/..." &&
|
|
test_when_finished cleanup_git &&
|
|
(
|
|
cd "$git" &&
|
|
git init . &&
|
|
git p4 clone --use-client-spec --destination="$git" //depot@all &&
|
|
cat >expect <<-\EOF &&
|
|
Add file 1
|
|
Jobs: TESTJOB-A TESTJOB-B
|
|
[git-p4: depot-paths = "//depot/": change = 1]
|
|
|
|
EOF
|
|
git log --format=%B >actual &&
|
|
test_cmp expect actual
|
|
)
|
|
'
|
|
|
|
test_done
|