Browse Source

Merge branch 'en/test-cleanup'

Test fixes.

* en/test-cleanup:
  t6022, t6046: fix flaky files-are-updated checks
maint
Junio C Hamano 5 years ago
parent
commit
74f172e39e
  1. 19
      t/t6022-merge-rename.sh
  2. 21
      t/t6046-merge-skip-unneeded-updates.sh

19
t/t6022-merge-rename.sh

@ -243,8 +243,7 @@ test_expect_success 'merge of identical changes in a renamed file' '
git reset --hard && git reset --hard &&
git checkout change+rename && git checkout change+rename &&


test-tool chmtime =31337 B && test-tool chmtime --get -3600 B >old-mtime &&
test-tool chmtime --get B >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge change >out && GIT_MERGE_VERBOSITY=3 git merge change >out &&


test-tool chmtime --get B >new-mtime && test-tool chmtime --get B >new-mtime &&
@ -253,10 +252,12 @@ test_expect_success 'merge of identical changes in a renamed file' '
git reset --hard HEAD^ && git reset --hard HEAD^ &&
git checkout change && git checkout change &&


test-tool chmtime =-1 M && # A will be renamed to B; we check mtimes and file presence
test-tool chmtime --get M >old-mtime && test_path_is_missing B &&
test-tool chmtime --get -3600 A >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge change+rename >out && GIT_MERGE_VERBOSITY=3 git merge change+rename >out &&


test_path_is_missing A &&
test-tool chmtime --get B >new-mtime && test-tool chmtime --get B >new-mtime &&
test $(cat old-mtime) -lt $(cat new-mtime) test $(cat old-mtime) -lt $(cat new-mtime)
' '
@ -645,7 +646,7 @@ test_expect_success 'setup avoid unnecessary update, normal rename' '


test_expect_success 'avoid unnecessary update, normal rename' ' test_expect_success 'avoid unnecessary update, normal rename' '
git checkout -q avoid-unnecessary-update-1^0 && git checkout -q avoid-unnecessary-update-1^0 &&
test-tool chmtime --get =1000000000 rename >expect && test-tool chmtime --get -3600 rename >expect &&
git merge merge-branch-1 && git merge merge-branch-1 &&
test-tool chmtime --get rename >actual && test-tool chmtime --get rename >actual &&
test_cmp expect actual # "rename" should have stayed intact test_cmp expect actual # "rename" should have stayed intact
@ -677,7 +678,7 @@ test_expect_success 'setup to test avoiding unnecessary update, with D/F conflic


test_expect_success 'avoid unnecessary update, with D/F conflict' ' test_expect_success 'avoid unnecessary update, with D/F conflict' '
git checkout -q avoid-unnecessary-update-2^0 && git checkout -q avoid-unnecessary-update-2^0 &&
test-tool chmtime --get =1000000000 df >expect && test-tool chmtime --get -3600 df >expect &&
git merge merge-branch-2 && git merge merge-branch-2 &&
test-tool chmtime --get df >actual && test-tool chmtime --get df >actual &&
test_cmp expect actual # "df" should have stayed intact test_cmp expect actual # "df" should have stayed intact
@ -708,7 +709,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '


test_expect_success 'avoid unnecessary update, dir->(file,nothing)' ' test_expect_success 'avoid unnecessary update, dir->(file,nothing)' '
git checkout -q master^0 && git checkout -q master^0 &&
test-tool chmtime --get =1000000000 df >expect && test-tool chmtime --get -3600 df >expect &&
git merge side && git merge side &&
test-tool chmtime --get df >actual && test-tool chmtime --get df >actual &&
test_cmp expect actual # "df" should have stayed intact test_cmp expect actual # "df" should have stayed intact
@ -737,7 +738,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '


test_expect_success 'avoid unnecessary update, modify/delete' ' test_expect_success 'avoid unnecessary update, modify/delete' '
git checkout -q master^0 && git checkout -q master^0 &&
test-tool chmtime --get =1000000000 file >expect && test-tool chmtime --get -3600 file >expect &&
test_must_fail git merge side && test_must_fail git merge side &&
test-tool chmtime --get file >actual && test-tool chmtime --get file >actual &&
test_cmp expect actual # "file" should have stayed intact test_cmp expect actual # "file" should have stayed intact
@ -765,7 +766,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '


test_expect_success 'avoid unnecessary update, rename/add-dest' ' test_expect_success 'avoid unnecessary update, rename/add-dest' '
git checkout -q master^0 && git checkout -q master^0 &&
test-tool chmtime --get =1000000000 newfile >expect && test-tool chmtime --get -3600 newfile >expect &&
git merge side && git merge side &&
test-tool chmtime --get newfile >actual && test-tool chmtime --get newfile >actual &&
test_cmp expect actual # "file" should have stayed intact test_cmp expect actual # "file" should have stayed intact

21
t/t6046-merge-skip-unneeded-updates.sh

@ -71,8 +71,7 @@ test_expect_success '1a-L: Modify(A)/Modify(B), change on B subset of A' '


git checkout A^0 && git checkout A^0 &&


test-tool chmtime =-1 b && test-tool chmtime --get -3600 b >old-mtime &&
test-tool chmtime --get b >old-mtime &&


GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&


@ -102,8 +101,7 @@ test_expect_success '1a-R: Modify(A)/Modify(B), change on B subset of A' '


git checkout B^0 && git checkout B^0 &&


test-tool chmtime =-1 b && test-tool chmtime --get -3600 b >old-mtime &&
test-tool chmtime --get b >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err && GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&


# Make sure b WAS updated # Make sure b WAS updated
@ -198,8 +196,7 @@ test_expect_success '2a-R: Modify/rename, merge into rename side' '


git checkout B^0 && git checkout B^0 &&


test-tool chmtime =-1 c && test-tool chmtime --get -3600 c >old-mtime &&
test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err && GIT_MERGE_VERBOSITY=3 git merge -s recursive A^0 >out 2>err &&


# Make sure c WAS updated # Make sure c WAS updated
@ -266,8 +263,7 @@ test_expect_success '2b-L: Rename+Mod(A)/Mod(B), B mods subset of A' '


git checkout A^0 && git checkout A^0 &&


test-tool chmtime =-1 c && test-tool chmtime --get -3600 c >old-mtime &&
test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&


test_must_be_empty err && test_must_be_empty err &&
@ -373,8 +369,7 @@ test_expect_success '2c: Modify b & add c VS rename b->c' '


git checkout A^0 && git checkout A^0 &&


test-tool chmtime =-1 c && test-tool chmtime --get -3600 c >old-mtime &&
test-tool chmtime --get c >old-mtime &&
GIT_MERGE_VERBOSITY=3 && GIT_MERGE_VERBOSITY=3 &&
export GIT_MERGE_VERBOSITY && export GIT_MERGE_VERBOSITY &&
test_must_fail git merge -s recursive B^0 >out 2>err && test_must_fail git merge -s recursive B^0 >out 2>err &&
@ -679,8 +674,7 @@ test_expect_failure '4a: Change on A, change on B subset of A, dirty mods presen
git checkout A^0 && git checkout A^0 &&
echo "File rewritten" >b && echo "File rewritten" >b &&


test-tool chmtime =-1 b && test-tool chmtime --get -3600 b >old-mtime &&
test-tool chmtime --get b >old-mtime &&


GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&


@ -747,8 +741,7 @@ test_expect_success '4b: Rename+Mod(A)/Mod(B), change on B subset of A, dirty mo
git checkout A^0 && git checkout A^0 &&
echo "File rewritten" >c && echo "File rewritten" >c &&


test-tool chmtime =-1 c && test-tool chmtime --get -3600 c >old-mtime &&
test-tool chmtime --get c >old-mtime &&


GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err && GIT_MERGE_VERBOSITY=3 git merge -s recursive B^0 >out 2>err &&



Loading…
Cancel
Save