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 https://opensource.org/licenses/CDDL-1.0.
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
37typeset TESTPOOL_ZSTD_FILE=$STF_SUITE/tests/functional/compression/testpool_zstd.tar.gz
38verify_runnable "both"
39
40function cleanup
41{
42	destroy_pool testpool_zstd
43	rm -f $TEST_BASE_DIR/testpool_zstd
44
45}
46
47log_assert "Trying to read data from variously mangled zstd datasets"
48log_onexit cleanup
49
50log_must tar --directory $TEST_BASE_DIR -xzSf $TESTPOOL_ZSTD_FILE
51log_must zpool import -d $TEST_BASE_DIR testpool_zstd
52log_must dd if=/testpool_zstd/x86_64/zstd of=/dev/null
53log_must dd if=/testpool_zstd/ppc64_fbsd/zstd of=/dev/null
54
55log_pass "Reading from mangled zstd datasets works as expected."
56