/
smoke_test.sh
executable file
·90 lines (72 loc) · 2.12 KB
/
smoke_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
#
# Tests basic functions of duperemove
#
. `dirname $0`/../config || exit 1
. `dirname $0`/common || exit 1
DEST=$TESTDIR/basic
HASHFILE=$DEST/test.hash
BS=$((128*1024))
SIZE=$((4*1024*1024))
prep_dirs() {
rm -fr $DEST
mkdir -p $DEST
for i in `seq -w 0 2`;
do
DIR="$DEST/testdir_$i"
mkdir -p $DIR/
_run_mkzeros -s $SIZE $DIR/0 $DIR/1 $DIR/2 $DIR/3
done
wait
btrfs fi sync $DEST
}
prep_secondary_dirs() {
#remove a dir to trigger the delete hashes code
rm -fr $DEST/testdir_0 &
#make a fresh directory so we can add it to the hashfile
DIR="$DEST/testdir_extra"
mkdir -p $DIR/
_run_mkzeros -s $SIZE $DIR/0 $DIR/1 $DIR/2 $DIR/3
wait
btrfs fi sync $DEST
}
prep_dirs
# --version and --help options should not return error
_run_duperemove --version
_run_duperemove --help
echo "Test memory only operation"
#memory only, don't dedupe yet
_run_duperemove -rhv $DEST/testdir*
echo "Test fdupes mode"
DIR=$DEST/fdupes
mkdir -p $DIR
_run_dd if=/dev/zero of=$DIR/dupefileA.1 bs=$BS count=10
cp $DIR/dupefileA.1 $DIR/dupefileA.2
cp $DIR/dupefileA.1 $DIR/dupefileA.3
_run_dd if=/dev/urandom of=$DIR/dupefileB.1 bs=$BS count=10 iflag=fullblock
cp $DIR/dupefileB.1 $DIR/dupefileB.2
$FDUPES -r $DIR | _run_duperemove --fdupes -dv
echo "Test write-hashes"
_run_duperemove -rhv --write-hashes=$HASHFILE $DEST/testdir*
echo "Test read-hashes"
_run_duperemove -rhv --read-hashes=$HASHFILE
rm -f $HASHFILE
echo "Test basic hashfile"
#now store in a hashfile, do dedupe
_run_duperemove -rdhv --dedupe-options=block --hashfile=$HASHFILE $DEST/testdir*
echo "Test basic hashfile update"
prep_secondary_dirs
#dedupe again we should only re-hash testdir_extra
_run_duperemove -rdhv --dedupe-options=block --hashfile=$HASHFILE $DEST/testdir*
echo "Test basic hashfile (no fiemap)"
rm -f $HASHFILE
prep_dirs
prep_secondary_dirs
_run_duperemove -rdh --dedupe-options=block,nofiemap --hashfile=$HASHFILE \
$DEST/testdir*
echo "Test basic hashfile (no block dedupe)"
rm -f $HASHFILE
prep_dirs
prep_secondary_dirs
_run_duperemove -rdhv --dedupe-options=noblock --hashfile=$HASHFILE \
$DEST/testdir*