Skip to content

Commit b99c9d2

Browse files
committed
Added test for being able to read various variants of zstd
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, one for Linux/sparc64, and one written by FBSD/ppc64. Signed-off-by: Rich Ercolani <[email protected]>
1 parent 7d07d1b commit b99c9d2

File tree

3 files changed

+57
-1
lines changed

3 files changed

+57
-1
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]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
pool_destroy 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 cp /testpool_zstd/x86_64/zstd /dev/null
53+
log_must cp /testpool_zstd/sparc64/zstd /dev/null
54+
log_must cp /testpool_zstd/ppc64_fbsd/zstd /dev/null
55+
56+
log_pass "Reading from mangled zstd datasets works as expected."
Binary file not shown.

0 commit comments

Comments
 (0)