dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

commit e7548e9698e9633e09e178a4e5850d6c90960acf
parent f73c0eaa89e1d18a096324afac03a2c9f49bd910
Author: sin <sin@2f30.org>
Date:   Thu, 25 Apr 2019 17:58:24 +0100

Add a few simple tests

Diffstat:
Adotest | 40++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)

diff --git a/dotest b/dotest @@ -0,0 +1,40 @@ +#!/bin/sh +set -ex + +test0() +{ + repo=`mktemp -d` + data=`mktemp` + dd if=/dev/urandom of="$data" bs=1M count=64 + ./dup-init -Z none "$repo" + ./dup-pack -r "$repo" snap0 < "$data" + ./dup-pack -r "$repo" snap1 < "$data" + du -sh "$repo" + sum0=`sha1sum "$data" | awk '{print $1}'` + sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` + sum2=`./dup-unpack -r "$repo" snap1 | sha1sum | awk '{print $1}'` + rm -rf "$repo" "$data" + [ "$sum0" = "$sum1" ] || exit 1 + [ "$sum0" = "$sum2" ] || exit 1 +} + +test1() +{ + repo=`mktemp -d` + data=`mktemp` + dd if=/dev/urandom of="$data" bs=1M count=64 + ./dup-init -Z snappy "$repo" + ./dup-pack -r "$repo" snap0 < "$data" + ./dup-pack -r "$repo" snap1 < "$data" + du -sh "$repo" + sum0=`sha1sum "$data" | awk '{print $1}'` + sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` + sum2=`./dup-unpack -r "$repo" snap1 | sha1sum | awk '{print $1}'` + rm -rf "$repo" "$data" + [ "$sum0" = "$sum1" ] || exit 1 + [ "$sum0" = "$sum2" ] || exit 1 +} + +make +test0 +test1