Skip to content

Commit 4a2284b

Browse files
committed
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 <[email protected]>
1 parent 7ff8b79 commit 4a2284b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

t/t9400-git-cvsserver-server.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ test_expect_success 'gitcvs.ext.enabled = true' \
226226
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
227227
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
228228
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
229-
diff -q cvswork cvswork2'
229+
test_cmp cvswork cvswork2'
230230

231231
rm -fr cvswork2
232232
test_expect_success 'gitcvs.ext.enabled = false' \
@@ -247,7 +247,7 @@ test_expect_success 'gitcvs.dbname' \
247247
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
248248
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
249249
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
250-
diff -q cvswork cvswork2 &&
250+
test_cmp cvswork cvswork2 &&
251251
test -f "$SERVERDIR/gitcvs.ext.master.sqlite" &&
252252
cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"'
253253

@@ -257,7 +257,7 @@ test_expect_success 'gitcvs.ext.dbname' \
257257
GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
258258
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
259259
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&
260-
diff -q cvswork cvswork2 &&
260+
test_cmp cvswork cvswork2 &&
261261
test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" &&
262262
test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" &&
263263
cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"'
@@ -282,7 +282,7 @@ test_expect_success 'cvs update (create new file)' \
282282
cd cvswork &&
283283
GIT_CONFIG="$git_config" cvs -Q update &&
284284
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
285-
diff -q testfile1 ../testfile1'
285+
test_cmp testfile1 ../testfile1'
286286

287287
cd "$WORKDIR"
288288
test_expect_success 'cvs update (update existing file)' \
@@ -293,7 +293,7 @@ test_expect_success 'cvs update (update existing file)' \
293293
cd cvswork &&
294294
GIT_CONFIG="$git_config" cvs -Q update &&
295295
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
296-
diff -q testfile1 ../testfile1'
296+
test_cmp testfile1 ../testfile1'
297297

298298
cd "$WORKDIR"
299299
#TODO: cvsserver doesn't support update w/o -d
@@ -322,7 +322,7 @@ test_expect_success 'cvs update (subdirectories)' \
322322
(for dir in A A/B A/B/C A/D E; do
323323
filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
324324
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
326326
:
327327
else
328328
echo >failure
@@ -349,7 +349,7 @@ test_expect_success 'cvs update (re-add deleted file)' \
349349
cd cvswork &&
350350
GIT_CONFIG="$git_config" cvs -Q update &&
351351
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
352-
diff -q testfile1 ../testfile1'
352+
test_cmp testfile1 ../testfile1'
353353

354354
cd "$WORKDIR"
355355
test_expect_success 'cvs update (merge)' \
@@ -366,7 +366,7 @@ test_expect_success 'cvs update (merge)' \
366366
cd cvswork &&
367367
GIT_CONFIG="$git_config" cvs -Q update &&
368368
test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
369-
diff -q merge ../merge &&
369+
test_cmp merge ../merge &&
370370
( echo Line 0; cat merge ) >merge.tmp &&
371371
mv merge.tmp merge &&
372372
cd "$WORKDIR" &&
@@ -377,7 +377,7 @@ test_expect_success 'cvs update (merge)' \
377377
cd cvswork &&
378378
sleep 1 && touch merge &&
379379
GIT_CONFIG="$git_config" cvs -Q update &&
380-
diff -q merge ../expected'
380+
test_cmp merge ../expected'
381381

382382
cd "$WORKDIR"
383383

@@ -402,13 +402,13 @@ test_expect_success 'cvs update (conflict merge)' \
402402
git push gitcvs.git >/dev/null &&
403403
cd cvswork &&
404404
GIT_CONFIG="$git_config" cvs -Q update &&
405-
diff -q merge ../expected.C'
405+
test_cmp merge ../expected.C'
406406

407407
cd "$WORKDIR"
408408
test_expect_success 'cvs update (-C)' \
409409
'cd cvswork &&
410410
GIT_CONFIG="$git_config" cvs -Q update -C &&
411-
diff -q merge ../merge'
411+
test_cmp merge ../merge'
412412

413413
cd "$WORKDIR"
414414
test_expect_success 'cvs update (merge no-op)' \
@@ -420,7 +420,7 @@ test_expect_success 'cvs update (merge no-op)' \
420420
cd cvswork &&
421421
sleep 1 && touch merge &&
422422
GIT_CONFIG="$git_config" cvs -Q update &&
423-
diff -q merge ../merge'
423+
test_cmp merge ../merge'
424424

425425
cd "$WORKDIR"
426426
test_expect_success 'cvs update (-p)' '

0 commit comments

Comments
 (0)