Skip to content

Commit b62fd2c

Browse files
committed
ZTS: Skip cross-fs bclone tests if FreeBSD < 14.0
Skip cross filesystem block cloning tests on FreeBSD if running less than version 14.0. Cross filesystem copy_file_range() was added in FreeBSD 14. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #15901
1 parent d92fbe2 commit b62fd2c

File tree

5 files changed

+51
-14
lines changed

5 files changed

+51
-14
lines changed

tests/test-runner/bin/zts-report.py.in

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ idmap_reason = 'Idmapped mount needs kernel 5.12+'
138138
# copy_file_range() is not supported by all kernels
139139
#
140140
cfr_reason = 'Kernel copy_file_range support required'
141-
cfr_cross_reason = 'copy_file_range(2) cross-filesystem needs kernel 5.3+'
141+
142+
if sys.platform.startswith('freebsd'):
143+
cfr_cross_reason = 'copy_file_range(2) cross-filesystem needs FreeBSD 14+'
144+
else:
145+
cfr_cross_reason = 'copy_file_range(2) cross-filesystem needs kernel 5.3+'
142146

143147
#
144148
# These tests are known to fail, thus we use this list to prevent these
@@ -268,6 +272,22 @@ if sys.platform.startswith('freebsd'):
268272
'pool_checkpoint/checkpoint_indirect': ['FAIL', 12623],
269273
'resilver/resilver_restart_001': ['FAIL', known_reason],
270274
'snapshot/snapshot_002_pos': ['FAIL', '14831'],
275+
'bclone/bclone_crossfs_corner_cases': ['SKIP', cfr_cross_reason],
276+
'bclone/bclone_crossfs_corner_cases_limited':
277+
['SKIP', cfr_cross_reason],
278+
'bclone/bclone_crossfs_data': ['SKIP', cfr_cross_reason],
279+
'bclone/bclone_crossfs_embedded': ['SKIP', cfr_cross_reason],
280+
'bclone/bclone_crossfs_hole': ['SKIP', cfr_cross_reason],
281+
'bclone/bclone_diffprops_all': ['SKIP', cfr_cross_reason],
282+
'bclone/bclone_diffprops_checksum': ['SKIP', cfr_cross_reason],
283+
'bclone/bclone_diffprops_compress': ['SKIP', cfr_cross_reason],
284+
'bclone/bclone_diffprops_copies': ['SKIP', cfr_cross_reason],
285+
'bclone/bclone_diffprops_recordsize': ['SKIP', cfr_cross_reason],
286+
'bclone/bclone_prop_sync': ['SKIP', cfr_cross_reason],
287+
'block_cloning/block_cloning_cross_enc_dataset':
288+
['SKIP', cfr_cross_reason],
289+
'block_cloning/block_cloning_copyfilerange_cross_dataset':
290+
['SKIP', cfr_cross_reason]
271291
})
272292
elif sys.platform.startswith('linux'):
273293
maybe.update({

tests/zfs-tests/include/libtest.shlib

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,8 @@ function compare_version_gte
6161
[ "$(printf "$1\n$2" | sort -V | tail -n1)" = "$1" ]
6262
}
6363

64-
# Linux kernel version comparison function
65-
#
66-
# $1 Linux version ("4.10", "2.6.32") or blank for installed Linux version
67-
#
68-
# Used for comparison: if [ $(linux_version) -ge $(linux_version "2.6.32") ]
69-
#
70-
function linux_version
64+
# Helper function used by linux_version() and freebsd_version()
65+
function kernel_version
7166
{
7267
typeset ver="$1"
7368

@@ -83,6 +78,24 @@ function linux_version
8378
echo $((version * 100000 + major * 1000 + minor))
8479
}
8580

81+
# Linux kernel version comparison function
82+
#
83+
# $1 Linux version ("4.10", "2.6.32") or blank for installed Linux version
84+
#
85+
# Used for comparison: if [ $(linux_version) -ge $(linux_version "2.6.32") ]
86+
function linux_version {
87+
kernel_version "$1"
88+
}
89+
90+
# FreeBSD version comparison function
91+
#
92+
# $1 FreeBSD version ("13.2", "14.0") or blank for installed FreeBSD version
93+
#
94+
# Used for comparison: if [ $(freebsd_version) -ge $(freebsd_version "13.2") ]
95+
function freebsd_version {
96+
kernel_version "$1"
97+
}
98+
8699
# Determine if this is a Linux test system
87100
#
88101
# Return 0 if platform Linux, 1 if otherwise

tests/zfs-tests/tests/functional/bclone/bclone_common.kshlib

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ function verify_crossfs_block_cloning
4242
if is_linux && [[ $(linux_version) -lt $(linux_version "5.3") ]]; then
4343
log_unsupported "copy_file_range can't copy cross-filesystem before Linux 5.3"
4444
fi
45+
46+
# Cross dataset block cloning only supported on FreeBSD 14+
47+
# https://github.com/freebsd/freebsd-src/commit/969071be938c
48+
if is_freebsd && [ $(freebsd_version) -lt $(freebsd_version 14.0) ] ; then
49+
log_unsupported "Cloning across datasets not supported in $(uname -r)"
50+
fi
4551
}
4652

4753
# Unused.

tests/zfs-tests/tests/functional/block_cloning/block_cloning_copyfilerange_cross_dataset.ksh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626

2727
. $STF_SUITE/include/libtest.shlib
2828
. $STF_SUITE/tests/functional/block_cloning/block_cloning.kshlib
29+
. $STF_SUITE/tests/functional/bclone/bclone_common.kshlib
2930

3031
verify_runnable "global"
3132

32-
if is_linux && [[ $(linux_version) -lt $(linux_version "5.3") ]]; then
33-
log_unsupported "copy_file_range can't copy cross-filesystem before Linux 5.3"
34-
fi
33+
verify_crossfs_block_cloning
3534

3635
claim="The copy_file_range syscall can clone across datasets."
3736

tests/zfs-tests/tests/functional/block_cloning/block_cloning_cross_enc_dataset.ksh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626

2727
. $STF_SUITE/include/libtest.shlib
2828
. $STF_SUITE/tests/functional/block_cloning/block_cloning.kshlib
29+
. $STF_SUITE/tests/functional/bclone/bclone_common.kshlib
2930

3031
verify_runnable "global"
3132

32-
if is_linux && [[ $(linux_version) -lt $(linux_version "5.3") ]]; then
33-
log_unsupported "copy_file_range can't copy cross-filesystem before Linux 5.3"
34-
fi
33+
verify_crossfs_block_cloning
3534

3635
claim="Block cloning across encrypted datasets."
3736

0 commit comments

Comments
 (0)