make 'got send' regression tests run 'git fsck' on all involved repositories
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
diff --git a/regress/cmdline/common.sh b/regress/cmdline/common.sh
index fbd40bc..260f640 100644
--- a/regress/cmdline/common.sh
+++ b/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"
diff --git a/regress/cmdline/send.sh b/regress/cmdline/send.sh
index eb88e75..5fdd09a 100755
--- a/regress/cmdline/send.sh
+++ b/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"
}