dedup

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

commit 16a569c3764a0c05b7842a085ef0f76ec91fca8a
parent a86d915a5ecf1dbf93e58b7461a7e6fc97d0643f
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri,  3 May 2019 14:07:05 +0200

improve portability of tests and improve dup-rm test

- read data from stdin, this format is consistent in sha1sum and sha1.
- use environment variable SHA1SUM or fallback to sha1sum (Linux), so
  `make SHA1SUM=sha1 test` works.
- fix dup-rm < $data.

Diffstat:
Mtest000 | 8+++++---
Mtest001 | 8+++++---
Mtest004 | 8+++++---
Mtest005 | 8+++++---
Mtest006 | 8+++++---
5 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/test000 b/test000 @@ -1,6 +1,8 @@ #!/bin/sh set -ex +SHA1SUM=${SHA1SUM:-sha1sum} + repo=`mktemp -d` data=`mktemp` dd if=/dev/urandom of="$data" bs=1M count=64 @@ -8,9 +10,9 @@ dd if=/dev/urandom of="$data" bs=1M count=64 ./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}'` +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}'` [ "$sum0" = "$sum1" ] [ "$sum0" = "$sum2" ] rm -rf "$repo" "$data" diff --git a/test001 b/test001 @@ -1,6 +1,8 @@ #!/bin/sh set -ex +SHA1SUM=${SHA1SUM:-sha1sum} + repo=`mktemp -d` data=`mktemp` dd if=/dev/urandom of="$data" bs=1M count=64 @@ -8,9 +10,9 @@ dd if=/dev/urandom of="$data" bs=1M count=64 ./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}'` +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}'` [ "$sum0" = "$sum1" ] [ "$sum0" = "$sum2" ] rm -rf "$repo" "$data" diff --git a/test004 b/test004 @@ -1,14 +1,16 @@ #!/bin/sh set -ex +SHA1SUM=${SHA1SUM:-sha1sum} + repo=`mktemp -d` data=`mktemp` dd if=/dev/urandom of="$data" bs=1M count=64 ./dup-init "$repo" ./dup-pack -r "$repo" snap0 < "$data" -./dup-rm -r "$repo" snap0 < "$data" +./dup-rm -r "$repo" snap0 ./dup-pack -r "$repo" snap0 < "$data" -sum0=`sha1sum "$data" | awk '{print $1}'` -sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` +sum0=`$SHA1SUM < "$data" | awk '{print $1}'` +sum1=`./dup-unpack -r "$repo" snap0 | $SHA1SUM | awk '{print $1}'` [ "$sum0" = "$sum1" ] rm -rf "$repo" "$data" diff --git a/test005 b/test005 @@ -1,16 +1,18 @@ #!/bin/sh set -ex +SHA1SUM=${SHA1SUM:-sha1sum} + repo=`mktemp -d` data=`mktemp` dd if=/dev/urandom of="$data" bs=1M count=64 ./dup-init "$repo" ./dup-pack -r "$repo" snap0 < "$data" ./dup-gc "$repo" -./dup-rm -r "$repo" snap0 < "$data" +./dup-rm -r "$repo" snap0 ./dup-pack -r "$repo" snap0 < "$data" ./dup-gc "$repo" -sum0=`sha1sum "$data" | awk '{print $1}'` -sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` +sum0=`$SHA1SUM < "$data" | awk '{print $1}'` +sum1=`./dup-unpack -r "$repo" snap0 | $SHA1SUM | awk '{print $1}'` [ "$sum0" = "$sum1" ] rm -rf "$repo" "$data" diff --git a/test006 b/test006 @@ -1,6 +1,8 @@ #!/bin/sh set -ex +SHA1SUM=${SHA1SUM:-sha1sum} + keyfile=`mktemp -u` repo=`mktemp -d` data=`mktemp` @@ -9,10 +11,10 @@ dd if=/dev/urandom of="$data" bs=1M count=64 ./dup-init -E XChaCha20-Poly1305 -k "$keyfile" "$repo" ./dup-pack -k "$keyfile" -r "$repo" snap0 < "$data" ./dup-gc -k "$keyfile" "$repo" -./dup-rm -k "$keyfile" -r "$repo" snap0 < "$data" +./dup-rm -k "$keyfile" -r "$repo" snap0 ./dup-pack -k "$keyfile" -r "$repo" snap0 < "$data" ./dup-gc -k "$keyfile" "$repo" -sum0=`sha1sum "$data" | awk '{print $1}'` -sum1=`./dup-unpack -k "$keyfile" -r "$repo" snap0 | sha1sum | awk '{print $1}'` +sum0=`$SHA1SUM < "$data" | awk '{print $1}'` +sum1=`./dup-unpack -k "$keyfile" -r "$repo" snap0 | $SHA1SUM | awk '{print $1}'` [ "$sum0" = "$sum1" ] rm -rf "$keyfile" "$repo" "$data"