ZTS: Fix redacted_send failures on FreeBSD

We're seeing failures for redacted_deleted and redacted_mount
on FreeBSD 13-15:

    09:58:34.74 diff: /dev/fd/3: No such file or directory
    09:58:34.74 ERROR: diff /dev/fd/3 /dev/fd/4 exited 2

The test was trying to diff the file listings between two directories to
see if they are the same.  The workaround is to do a string comparison
of the directory listings instead of using `diff`.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #16224
This commit is contained in:
Tony Hutter 2024-05-31 15:11:00 -07:00 committed by GitHub
parent e2357561b9
commit a301dc364c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 5 deletions

View File

@ -96,7 +96,7 @@ log_must zfs destroy -R $clone2
log_must eval "zfs send -i $sendfs#book2 --redact book3 $sendfs@snap2 >$stream" log_must eval "zfs send -i $sendfs#book2 --redact book3 $sendfs@snap2 >$stream"
log_must eval "zfs recv $recvfs <$stream" log_must eval "zfs recv $recvfs <$stream"
log_must mount_redacted -f $recvfs log_must mount_redacted -f $recvfs
log_must diff <(ls $send_mnt) <(ls $recv_mnt) log_must [ "$(ls $send_mnt)" == "$(ls $recv_mnt)" ]
log_must zfs destroy -R $recvfs log_must zfs destroy -R $recvfs
log_must zfs rollback -R $sendfs@snap log_must zfs rollback -R $sendfs@snap

View File

@ -71,8 +71,7 @@ log_must ismounted $recvfs
# deleted. # deleted.
contents=$(log_must find $recv_mnt) contents=$(log_must find $recv_mnt)
contents_orig=$(log_must find $send_mnt) contents_orig=$(log_must find $send_mnt)
log_must diff <(echo ${contents//$recv_mnt/}) \ log_must [ "${contents//$recv_mnt/}" == "${contents_orig//$send_mnt/}" ]
<(echo ${contents_orig//$send_mnt/})
log_must zfs redact $sendvol@snap book2 $clonevol@snap log_must zfs redact $sendvol@snap book2 $clonevol@snap
log_must eval "zfs send --redact book2 $sendvol@snap >$stream" log_must eval "zfs send --redact book2 $sendvol@snap >$stream"
log_must eval "zfs receive $recvvol <$stream" log_must eval "zfs receive $recvvol <$stream"
@ -103,7 +102,6 @@ log_must mount_redacted -f $recvfs
log_must ismounted $recvfs log_must ismounted $recvfs
contents=$(log_must find $recv_mnt) contents=$(log_must find $recv_mnt)
contents_orig=$(log_must find $send_mnt) contents_orig=$(log_must find $send_mnt)
log_must diff <(echo ${contents//$recv_mnt/}) \ log_must [ "${contents//$recv_mnt/}" == "${contents_orig//$send_mnt/}" ]
<(echo ${contents_orig//$send_mnt/})
log_pass "Received redacted streams can be mounted." log_pass "Received redacted streams can be mounted."