commit d2181e2cfe0cdf3e3f795b30fa13e6bcfea5aa48 parent dd4146c8d47e62b50f3806ee6e16588bf0d83e02 Author: sin <sin@2f30.org> Date: Fri, 26 Apr 2019 10:57:21 +0100 Add some more tests Diffstat:
M | dotest | | | 44 | ++++++++++++++++++++++++++++++++++++++++---- |
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/dotest b/dotest @@ -9,8 +9,6 @@ test0() ./dup-init -Z none "$repo" ./dup-pack -r "$repo" snap0 < "$data" ./dup-pack -r "$repo" snap1 < "$data" - ./dup-check -r "$repo" snap0 - ./dup-check -r "$repo" snap1 du -sh "$repo" sum0=`sha1sum "$data" | awk '{print $1}'` sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` @@ -28,8 +26,6 @@ test1() ./dup-init -Z snappy "$repo" ./dup-pack -r "$repo" snap0 < "$data" ./dup-pack -r "$repo" snap1 < "$data" - ./dup-check -r "$repo" snap0 - ./dup-check -r "$repo" snap1 du -sh "$repo" sum0=`sha1sum "$data" | awk '{print $1}'` sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` @@ -39,6 +35,46 @@ test1() rm -rf "$repo" "$data" } +test2() +{ + 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-check -r "$repo" snap0 + rm -rf "$repo" "$data" +} + +test3() +{ + 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-check -r "$repo" snap0 + rm -rf "$repo" "$data" +} + +test4() +{ + 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-pack -r "$repo" snap0 < "$data" + sum0=`sha1sum "$data" | awk '{print $1}'` + sum1=`./dup-unpack -r "$repo" snap0 | sha1sum | awk '{print $1}'` + [ "$sum0" = "$sum1" ] + rm -rf "$repo" "$data" +} + make test0 test1 +test2 +test3 +test4