fstests: move test group info to test files
[xfstests-dev.git] / tests / generic / 160
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 160
6 #
7 # Check that we can't dedupe immutable files
8 #
9 . ./common/preamble
10 _begin_fstest auto quick clone dedupe
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15     cd /
16     rm -rf $tmp.* $testdir1
17 }
18
19 # Import common functions.
20 . ./common/filter
21 . ./common/attr
22 . ./common/reflink
23
24 # real QA test starts here
25 _require_chattr i
26 _require_test_dedupe
27
28 echo "Format and mount"
29 testdir1="$TEST_DIR/test-$seq"
30 rm -rf $testdir1
31 mkdir $testdir1
32
33 echo "Create the original files"
34 blksz="$(_get_block_size $testdir1)"
35 blks=1000
36 margin='7%'
37 sz=$((blksz * blks))
38 free_blocks0=$(stat -f $testdir1 -c '%f')
39 nr=4
40 filesize=$((blksz * nr))
41 _pwrite_byte 0x61 0 $sz $testdir1/file1 >> $seqres.full
42 _pwrite_byte 0x61 0 $sz $testdir1/file2 >> $seqres.full
43 sync
44
45 do_filter_output()
46 {
47         _filter_test_dir | sed -e 's/Operation not permitted/Permission denied/g'
48 }
49
50 echo "Try dedupe on immutable files"
51 $CHATTR_PROG +i $testdir1/file1 $testdir1/file2
52 _dedupe_range $testdir1/file1 0 $testdir1/file2 0 $blksz 2>&1 | do_filter_output
53 $CHATTR_PROG -i $testdir1/file1 $testdir1/file2
54
55 # success, all done
56 status=0
57 exit