Skip to content

Commit

Permalink
Added test for being able to read various variants of zstd
Browse files Browse the repository at this point in the history
As detailed in openzfs#12022 and openzfs#12008, it turns out the current zstd
implementation is quite nonportable, and results in various
configurations of ondisk header that only each platform can read.

So I've added a test which contains a dataset with a file written by
Linux/x86_64 and one written by FBSD/ppc64.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes openzfs#12030
  • Loading branch information
rincebrain authored and tonyhutter committed Nov 12, 2021
1 parent 5957574 commit 439b4b1
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/runfiles/sanity.run
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ user =
tags = ['functional', 'cli_user', 'zpool_list']

[tests/functional/compression]
tests = ['compress_003_pos']
tests = ['compress_003_pos','compress_zstd_bswap']
tags = ['functional', 'compression']

[tests/functional/exec]
Expand Down
4 changes: 3 additions & 1 deletion tests/zfs-tests/tests/functional/compression/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ dist_pkgdata_SCRIPTS = \
compress_002_pos.ksh \
compress_003_pos.ksh \
compress_004_pos.ksh \
compress_zstd_bswap.ksh \
l2arc_compressed_arc.ksh \
l2arc_compressed_arc_disabled.ksh \
l2arc_encrypted.ksh \
l2arc_encrypted_no_compressed_arc.ksh

dist_pkgdata_DATA = \
compress.cfg
compress.cfg \
testpool_zstd.tar.gz
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2007, Sun Microsystems Inc. All rights reserved.
# Copyright (c) 2021, Rich Ercolani.
# Use is subject to license terms.
#

. $STF_SUITE/include/properties.shlib
. $STF_SUITE/include/libtest.shlib

#
# DESCRIPTION:
# Import a pool containing variously-permuted zstd-compressed files,
# then try to copy them out.

typeset TESTPOOL_ZSTD_FILE=$STF_SUITE/tests/functional/compression/testpool_zstd.tar.gz
verify_runnable "both"

function cleanup
{
destroy_pool testpool_zstd
rm -f $TEST_BASE_DIR/testpool_zstd

}

log_assert "Trying to read data from variously mangled zstd datasets"
log_onexit cleanup

log_must tar --directory $TEST_BASE_DIR -xzSf $TESTPOOL_ZSTD_FILE
log_must zpool import -d $TEST_BASE_DIR testpool_zstd
log_must dd if=/testpool_zstd/x86_64/zstd of=/dev/null
log_must dd if=/testpool_zstd/ppc64_fbsd/zstd of=/dev/null

log_pass "Reading from mangled zstd datasets works as expected."
Binary file not shown.

0 comments on commit 439b4b1

Please sign in to comment.