2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook. All Rights Reserved.
7 # Check that we can't dedupe a swapfile.
10 _begin_fstest auto quick swap dedupe
16 _require_scratch_swapfile
17 _require_scratch_dedupe
19 echo "Format and mount"
20 _scratch_mkfs > $seqres.full 2>&1
21 _scratch_mount >> $seqres.full 2>&1
23 testdir="$SCRATCH_MNT/test-$seq"
29 echo "Initialize file"
30 _format_swapfile "$testdir/file1" $((blocks * blksz)) > /dev/null
31 swapon "$testdir/file1"
33 touch "$testdir/file2"
34 $CHATTR_PROG +C "$testdir/file2" >/dev/null 2>&1
37 cp "$testdir/file1" "$testdir/file2"
38 _dedupe_range "$testdir/file1" 0 "$testdir/file2" 0 $((blocks * blksz))
39 _dedupe_range "$testdir/file2" 0 "$testdir/file1" 0 $((blocks * blksz))
42 swapoff "$testdir/file1"