commit f0fd0aafb69cafd7c84dd294cffda4b3c1d6144a from: Stefan Sperling date: Tue Sep 14 19:21:59 2021 UTC make 'got send' regression tests run 'git fsck' on all involved repositories commit - c2105d002a73e60c6f3194dd96a1a0b09eb34e08 commit + f0fd0aafb69cafd7c84dd294cffda4b3c1d6144a blob - fbd40bcace0448588f375c648b957b069821ab5f blob + 260f6406dd2eba1355d668e2c054b7f09f9f1ee5 --- regress/cmdline/common.sh +++ regress/cmdline/common.sh @@ -119,6 +119,24 @@ git_commit_tree() maybe_pack_repo $repo } +git_fsck() +{ + local testroot="$1" + local repo="$2" + + (cd $repo && git fsck --strict \ + > $testroot/fsck.stdout 2> $testroot/fsck.stderr) + ret="$?" + if [ "$ret" != "0" ]; then + echo -n "git fsck: " + cat $testroot/fsck.stderr + echo "git fsck failed; leaving test data in $testroot" + return 1 + fi + + return 0 +} + make_test_tree() { repo="$1" @@ -186,14 +204,10 @@ test_cleanup() { local testroot="$1" - (cd $testroot/repo && git fsck --strict \ - > $testroot/fsck.stdout 2> $testroot/fsck.stderr) + git_fsck $testroot $testroot/repo ret="$?" if [ "$ret" != "0" ]; then - echo -n "git fsck: " - cat $testroot/fsck.stderr - echo "git fsck failed; leaving test data in $testroot" - return 1 + return $ret fi rm -rf "$testroot" blob - eb88e75caf53cdb64f76ece8d89df60b00089758 blob + 5fdd09a2185f5b0ec3129d8c2ff58780671c2b0a --- regress/cmdline/send.sh +++ regress/cmdline/send.sh @@ -117,7 +117,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -171,7 +176,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stderr.expected $testroot/stderr + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -282,7 +292,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -456,7 +471,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -537,7 +557,12 @@ test_send_clone_and_send() { ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -759,7 +784,10 @@ EOF test_done "$testroot" "1" return 1 fi - test_done "$testroot" "0" + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" + test_done "$testroot" "$ret" } test_send_tag_of_deleted_branch() { @@ -876,7 +904,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -962,7 +995,12 @@ test_send_new_branch() { ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -1094,7 +1132,12 @@ test_send_all_branches() { ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -1194,7 +1237,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo2" + ret="$?" test_done "$testroot" "$ret" } @@ -1310,8 +1358,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" } @@ -1387,7 +1439,12 @@ EOF ret="$?" if [ "$ret" != "0" ]; then diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 fi + + git_fsck "$testroot" "$testroot/repo-clone" + ret="$?" test_done "$testroot" "$ret" }