Skip to content

Commit

Permalink
Enable block_cloning tests on FreeBSD.
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
  • Loading branch information
pjd authored and behlendorf committed Jan 9, 2024
1 parent 9e0d12e commit f90e6e0
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 29 deletions.
11 changes: 11 additions & 0 deletions tests/runfiles/common.run
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ tests = ['bclone_crossfs_corner_cases_limited',
tags = ['functional', 'bclone']
timeout = 7200

[tests/functional/block_cloning]
tests = ['block_cloning_copyfilerange', 'block_cloning_copyfilerange_partial',
'block_cloning_copyfilerange_fallback',
'block_cloning_disabled_copyfilerange',
'block_cloning_copyfilerange_cross_dataset',
'block_cloning_cross_enc_dataset',
'block_cloning_copyfilerange_fallback_same_txg',
'block_cloning_replay', 'block_cloning_replay_encrypted',
'block_cloning_lwb_buffer_overflow']
tags = ['functional', 'block_cloning']

[tests/functional/bootfs]
tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos',
'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos',
Expand Down
14 changes: 3 additions & 11 deletions tests/runfiles/linux.run
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,9 @@ tests = ['atime_003_pos', 'root_relatime_on']
tags = ['functional', 'atime']

[tests/functional/block_cloning:Linux]
tests = ['block_cloning_copyfilerange', 'block_cloning_copyfilerange_partial',
'block_cloning_copyfilerange_fallback',
'block_cloning_ficlone', 'block_cloning_ficlonerange',
'block_cloning_ficlonerange_partial',
'block_cloning_disabled_copyfilerange', 'block_cloning_disabled_ficlone',
'block_cloning_disabled_ficlonerange',
'block_cloning_copyfilerange_cross_dataset',
'block_cloning_cross_enc_dataset',
'block_cloning_copyfilerange_fallback_same_txg',
'block_cloning_replay', 'block_cloning_replay_encrypted',
'block_cloning_lwb_buffer_overflow']
tests = ['block_cloning_ficlone', 'block_cloning_ficlonerange',
'block_cloning_ficlonerange_partial', 'block_cloning_disabled_ficlone',
'block_cloning_disabled_ficlonerange']
tags = ['functional', 'block_cloning']

[tests/functional/chattr:Linux]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

verify_runnable "global"

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

verify_runnable "global"

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down Expand Up @@ -77,13 +77,14 @@ log_must zfs create -o recordsize=32K $TESTPOOL/$TESTFS
log_must dd if=/dev/urandom of=/$TESTPOOL/$TESTFS/file1 bs=32K count=1022 \
conv=fsync
sync_pool $TESTPOOL
log_must clonefile -c /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/file2
log_must clonefile -f /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/file2
log_must sync

sync_pool $TESTPOOL
log_must have_same_content /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/file2
typeset blocks=$(get_same_blocks $TESTPOOL/$TESTFS file1 $TESTPOOL/$TESTFS file2)
log_must [ "$blocks" = "$(seq -s " " 0 1021)" ]
# FreeBSD's seq(1) leaves a trailing space, remove it with sed(1).
log_must [ "$blocks" = "$(seq -s " " 0 1021 | sed 's/ $//')" ]

log_pass "LWB buffer overflow is not triggered with multiple VDEVs ZIL"

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down Expand Up @@ -90,8 +90,8 @@ log_must zpool freeze $TESTPOOL
#
# 4. TX_CLONE_RANGE: Clone the file
#
log_must clonefile -c /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/clone1
log_must clonefile -c /$TESTPOOL/$TESTFS/file2 /$TESTPOOL/$TESTFS/clone2
log_must clonefile -f /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/clone1
log_must clonefile -f /$TESTPOOL/$TESTFS/file2 /$TESTPOOL/$TESTFS/clone2

#
# 5. Unmount filesystem and export the pool
Expand Down Expand Up @@ -126,6 +126,7 @@ log_must [ "$blocks" = "0 1 2 3" ]

typeset blocks=$(get_same_blocks $TESTPOOL/$TESTFS file2 \
$TESTPOOL/$TESTFS clone2)
log_must [ "$blocks" = "$(seq -s " " 0 2047)" ]
# FreeBSD's seq(1) leaves a trailing space, remove it with sed(1).
log_must [ "$blocks" = "$(seq -s " " 0 2047 | sed 's/ $//')" ]

log_pass $claim
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

verify_runnable "global"

if [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
if is_linux && [[ $(linux_version) -lt $(linux_version "4.5") ]]; then
log_unsupported "copy_file_range not available before Linux 4.5"
fi

Expand Down Expand Up @@ -92,8 +92,8 @@ log_must zpool freeze $TESTPOOL
#
# 4. TX_CLONE_RANGE: Clone the file
#
log_must clonefile -c /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/clone1
log_must clonefile -c /$TESTPOOL/$TESTFS/file2 /$TESTPOOL/$TESTFS/clone2
log_must clonefile -f /$TESTPOOL/$TESTFS/file1 /$TESTPOOL/$TESTFS/clone1
log_must clonefile -f /$TESTPOOL/$TESTFS/file2 /$TESTPOOL/$TESTFS/clone2

#
# 5. Unmount filesystem and export the pool
Expand Down Expand Up @@ -128,6 +128,7 @@ log_must [ "$blocks" = "0 1 2 3" ]

typeset blocks=$(get_same_blocks $TESTPOOL/$TESTFS file2 \
$TESTPOOL/$TESTFS clone2 $PASSPHRASE)
log_must [ "$blocks" = "$(seq -s " " 0 2047)" ]
# FreeBSD's seq(1) leaves a trailing space, remove it with sed(1).
log_must [ "$blocks" = "$(seq -s " " 0 2047 | sed 's/ $//')" ]

log_pass $claim

0 comments on commit f90e6e0

Please sign in to comment.