Skip to content

Commit 4c05c35

Browse files
rincebraintonyhutter
authored andcommitted
Added test for being able to read various variants of zstd
As detailed in #12022 and #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 <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Rich Ercolani <[email protected]> Closes #12030
1 parent 61788f4 commit 4c05c35

File tree

4 files changed

+59
-2
lines changed

4 files changed

+59
-2
lines changed

tests/runfiles/sanity.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ user =
413413
tags = ['functional', 'cli_user', 'zpool_list']
414414

415415
[tests/functional/compression]
416-
tests = ['compress_003_pos']
416+
tests = ['compress_003_pos','compress_zstd_bswap']
417417
tags = ['functional', 'compression']
418418

419419
[tests/functional/exec]

tests/zfs-tests/tests/functional/compression/Makefile.am

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ dist_pkgdata_SCRIPTS = \
66
compress_002_pos.ksh \
77
compress_003_pos.ksh \
88
compress_004_pos.ksh \
9+
compress_zstd_bswap.ksh \
910
l2arc_compressed_arc.ksh \
1011
l2arc_compressed_arc_disabled.ksh \
1112
l2arc_encrypted.ksh \
1213
l2arc_encrypted_no_compressed_arc.ksh
1314

1415
dist_pkgdata_DATA = \
15-
compress.cfg
16+
compress.cfg \
17+
testpool_zstd.tar.gz
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/ksh -p
2+
#
3+
# CDDL HEADER START
4+
#
5+
# The contents of this file are subject to the terms of the
6+
# Common Development and Distribution License (the "License").
7+
# You may not use this file except in compliance with the License.
8+
#
9+
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10+
# or http://www.opensolaris.org/os/licensing.
11+
# See the License for the specific language governing permissions
12+
# and limitations under the License.
13+
#
14+
# When distributing Covered Code, include this CDDL HEADER in each
15+
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16+
# If applicable, add the following below this CDDL HEADER, with the
17+
# fields enclosed by brackets "[]" replaced with your own identifying
18+
# information: Portions Copyright [yyyy] [name of copyright owner]
19+
#
20+
# CDDL HEADER END
21+
#
22+
23+
#
24+
# Copyright (c) 2007, Sun Microsystems Inc. All rights reserved.
25+
# Copyright (c) 2021, Rich Ercolani.
26+
# Use is subject to license terms.
27+
#
28+
29+
. $STF_SUITE/include/properties.shlib
30+
. $STF_SUITE/include/libtest.shlib
31+
32+
#
33+
# DESCRIPTION:
34+
# Import a pool containing variously-permuted zstd-compressed files,
35+
# then try to copy them out.
36+
37+
typeset TESTPOOL_ZSTD_FILE=$STF_SUITE/tests/functional/compression/testpool_zstd.tar.gz
38+
verify_runnable "both"
39+
40+
function cleanup
41+
{
42+
destroy_pool testpool_zstd
43+
rm -f $TEST_BASE_DIR/testpool_zstd
44+
45+
}
46+
47+
log_assert "Trying to read data from variously mangled zstd datasets"
48+
log_onexit cleanup
49+
50+
log_must tar --directory $TEST_BASE_DIR -xzSf $TESTPOOL_ZSTD_FILE
51+
log_must zpool import -d $TEST_BASE_DIR testpool_zstd
52+
log_must dd if=/testpool_zstd/x86_64/zstd of=/dev/null
53+
log_must dd if=/testpool_zstd/ppc64_fbsd/zstd of=/dev/null
54+
55+
log_pass "Reading from mangled zstd datasets works as expected."
Binary file not shown.

0 commit comments

Comments
 (0)