]> granicus.if.org Git - zfs/commitdiff
zfstest - replace dircmp with diff
authorGeorge Melikov <mail@gmelikov.ru>
Sun, 9 Apr 2017 23:17:55 +0000 (03:17 +0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sun, 9 Apr 2017 23:17:55 +0000 (16:17 -0700)
`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

tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/zfs_snapshot_009_pos.ksh
tests/zfs-tests/tests/functional/snapshot/snapshot_002_pos.ksh
tests/zfs-tests/tests/functional/snapshot/snapshot_006_pos.ksh

index df9c49b9f0d45eafb5fb58ef6b39810aa2cb2bc2..12914f778b75494728c7bdc3315cd7675816fa8b 100755 (executable)
@@ -90,9 +90,11 @@ for i in 1 2 3; do
 done
 log_note "verify snapshot contents"
 for ds in $datasets; do
-       status=$(dircmp /$ds /$ds/.zfs/snapshot/snap | grep "different")
-       [[ -z $status ]] || log_fail "snapshot contents are different from" \
-           "the filesystem"
+       diff -q -r /$ds /$ds/.zfs/snapshot/snap > /dev/null 2>&1
+       if [[ $? -eq 1 ]]; then
+               log_fail "snapshot contents are different from" \
+                   "the filesystem"
+       fi
 done
 
 # We subtract 3 + 7 + 7 + 1 = 18 for three slashes (/), strlen("TESTFSA") == 7,
index 611c4154a0dbafa2e4ba2ffa4a47e3d63a95bd18..f9c05e651958ead07ee859853ff0f017c50180dd 100755 (executable)
@@ -125,9 +125,8 @@ log_must tar xf $TESTDIR/tarball.snapshot.tar
 
 cd $CWD || log_fail "Could not cd $CWD"
 
-dircmp $TESTDIR/original $TESTDIR/snapshot > /tmp/zfs_snapshot2.$$
-grep different /tmp/zfs_snapshot2.$$ >/dev/null 2>&1
-if [[ $? -ne 1 ]]; then
+diff -q -r $TESTDIR/original $TESTDIR/snapshot > /dev/null 2>&1
+if [[ $? -eq 1 ]]; then
        log_fail "Directory structures differ."
 fi
 
index 6269e4a8b5cd5c7dd0c6717202f2585994f0f4a6..632f50059feb17b572af599d827b094d35400bbb 100755 (executable)
@@ -123,9 +123,8 @@ log_must tar xf $TESTDIR1/tarball.snapshot.tar
 
 cd $CWD || log_fail "Could not cd $CWD"
 
-dircmp $TESTDIR1/original $TESTDIR1/snapshot > /tmp/zfs_snapshot2.$$
-grep different /tmp/zfs_snapshot2.$$ >/dev/null 2>&1
-if [[ $? -ne 1 ]]; then
+diff -q -r $TESTDIR1/original $TESTDIR1/snapshot > /dev/null 2>&1
+if [[ $? -eq 1 ]]; then
        log_fail "Directory structures differ."
 fi