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 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
31 _require_scratch_swapfile
32 _require_scratch_dedupe
34 echo "Format and mount"
35 _scratch_mkfs > $seqres.full 2>&1
36 _scratch_mount >> $seqres.full 2>&1
38 testdir="$SCRATCH_MNT/test-$seq"
44 echo "Initialize file"
45 _format_swapfile "$testdir/file1" $((blocks * blksz))
46 swapon "$testdir/file1"
48 touch "$testdir/file2"
49 $CHATTR_PROG +C "$testdir/file2" >/dev/null 2>&1
52 cp "$testdir/file1" "$testdir/file2"
53 _dedupe_range "$testdir/file1" 0 "$testdir/file2" 0 $((blocks * blksz))
54 _dedupe_range "$testdir/file2" 0 "$testdir/file1" 0 $((blocks * blksz))
57 swapoff "$testdir/file1"