mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
7e98d41a6e
Refactor every test in the entire test suite to use the new boilerplate functions. This also migrates all the test group information into the test files. This patch has been autogenerated via the command: ./tools/convert-group btrfs ceph cifs ext4 f2fs generic nfs ocfs2 overlay perf shared udf xfs Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
71 lines
1.9 KiB
Bash
Executable File
71 lines
1.9 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 029
|
|
#
|
|
# Check if creating a sparse copy ("reflink") of a file on btrfs
|
|
# expectedly fails when it's done between different filesystems or
|
|
# different mount points of the same filesystem.
|
|
#
|
|
# For both situations, these actions are executed:
|
|
# - Copy a file with the reflink=auto option.
|
|
# A normal copy should be created.
|
|
# - Copy a file with the reflink=always option. Should result in
|
|
# error.
|
|
#
|
|
. ./common/preamble
|
|
_begin_fstest auto quick clone
|
|
|
|
# Import common functions.
|
|
. ./common/filter
|
|
. ./common/reflink
|
|
|
|
# real QA test starts here
|
|
_supported_fs btrfs
|
|
|
|
_require_test
|
|
_require_scratch
|
|
_require_cp_reflink
|
|
|
|
reflink_test_dir=$TEST_DIR/test-$seq
|
|
rm -rf $reflink_test_dir
|
|
mkdir $reflink_test_dir
|
|
|
|
_scratch_mkfs > /dev/null 2>&1
|
|
_scratch_mount
|
|
$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $SCRATCH_MNT/original >> $seqres.full
|
|
|
|
_create_reflinks()
|
|
{
|
|
# auto reflink, should fall back to non-reflink
|
|
rm -rf $2
|
|
echo "reflink=auto:"
|
|
cp --reflink=auto $1 $2
|
|
md5sum $1 | _filter_testdir_and_scratch
|
|
md5sum $2 | _filter_testdir_and_scratch
|
|
|
|
# always reflink, should fail outright
|
|
rm -rf $2
|
|
echo "reflink=always:"
|
|
cp --reflink=always $1 $2 >> $seqres.full 2>&1 || echo "cp reflink failed"
|
|
|
|
# The failed target gets created with zero sizes by cp(1) version 8.32. But
|
|
# in older cp(1) version 8.30 target file is not created when the
|
|
# cp --reflink=always fails.
|
|
ls $2 >> $seqres.full 2>&1
|
|
}
|
|
|
|
echo "test reflinks across different devices"
|
|
_create_reflinks $SCRATCH_MNT/original $reflink_test_dir/copy
|
|
|
|
echo "test reflinks across different mountpoints of same device"
|
|
rm -rf $reflink_test_dir/*
|
|
_mount $SCRATCH_DEV $reflink_test_dir
|
|
_create_reflinks $SCRATCH_MNT/original $reflink_test_dir/copy
|
|
$UMOUNT_PROG $reflink_test_dir
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|