4 # Test the convention that dedupe with length == 0 means "to the end of fileA"
6 # - Try to dedupe "zero" bytes (which means dedupe to EOF).
7 # - Check that the dedupe happened.
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2015, Oracle and/or its affiliates. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
32 status=1 # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
38 rm -rf $tmp.* $testdir
41 # get standard environment, filters and checks
46 # real QA test starts here
52 testdir=$TEST_DIR/test-$seq
56 echo "Create the original files"
58 _pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
59 _pwrite_byte 0x62 0 $((blksz * 257)) $testdir/file2 >> $seqres.full
60 _pwrite_byte 0x62 0 $((blksz * 257)) $testdir/file2.chk >> $seqres.full
61 _dedupe_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
64 md5sum $testdir/file1 | _filter_test_dir
65 md5sum $testdir/file2 | _filter_test_dir
66 md5sum $testdir/file2.chk | _filter_test_dir
68 c1=$(_md5_checksum $testdir/file1)
69 c2=$(_md5_checksum $testdir/file2)
71 test ${c1} != ${c2} || echo "file1 and file2 should not match"
73 echo "Compare against check files"
74 cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
76 echo "Make the original file almost dedup-able"
77 _pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
78 _pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file2 >> $seqres.full
79 _pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file2.chk >> $seqres.full
80 _dedupe_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
83 md5sum $testdir/file1 | _filter_test_dir
84 md5sum $testdir/file2 | _filter_test_dir
85 md5sum $testdir/file2.chk | _filter_test_dir
87 c1=$(_md5_checksum $testdir/file1)
88 c2=$(_md5_checksum $testdir/file2)
90 test ${c1} != ${c2} || echo "file1 and file2 should not match"
92 echo "Compare against check files"
93 cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"
95 echo "Make the original file dedup-able"
96 _pwrite_byte 0x61 0 $((blksz * 256)) $testdir/file1 >> $seqres.full
97 _pwrite_byte 0x61 0 $((blksz * 257)) $testdir/file2 >> $seqres.full
98 _pwrite_byte 0x61 0 $((blksz * 257)) $testdir/file2.chk >> $seqres.full
99 _dedupe_range $testdir/file1 $blksz $testdir/file2 $((blksz * 2)) 0 >> $seqres.full
102 md5sum $testdir/file1 | _filter_test_dir
103 md5sum $testdir/file2 | _filter_test_dir
104 md5sum $testdir/file2.chk | _filter_test_dir
106 c1=$(_md5_checksum $testdir/file1)
107 c2=$(_md5_checksum $testdir/file2)
109 test ${c1} = ${c2} || echo "file1 and file2 should match"
111 echo "Compare against check files"
112 cmp -s $testdir/file2 $testdir/file2.chk || echo "file2 and file2.chk do not match"