mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-05-05 08:22:44 +03:00

As described in #11445, the kernel interface kernel_{read,write} no longer act on special devices. In the ZTS, zfs send and receive are tested by piping to these devices, leading to spurious failures (for positive tests) and may mask errors (for negative tests). Until a more permanent mechanism to address this deficiency is developed, clean up the output from the ZTS by avoiding directly piping to or from /dev/null and /dev/zero. For /dev/zero input, simply use a pipe: `cat </dev/zero |` . However, for /dev/null output, the shell semantics for pipe failures means that zfs send error codes will be masked by the successful `| cat >/dev/null` command execution. In that case, use a temporary file under $TEST_BASE_DIR for output in favor. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Attila Fülöp <attila@fueloep.org> Signed-off-by: Antonio Russo <aerusso@aerusso.net> Closes #11478
53 lines
1.3 KiB
Bash
Executable File
53 lines
1.3 KiB
Bash
Executable File
#!/bin/ksh
|
|
|
|
#
|
|
# This file and its contents are supplied under the terms of the
|
|
# Common Development and Distribution License ("CDDL"), version a.0.
|
|
# You may only use this file in accordance with the terms of version
|
|
# a.0 of the CDDL.
|
|
#
|
|
# A full copy of the text of the CDDL should have accompanied this
|
|
# source. A copy of the CDDL is also available via the Internet at
|
|
# http://www.illumos.org/license/CDDL.
|
|
#
|
|
|
|
#
|
|
# Portions Copyright 2020 iXsystems, Inc.
|
|
#
|
|
|
|
. $STF_SUITE/include/libtest.shlib
|
|
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
|
|
|
|
#
|
|
# Description:
|
|
# Verify that send with invalid options will fail gracefully.
|
|
#
|
|
# Strategy:
|
|
# 1. Perform zfs send on the cli with the order of the snapshots reversed
|
|
# 2. Perform zfs send using libzfs with the order of the snapshots reversed
|
|
#
|
|
|
|
verify_runnable "both"
|
|
|
|
log_assert "Verify that send with invalid options will fail gracefully."
|
|
|
|
function cleanup
|
|
{
|
|
datasetexists $testfs && destroy_dataset $testfs -r
|
|
}
|
|
log_onexit cleanup
|
|
|
|
testfs=$POOL/fs
|
|
|
|
log_must zfs create $testfs
|
|
log_must zfs snap $testfs@snap0
|
|
log_must zfs snap $testfs@snap1
|
|
|
|
# Test bad send with the CLI
|
|
log_mustnot eval "zfs send -i $testfs@snap1 $testfs@snap0 >$TEST_BASE_DIR/devnull"
|
|
|
|
# Test bad send with libzfs/libzfs_core
|
|
log_must badsend $testfs@snap0 $testfs@snap1
|
|
|
|
log_pass "Send with invalid options fails gracefully."
|