generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 493
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Facebook.  All Rights Reserved.
4 #
5 # FS QA Test 493
6 #
7 # Check that we can't dedupe a swapfile.
8 #
9 . ./common/preamble
10 _begin_fstest auto quick swap dedupe
11
12 . ./common/filter
13 . ./common/reflink
14
15 _supported_fs generic
16 _require_scratch_swapfile
17 _require_scratch_dedupe
18
19 echo "Format and mount"
20 _scratch_mkfs > $seqres.full 2>&1
21 _scratch_mount >> $seqres.full 2>&1
22
23 testdir="$SCRATCH_MNT/test-$seq"
24 mkdir "$testdir"
25
26 blocks=160
27 blksz=65536
28
29 echo "Initialize file"
30 _format_swapfile "$testdir/file1" $((blocks * blksz)) > /dev/null
31 swapon "$testdir/file1"
32
33 touch "$testdir/file2"
34 $CHATTR_PROG +C "$testdir/file2" >/dev/null 2>&1
35
36 echo "Try to dedupe"
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))
40
41 echo "Tear it down"
42 swapoff "$testdir/file1"
43
44 status=0
45 exit