Skip to content

Commit 0cda8f1

Browse files
committed
fix output of test script
1 parent 4de8e01 commit 0cda8f1

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

tests/test.sh

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for i in 000; do
2424
done
2525
}
2626

27-
for i in $(seq 0 35) ; do
27+
for i in $(seq 0 40) ; do
2828
ret[$i]=0
2929
done
3030

@@ -153,78 +153,99 @@ fi
153153
cat mysqldump-php_test012.sql | grep -E -e '50001 (CREATE|VIEW)' -e '50013 DEFINER' -e 'CREATE.*TRIGGER' > mysqldump-php_test012.filtered.sql
154154
cat mysqldump-php_test013.sql | grep INSERT > mysqldump-php_test013.filtered.sql
155155

156-
echo test $index diff test001.filtered.sql mysqldump_test001.filtered.sql
156+
test="test $index diff test001.filtered.sql mysqldump_test001.filtered.sql"
157157
diff test001.filtered.sql mysqldump_test001.filtered.sql
158158
ret[((index++))]=$?
159-
echo test $index diff mysqldump_test001_complete.filtered.sql mysqldump-php_test001_complete.filtered.sql
159+
if [[ $? -ne 0 ]]; then echo $test; fi
160+
161+
test="test $index diff mysqldump_test001_complete.filtered.sql mysqldump-php_test001_complete.filtered.sql"
160162
diff mysqldump_test001_complete.filtered.sql mysqldump-php_test001_complete.filtered.sql
161163
ret[((index++))]=$?
164+
if [[ $? -ne 0 ]]; then echo $test; fi
162165

163-
echo test $index diff test002.filtered.sql mysqldump_test002.filtered.sql
166+
test="test $index diff test002.filtered.sql mysqldump_test002.filtered.sql"
164167
diff test002.filtered.sql mysqldump_test002.filtered.sql
165168
ret[((index++))]=$?
169+
if [[ $? -ne 0 ]]; then echo $test; fi
166170

167-
echo test $index diff test001.filtered.sql mysqldump-php_test001.filtered.sql
171+
test="test $index diff test001.filtered.sql mysqldump-php_test001.filtered.sql"
168172
diff test001.filtered.sql mysqldump-php_test001.filtered.sql
169173
ret[((index++))]=$?
170-
echo test $index diff test002.filtered.sql mysqldump-php_test002.filtered.sql
174+
if [[ $? -ne 0 ]]; then echo $test; fi
175+
176+
test="test $index diff test002.filtered.sql mysqldump-php_test002.filtered.sql"
171177
diff test002.filtered.sql mysqldump-php_test002.filtered.sql
172178
ret[((index++))]=$?
179+
if [[ $? -ne 0 ]]; then echo $test; fi
173180

174-
echo test $index diff test001.src.checksum mysqldump-php_test001.checksum
181+
test="test $index diff test001.src.checksum mysqldump-php_test001.checksum"
175182
diff test001.src.checksum mysqldump-php_test001.checksum
176183
ret[((index++))]=$?
177-
echo test $index diff test002.src.checksum mysqldump-php_test002.checksum
184+
if [[ $? -ne 0 ]]; then echo $test; fi
185+
186+
test="test $index diff test002.src.checksum mysqldump-php_test002.checksum"
178187
diff test002.src.checksum mysqldump-php_test002.checksum
179188
ret[((index++))]=$?
180-
echo test $index diff test005.src.checksum mysqldump-php_test005.checksum
189+
if [[ $? -ne 0 ]]; then echo $test; fi
190+
191+
test="test $index diff test005.src.checksum mysqldump-php_test005.checksum"
181192
diff test005.src.checksum mysqldump-php_test005.checksum
182193
ret[((index++))]=$?
194+
if [[ $? -ne 0 ]]; then echo $test; fi
183195

184-
echo test $index diff mysqldump_test005.filtered.sql mysqldump-php_test005.filtered.sql
196+
test="test $index diff mysqldump_test005.filtered.sql mysqldump-php_test005.filtered.sql"
185197
diff mysqldump_test005.filtered.sql mysqldump-php_test005.filtered.sql
186198
ret[((index++))]=$?
199+
if [[ $? -ne 0 ]]; then echo $test; fi
187200

188-
echo test $index diff test008.filtered.sql mysqldump-php_test008.filtered.sql
201+
test="test $index diff test008.filtered.sql mysqldump-php_test008.filtered.sql"
189202
diff test008.filtered.sql mysqldump-php_test008.filtered.sql
190203
ret[((index++))]=$?
204+
if [[ $? -ne 0 ]]; then echo $test; fi
191205

192-
#test reset-auto-increment
193-
echo test $index cat mysqldump-php_test009.sql \| grep -i ENGINE \| grep AUTO_INCREMENT
194-
test009=`cat mysqldump-php_test009.sql | grep -i ENGINE | grep AUTO_INCREMENT`
195-
if [[ -z $test009 ]]; then ret[((index++))]=0; else ret[((index++))]=1; fi
206+
#test reset-auto-increment, make sure we don't find an AUTO_INCREMENT
207+
test="test $index cat mysqldump-php_test009.sql \| grep -i ENGINE \| grep AUTO_INCREMENT"
208+
cat mysqldump-php_test009.sql | grep -i ENGINE | (! grep AUTO_INCREMENT)
209+
ret[((index++))]=$?
210+
if [[ $? -ne 0 ]]; then echo $test; fi
196211

197212
# test backup events
198-
echo test $index diff test010.filtered.sql mysqldump-php_test010.filtered.sql
213+
test="test $index diff test010.filtered.sql mysqldump-php_test010.filtered.sql"
199214
diff test010.filtered.sql mysqldump-php_test010.filtered.sql
200215
ret[((index++))]=$?
216+
if [[ $? -ne 0 ]]; then echo $test; fi
201217

202218
if [[ $major -eq 5 && $medium -ge 7 ]]; then
203219
# test virtual column support, with simple inserts forced to complete (a) and complete inserts (b)
204-
echo test $index diff test011.filtered.sql mysqldump-php_test011a.filtered.sql
220+
test="test $index diff test011.filtered.sql mysqldump-php_test011a.filtered.sql"
205221
diff test011.filtered.sql mysqldump-php_test011a.filtered.sql
206222
ret[((index++))]=$?
207-
echo test $index diff test011.filtered.sql mysqldump-php_test011b.filtered.sql
223+
if [[ $? -ne 0 ]]; then echo $test; fi
224+
test="test $index diff test011.filtered.sql mysqldump-php_test011b.filtered.sql"
208225
diff test011.filtered.sql mysqldump-php_test011b.filtered.sql
209226
ret[((index++))]=$?
227+
if [[ $? -ne 0 ]]; then echo $test; fi
210228
else
211229
echo test011 disabled, only valid for mysql server version > 5.7.0
212230
fi
213231

214232
# Test create views, events, trigger
215-
echo test $index diff mysqldump_test012.filtered.sql mysqldump-php_test012.filtered.sql
233+
test="test $index diff mysqldump_test012.filtered.sql mysqldump-php_test012.filtered.sql"
216234
diff mysqldump_test012.filtered.sql mysqldump-php_test012.filtered.sql
217235
ret[((index++))]=$?
236+
if [[ $? -ne 0 ]]; then echo $test; fi
218237

219238
# Make sure we do not find a DEFINER
220-
echo test $index grep 'DEFINER' mysqldump-php_test012_no-definer.sql
239+
test="test $index grep 'DEFINER' mysqldump-php_test012_no-definer.sql"
221240
! grep 'DEFINER' mysqldump-php_test012_no-definer.sql
222241
ret[((index++))]=$?
242+
if [[ $? -ne 0 ]]; then echo $test; fi
223243

224244
# test INSERT IGNORE
225-
echo test $index diff mysqldump_test013.filtered.sql mysqldump-php_test013.filtered.sql
245+
test="test $index diff mysqldump_test013.filtered.sql mysqldump-php_test013.filtered.sql"
226246
diff mysqldump_test013.filtered.sql mysqldump-php_test013.filtered.sql
227247
ret[((index++))]=$?
248+
if [[ $? -ne 0 ]]; then echo $test; fi
228249

229250
rm *.checksum 2> /dev/null
230251
rm *.filtered.sql 2> /dev/null

0 commit comments

Comments
 (0)