From 6897c0ae70892e40fd7603e4d00662038c01a82d Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Mon, 4 Oct 2021 20:37:50 +0200 Subject: add checks for consistency It works ok, but man, git is good --- exp/exp.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'exp/exp.sh') diff --git a/exp/exp.sh b/exp/exp.sh index 9edf367..59a5ef1 100755 --- a/exp/exp.sh +++ b/exp/exp.sh @@ -1,6 +1,7 @@ #!/bin/bash # This script expects the following variables to be exported: +# - DNA_BACKUP: the path to dna-backup binary # - REPO_PATH: the path of the repo the experiment is based on # - MAX_VERSION: the max number for versions for the experiment # - COMMITS: the name of the file that contains the lists of versions @@ -20,10 +21,35 @@ do $GITC checkout $hash # create diff for this version - $GITC diff --minimal --binary --unified=0 $prev | gzip > $DIFFS/$i.diff.gz + $GITC diff --minimal --binary --unified=0 $prev \ + | gzip \ + > "$DIFFS/$i.diff.gz" # create backup for this version - ../dna-backup commit -v 2 $REPO_PATH $BACKUP + $DNA_BACKUP commit -v 2 $REPO_PATH $BACKUP + + if [[ $(( $i % 4 )) == 0 ]] + then + # check diff correctness + TEMP=$(mktemp -d) + for n in $(seq 0 $i) + do + cat "$DIFFS/$n.diff.gz" \ + | gzip --decompress \ + | git -C $TEMP apply --binary --unidiff-zero --whitespace=nowarn - \ + || echo "Git patchs do not match source" + done + cp $REPO_PATH/.git $TEMP/ + diff --brief --recursive $REPO_PATH $TEMP \ + || echo "dna-backup restore do not match source" + rm -rf $TEMP + + # check backup correctness + TEMP=$(mktemp -d) + $DNA_BACKUP restore -v 2 $BACKUP $TEMP + diff --brief --recursive $REPO_PATH $TEMP + rm -rf $TEMP + fi prev=$hash let i++ -- cgit v1.2.3