t9400: Use test_cmp when appropriate
Consistently using test_cmp would make debugging test scripts far easier, as output from them run under "-v" option becomes readable. Besides, some platforms' "diff" implementations lack "-q" option. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Mar 11, 2010 at 21:40 UTC
4a2284b9997400d46b439a9cd272ba16cbf4f377
1 file changed
+12
-12
t/t9400-git-cvsserver-server.sh
+12
-12
@@ -226,7 +226,7 @@ test_expect_success 'gitcvs.ext.enabled = true' \
226
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
227
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
228
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
229
- diff -q cvswork cvswork2'
229
+ test_cmp cvswork cvswork2'
230
231
rm -fr cvswork2
232
test_expect_success 'gitcvs.ext.enabled = false' \
@@ -247,7 +247,7 @@ test_expect_success 'gitcvs.dbname' \
247
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
248
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
249
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
250
- diff -q cvswork cvswork2 &&
250
+ test_cmp cvswork cvswork2 &&
251
test -f "$SERVERDIR/gitcvs.ext.master.sqlite" &&
252
cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"'
253
@@ -257,7 +257,7 @@ test_expect_success 'gitcvs.ext.dbname' \
257
GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
258
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
259
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
260
- diff -q cvswork cvswork2 &&
260
+ test_cmp cvswork cvswork2 &&
261
test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" &&
262
test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" &&
263
cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"'
@@ -282,7 +282,7 @@ test_expect_success 'cvs update (create new file)' \
282
cd cvswork &&
283
GIT_CONFIG="$git_config" cvs -Q update &&
284
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
285
- diff -q testfile1 ../testfile1'
285
+ test_cmp testfile1 ../testfile1'
286
287
cd "$WORKDIR"
288
test_expect_success 'cvs update (update existing file)' \
@@ -293,7 +293,7 @@ test_expect_success 'cvs update (update existing file)' \
293
cd cvswork &&
294
GIT_CONFIG="$git_config" cvs -Q update &&
295
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
296
- diff -q testfile1 ../testfile1'
296
+ test_cmp testfile1 ../testfile1'
297
298
cd "$WORKDIR"
299
#TODO: cvsserver doesn't support update w/o -d
@@ -322,7 +322,7 @@ test_expect_success 'cvs update (subdirectories)' \
322
(for dir in A A/B A/B/C A/D E; do
323
filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
324
if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" &&
325
- diff -q "$dir/$filename" "../$dir/$filename"; then
325
+ test_cmp "$dir/$filename" "../$dir/$filename"; then
326
:
327
else
328
echo >failure
@@ -349,7 +349,7 @@ test_expect_success 'cvs update (re-add deleted file)' \
349
cd cvswork &&
350
GIT_CONFIG="$git_config" cvs -Q update &&
351
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
352
- diff -q testfile1 ../testfile1'
352
+ test_cmp testfile1 ../testfile1'
353
354
cd "$WORKDIR"
355
test_expect_success 'cvs update (merge)' \
@@ -366,7 +366,7 @@ test_expect_success 'cvs update (merge)' \
366
cd cvswork &&
367
GIT_CONFIG="$git_config" cvs -Q update &&
368
test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
369
- diff -q merge ../merge &&
369
+ test_cmp merge ../merge &&
370
( echo Line 0; cat merge ) >merge.tmp &&
371
mv merge.tmp merge &&
372
cd "$WORKDIR" &&
@@ -377,7 +377,7 @@ test_expect_success 'cvs update (merge)' \
377
cd cvswork &&
378
sleep 1 && touch merge &&
379
GIT_CONFIG="$git_config" cvs -Q update &&
380
- diff -q merge ../expected'
380
+ test_cmp merge ../expected'
381
382
cd "$WORKDIR"
383
@@ -402,13 +402,13 @@ test_expect_success 'cvs update (conflict merge)' \
402
git push gitcvs.git >/dev/null &&
403
cd cvswork &&
404
GIT_CONFIG="$git_config" cvs -Q update &&
405
- diff -q merge ../expected.C'
405
+ test_cmp merge ../expected.C'
406
407
cd "$WORKDIR"
408
test_expect_success 'cvs update (-C)' \
409
'cd cvswork &&
410
GIT_CONFIG="$git_config" cvs -Q update -C &&
411
- diff -q merge ../merge'
411
+ test_cmp merge ../merge'
412
413
cd "$WORKDIR"
414
test_expect_success 'cvs update (merge no-op)' \
@@ -420,7 +420,7 @@ test_expect_success 'cvs update (merge no-op)' \
420
cd cvswork &&
421
sleep 1 && touch merge &&
422
GIT_CONFIG="$git_config" cvs -Q update &&
423
- diff -q merge ../merge'
423
+ test_cmp merge ../merge'
424
425
cd "$WORKDIR"
426
test_expect_success 'cvs update (-p)' '