diff options
author | Marc Weber <marco-oweber@gmx.de> | 2013-09-01 02:22:01 +0200 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2013-09-01 02:22:01 +0200 |
commit | c823bc37d6b50dcd4e183963922da829a193f0d7 (patch) | |
tree | e732aa0c128d85d504f1e4c4d6ee59401ecc82f8 /pkgs/tools/backup/store-backup | |
parent | 6f6bc030f9e8481220ea908ac9e68da174c225dd (diff) | |
download | nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.tar nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.tar.gz nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.tar.bz2 nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.tar.lz nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.tar.xz nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.tar.zst nixpkgs-c823bc37d6b50dcd4e183963922da829a193f0d7.zip |
backup tools bup, storeBackup: implement sanity check
bup: - update - run make test (all tests seem to pass :-) - add python.modules.readline - add comment that there is no way to prune old revisions (yet)
Diffstat (limited to 'pkgs/tools/backup/store-backup')
-rw-r--r-- | pkgs/tools/backup/store-backup/default.nix | 71 |
1 files changed, 23 insertions, 48 deletions
diff --git a/pkgs/tools/backup/store-backup/default.nix b/pkgs/tools/backup/store-backup/default.nix index e9b98fec710..94493760df8 100644 --- a/pkgs/tools/backup/store-backup/default.nix +++ b/pkgs/tools/backup/store-backup/default.nix @@ -1,4 +1,4 @@ -{stdenv, which, coreutils, perl, fetchurl, perlPackages, makeWrapper, diffutils , writeScriptBin, bzip2}: +{stdenv, which, coreutils, perl, fetchurl, perlPackages, makeWrapper, diffutils , writeScriptBin, writeTextFile, bzip2}: # quick usage: # storeBackup.pl --sourceDir /home/user --backupDir /tmp/my_backup_destination @@ -48,56 +48,31 @@ stdenv.mkDerivation { PATH=$PATH:${dummyMount}/bin - { # simple sanity test, test backup/restore of simple store paths - + ## test it + backup_init(){ mkdir backup + } + latestBackup(){ + echo backup/default/$(ls -1 backup/default | sort | tail -n 1) + } + backup_make(){ + # $1=source + $out/bin/storeBackup.pl --sourceDir "$1" --backupDir "backup" + } + backup_restore_latest(){ + $out/bin/storeBackupRecover.pl -b "$(latestBackup)" -t "$1" -r / + } - backupRestore(){ - source="$2" - echo ========= - echo RUNNING TEST "$1" source: "$source" - mkdir restored - - $out/bin/storeBackup.pl --sourceDir "$source" --backupDir backup - latestBackup=backup/default/$(ls -1 backup/default | sort | tail -n 1) - $out/bin/storeBackupRecover.pl -b "$latestBackup" -t restored -r / - ${diffutils}/bin/diff -r "$source" restored - - # storeBackupCheckSource should return 0 - $out/bin/storeBackupCheckSource.pl -s "$source" -b "$latestBackup" - # storeBackupCheckSource should return not 0 when using different source - ! $out/bin/storeBackupCheckSource.pl -s $TMP -b "$latestBackup" - - # storeBackupCheckBackup should return 0 - $out/bin/storeBackupCheckBackup.pl -c "$latestBackup" - - chmod -R +w restored - rm -fr restored - } - - testDir=$TMP/testDir - - mkdir $testDir - echo X > $testDir/X - ln -s ./X $testDir/Y - - backupRestore 'test 1: backup, restore' $testDir - - # test huge blocks, according to docs files bigger than 100MB get split - # into pieces - dd if=/dev/urandom bs=100M of=block-1 count=1 - dd if=/dev/urandom bs=100M of=block-2 count=1 - cat block-1 block-2 > $testDir/block - backupRestore 'test 1 with huge block' $testDir - - cat block-2 block-1 > $testDir/block - backupRestore 'test 1 with huge block reversed' $testDir - - backupRestore 'test 2: backup, restore' $out - backupRestore 'test 3: backup, restore' $out - backupRestore 'test 4: backup diffutils to same backup locations, restore' ${diffutils} + backup_verify_integrity_latest(){ + $out/bin/storeBackupCheckBackup.pl -c "$(latestBackup)" } - ''; + backup_verify_latest(){ + $out/bin/storeBackupCheckSource.pl -s "$1" -b "$(latestBackup)" + } + + . ${import ../test-case.nix { inherit diffutils writeTextFile; }} + backup_test backup 100M +''; meta = { description = "Storebackup is a backup suite that stores files on other disks"; |