zfstest - replace dircmp with diff

`dircmp` doesn't exist in Linux while `diff` is already used
by zfstests on all platforms.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Wren Kennedy <john.kennedy@delphix.com>
Signed-off-by: George Melikov <mail@gmelikov.ru>
Closes #5996
This commit is contained in:
George Melikov 2017-04-10 03:17:55 +04:00 committed by Brian Behlendorf
parent f94a5dccf7
commit a8d6ae1e16
3 changed files with 9 additions and 9 deletions

View File

@ -90,9 +90,11 @@ for i in 1 2 3; do
done done
log_note "verify snapshot contents" log_note "verify snapshot contents"
for ds in $datasets; do for ds in $datasets; do
status=$(dircmp /$ds /$ds/.zfs/snapshot/snap | grep "different") diff -q -r /$ds /$ds/.zfs/snapshot/snap > /dev/null 2>&1
[[ -z $status ]] || log_fail "snapshot contents are different from" \ if [[ $? -eq 1 ]]; then
"the filesystem" log_fail "snapshot contents are different from" \
"the filesystem"
fi
done done
# We subtract 3 + 7 + 7 + 1 = 18 for three slashes (/), strlen("TESTFSA") == 7, # We subtract 3 + 7 + 7 + 1 = 18 for three slashes (/), strlen("TESTFSA") == 7,

View File

@ -125,9 +125,8 @@ log_must tar xf $TESTDIR/tarball.snapshot.tar
cd $CWD || log_fail "Could not cd $CWD" cd $CWD || log_fail "Could not cd $CWD"
dircmp $TESTDIR/original $TESTDIR/snapshot > /tmp/zfs_snapshot2.$$ diff -q -r $TESTDIR/original $TESTDIR/snapshot > /dev/null 2>&1
grep different /tmp/zfs_snapshot2.$$ >/dev/null 2>&1 if [[ $? -eq 1 ]]; then
if [[ $? -ne 1 ]]; then
log_fail "Directory structures differ." log_fail "Directory structures differ."
fi fi

View File

@ -123,9 +123,8 @@ log_must tar xf $TESTDIR1/tarball.snapshot.tar
cd $CWD || log_fail "Could not cd $CWD" cd $CWD || log_fail "Could not cd $CWD"
dircmp $TESTDIR1/original $TESTDIR1/snapshot > /tmp/zfs_snapshot2.$$ diff -q -r $TESTDIR1/original $TESTDIR1/snapshot > /dev/null 2>&1
grep different /tmp/zfs_snapshot2.$$ >/dev/null 2>&1 if [[ $? -eq 1 ]]; then
if [[ $? -ne 1 ]]; then
log_fail "Directory structures differ." log_fail "Directory structures differ."
fi fi