]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/rados/test_dedup_tool.sh
11 if [ "$1" == "--tee" ]; then
22 echo "RUN_EXPECT_SUCC: " "$@"
24 [ $?
-ne 0 ] && die
"expected success, but got failure! cmd: $@"
32 if [ -n "$CEPH_BIN" ] ; then
34 RADOS_TOOL
="$CEPH_BIN/rados"
35 CEPH_TOOL
="$CEPH_BIN/ceph"
36 DEDUP_TOOL
="$CEPH_BIN/ceph-dedup-tool"
38 # executables should be installed by the QA env
39 RADOS_TOOL
=$
(which rados
)
40 CEPH_TOOL
=$
(which ceph
)
41 DEDUP_TOOL
=$
(which ceph-dedup-tool
)
47 [ -x "$RADOS_TOOL" ] || die
"couldn't find $RADOS_TOOL binary to test"
48 [ -x "$CEPH_TOOL" ] || die
"couldn't find $CEPH_TOOL binary to test"
50 run_expect_succ
"$CEPH_TOOL" osd pool create
"$POOL" 8
52 function test_dedup_ratio_fixed
()
55 dd if=/dev
/urandom of
=dedup_object_1k bs
=1K count
=1
56 dd if=dedup_object_1k of
=dedup_object_100k bs
=1K count
=100
58 $RADOS_TOOL -p $POOL put
$OBJ .
/dedup_object_100k
59 RESULT
=$
($DEDUP_TOOL --op estimate
--pool $POOL --chunk-size 1024 --chunk-algorithm fixed
--fingerprint-algorithm sha1
--debug |
grep result |
awk '{print$4}')
60 if [ 1024 -ne $RESULT ];
62 die
"Estimate failed expecting 1024 result $RESULT"
66 dd if=/dev
/zero of
=dedup_object_10m bs
=10M count
=1
68 $RADOS_TOOL -p $POOL put
$OBJ .
/dedup_object_10m
69 RESULT
=$
($DEDUP_TOOL --op estimate
--pool $POOL --chunk-size 4096 --chunk-algorithm fixed
--fingerprint-algorithm sha1
--debug |
grep result |
awk '{print$4}')
70 if [ 4096 -ne $RESULT ];
72 die
"Estimate failed expecting 4096 result $RESULT"
78 dd if=/dev
/zero of
=dedup_object_
$num bs
=4M count
=1
79 $RADOS_TOOL -p $POOL put dedup_object_
$num .
/dedup_object_
$num
82 RESULT
=$
($DEDUP_TOOL --op estimate
--pool $POOL --chunk-size 4096 --chunk-algorithm fixed
--fingerprint-algorithm sha1
--max-thread 4 --debug |
grep result |
awk '{print$2}')
84 if [ 98566144 -ne $RESULT ];
86 die
"Estimate failed expecting 98566144 result $RESULT"
89 rm -rf .
/dedup_object_1k .
/dedup_object_100k .
/dedup_object_10m
92 rm -rf .
/dedup_object_
$num
94 $RADOS_TOOL -p $POOL rm $OBJ
97 $RADOS_TOOL -p $POOL rm dedup_object_
$num
101 test_dedup_ratio_fixed
103 $CEPH_TOOL osd pool delete
$POOL $POOL --yes-i-really-really-mean-it