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) 2023 by Pawel Jakub Dawidek
25#
26
27. $STF_SUITE/include/libtest.shlib
28. $STF_SUITE/include/math.shlib
29. $STF_SUITE/tests/functional/bclone/bclone_common.kshlib
30
31verify_runnable "both"
32
33verify_block_cloning
34verify_crossfs_block_cloning
35
36log_assert "Verify block cloning across datasets with different properties"
37
38log_must zfs set checksum=off $TESTSRCFS
39log_must zfs set compress=off $TESTSRCFS
40log_must zfs set copies=1 $TESTSRCFS
41log_must zfs set recordsize=131072 $TESTSRCFS
42log_must zfs set checksum=fletcher2 $TESTDSTFS
43log_must zfs set compress=lz4 $TESTDSTFS
44log_must zfs set copies=3 $TESTDSTFS
45log_must zfs set recordsize=8192 $TESTDSTFS
46
47FILESIZE=$(random_int_between 2 32767)
48FILESIZE=$((FILESIZE * 64))
49bclone_test text $FILESIZE false $TESTSRCDIR $TESTDSTDIR
50
51log_must zfs set checksum=sha256 $TESTSRCFS
52log_must zfs set compress=zstd $TESTSRCFS
53log_must zfs set copies=2 $TESTSRCFS
54log_must zfs set recordsize=262144 $TESTSRCFS
55log_must zfs set checksum=off $TESTDSTFS
56log_must zfs set compress=off $TESTDSTFS
57log_must zfs set copies=1 $TESTDSTFS
58log_must zfs set recordsize=131072 $TESTDSTFS
59
60FILESIZE=$(random_int_between 2 32767)
61FILESIZE=$((FILESIZE * 64))
62bclone_test text $FILESIZE false $TESTSRCDIR $TESTDSTDIR
63
64log_must zfs set checksum=sha512 $TESTSRCFS
65log_must zfs set compress=gzip $TESTSRCFS
66log_must zfs set copies=2 $TESTSRCFS
67log_must zfs set recordsize=512 $TESTSRCFS
68log_must zfs set checksum=fletcher4 $TESTDSTFS
69log_must zfs set compress=lzjb $TESTDSTFS
70log_must zfs set copies=3 $TESTDSTFS
71log_must zfs set recordsize=16384 $TESTDSTFS
72
73FILESIZE=$(random_int_between 2 32767)
74FILESIZE=$((FILESIZE * 64))
75bclone_test text $FILESIZE false $TESTSRCDIR $TESTDSTDIR
76
77log_must zfs inherit checksum $TESTSRCFS
78log_must zfs inherit compress $TESTSRCFS
79log_must zfs inherit copies $TESTSRCFS
80log_must zfs inherit recordsize $TESTSRCFS
81log_must zfs inherit checksum $TESTDSTFS
82log_must zfs inherit compress $TESTDSTFS
83log_must zfs inherit copies $TESTDSTFS
84log_must zfs inherit recordsize $TESTDSTFS
85
86log_pass
87