Add a few simple tests - dedup - deduplicating backup program
HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
DIR LICENSE
---
DIR commit e7548e9698e9633e09e178a4e5850d6c90960acf
DIR parent f73c0eaa89e1d18a096324afac03a2c9f49bd910
HTML Author: sin <sin@2f30.org>
Date: Thu, 25 Apr 2019 17:58:24 +0100
Add a few simple tests
Diffstat:
A dotest | 40 +++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+), 0 deletions(-)
---
DIR 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