diff options
author | Antonio Russo <[email protected]> | 2021-01-19 12:53:35 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-01-23 15:47:06 -0800 |
commit | 81f981cd82b04e8d8b27f7d5b5827fa9a25b847c (patch) | |
tree | 7083c5938fc9bf23deea789437bcaf43d34aea60 /contrib | |
parent | 3790aa8176713b98f1b5c8275d537c7eacdc2bcc (diff) |
ZTS: avoid piping to special devices
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 <[email protected]>
Reviewed-by: Attila Fülöp <[email protected]>
Signed-off-by: Antonio Russo <[email protected]>
Closes #11478
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/pyzfs/libzfs_core/test/test_libzfs_core.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py b/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py index a841f96af..08b58b5d1 100644 --- a/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py +++ b/contrib/pyzfs/libzfs_core/test/test_libzfs_core.py @@ -154,8 +154,8 @@ def os_open(name, mode): @contextlib.contextmanager def dev_null(): - with os_open('/dev/null', os.O_WRONLY) as fd: - yield fd + with tempfile.TemporaryFile(suffix='.zstream') as fd: + yield fd.fileno() @contextlib.contextmanager |