diff options
Diffstat (limited to 'exp/exp.sh')
-rwxr-xr-x | exp/exp.sh | 30 |
1 files changed, 28 insertions, 2 deletions
@@ -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++ |