aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-10-09 14:08:34 +0200
committern-peugnet <n.peugnet@free.fr>2021-10-09 14:10:21 +0200
commit64e858b2699f6807cf1cdd7903fe2cf33f3b0ae2 (patch)
treea1767f63f527364380bf5432c9e9625c7e23a4c6
parent2df30c27ead445724d066fc7df301be4d22f3c44 (diff)
downloaddna-backup-64e858b2699f6807cf1cdd7903fe2cf33f3b0ae2.tar.gz
dna-backup-64e858b2699f6807cf1cdd7903fe2cf33f3b0ae2.zip
factorize dna backup runs in exp
-rw-r--r--exp/Makefile15
-rwxr-xr-xexp/exp.sh43
2 files changed, 28 insertions, 30 deletions
diff --git a/exp/Makefile b/exp/Makefile
index 4df2bb6..f49d2f1 100644
--- a/exp/Makefile
+++ b/exp/Makefile
@@ -6,13 +6,14 @@ SHELL := /bin/bash
export LC_NUMERIC :=
export DNA_BACKUP ?= ../dna-backup
+export DNA_PARAMS ?= dna_params
export MAX_VERSION ?= 5
export COMMITS ?= commits
-export DNA_4K ?= dna_4k
-export DNA_8K ?= dna_8k
-export DIFFS ?= diffs
+DNA_4K ?= dna_4k
+DNA_8K ?= dna_8k
NOPACK ?= nopack
export GIT_NOPACK ?= $(abspath $(NOPACK))
+export DIFFS ?= diffs
export REPO_PATH ?= repo
export GIT_PATH ?= $(abspath git)
@@ -64,11 +65,15 @@ $(DNADIRS:%=%.size) $(NOPACK).size: %.size: %.versions run
| sort -k2 \
> $@
-run: $(COMMITS) $(DNA_BACKUP) | $(DATADIRS) $(NOPACK).versions
+run: $(COMMITS) $(DNA_BACKUP) $(DNA_PARAMS) | $(DATADIRS) $(NOPACK).versions
rm -rf $(DATADIRS:%=%/*)
./exp.sh
touch $@
+$(DNA_PARAMS):
+ echo "$(DNA_4K) -c 4096" >> $@
+ echo "$(DNA_8K) -c 8192" >> $@
+
$(DATADIRS) $(NOPACK).versions:
mkdir $@
@@ -92,7 +97,7 @@ clean: mostlyclean
mostlyclean: resultsclean
rm -rf $(DATADIRS) $(DATADIRS:%=%.versions)
- rm -f run $(DATADIRS:%=%.results)
+ rm -f run $(DATADIRS:%=%.results) $(DNA_PARAMS)
resultsclean:
rm -f summary.csv $(SIZEFILES)
diff --git a/exp/exp.sh b/exp/exp.sh
index d5cc4dd..3a32f8f 100755
--- a/exp/exp.sh
+++ b/exp/exp.sh
@@ -2,12 +2,11 @@
# This script expects the following variables to be exported:
# - DNA_BACKUP: the path to dna-backup binary
+# - DNA_PARAMS: the path of the files that desscribes the multiple parameters to test
# - REPO_PATH: the path of the repo the experiment is based on
# - GIT_PATH: the path of the repo git-dir
# - MAX_VERSION: the max number for versions for the experiment
# - COMMITS: the name of the file that contains the lists of versions
-# - DNA_4K: the path fo the dna-backup dir with 4K chunksize
-# - DNA_8K: the path fo the dna-backup dir with 8K chunksize
# - DIFFS: the path of the git diff dir
# - GIT_NOPACK: the path of the git nopack dir
@@ -67,13 +66,12 @@ do
> $(printf "%s.versions/%05d" $GIT_NOPACK $i)
set-git-dir $GIT_PATH
- # Create 4k dna backup for this version
- log "create 4k dna backup for this version"
- $DNA_BACKUP commit -v 2 -c 4096 $REPO_PATH $DNA_4K
-
- # Create 8k dna backup for this version
- log "create 8k dna backup for this version"
- $DNA_BACKUP commit -v 2 $REPO_PATH $DNA_8K
+ # Create dna backups for this version
+ cat $DNA_PARAMS | while read name flags
+ do
+ log "create $name backup for this version"
+ $DNA_BACKUP commit -v 2 $flags $REPO_PATH $name
+ done
if [[ $(( $i % 4 )) == 0 ]]
then
@@ -93,23 +91,18 @@ do
|| log "git patchs restore do not match source"
rm -rf $TEMP
- # Check restore from 4k dna backup
- log "restore from 4k dna backup"
- TEMP=$(mktemp -d)
- $DNA_BACKUP restore -v 2 -c 4096 $DNA_4K $TEMP
- log "check restore from backup"
- diff --brief --recursive $REPO_PATH $TEMP \
- || log "dna backup restore do not match source"
- rm -rf $TEMP
- # Check restore from 8k dna backup
- log "restore from 8k dna backup"
- TEMP=$(mktemp -d)
- $DNA_BACKUP restore -v 2 $DNA_8K $TEMP
- log "check restore from backup"
- diff --brief --recursive $REPO_PATH $TEMP \
- || log "dna backup restore do not match source"
- rm -rf $TEMP
+ # Check restore from dna backups
+ cat $DNA_PARAMS | while read name flags
+ do
+ log "restore from $name backup"
+ TEMP=$(mktemp -d)
+ $DNA_BACKUP restore -v 2 $flags $name $TEMP
+ log "check restore from backup"
+ diff --brief --recursive $REPO_PATH $TEMP \
+ || log "dna backup restore do not match source"
+ rm -rf $TEMP
+ done
fi
prev=$hash