PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/t/t08-regexp.sh

http://github.com/sukria/Backup-Manager
Shell | 58 lines | 36 code | 14 blank | 8 comment | 5 complexity | 05715d165f5452917cf7f4ab620c557f MD5 | raw file
 1#! /usr/bin/env bash
 2
 3set -e
 4
 5# Each test script should include testlib.sh
 6source testlib.sh
 7# When the test is ready, set this to false for nice outputs.
 8# if you want to see what happens, use those flags
 9# verbose="true"
10# warnings="true"
11
12# The conffile part of the test, see confs/* for details.
13source confs/base.conf
14source confs/tarball.conf
15
16export BM_ARCHIVE_ROOT="repository"
17export BM_ARCHIVE_METHOD="tarball"
18
19export BM_TARBALL_DIRECTORIES="$PWD/foo-*.d $PWD/bar[0-9][0-9] $PWD/static $PWD/rep-[a-zA-Z\-]*test"
20subdirs_to_create="$PWD/foo-bar.d $PWD/foo-foo.d $PWD/bar01 $PWD/bar21 $PWD/static $PWD/rep-sukria-test $PWD/rep-BackupManagertest"
21subdirs_to_ignore="foo.d bar-foo rep-132312-test"
22source $locallib/sanitize.sh
23
24# The test actions
25
26if [[ -e $BM_ARCHIVE_ROOT ]]; then
27    rm -f $BM_ARCHIVE_ROOT/*
28fi    
29
30for dir in "$subdirs_to_ignore $subdirs_to_create"
31do
32    mkdir -p $dir        
33done
34
35bm_init_env
36bm_init_today
37create_directories
38make_archives
39
40
41err_code=0
42for dir in $subdirs_to_create
43do
44    name=$(get_dir_name $dir long)
45    if [[ ! -e "$BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX$name.$TODAY.master.tar.gz" ]]; then
46        err_code=$(($err_code + 1))
47        echo "ERR: $BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX-$name.$TODAY.master.tar.gz"
48    fi        
49done
50
51rm -rf $BM_ARCHIVE_ROOT
52for dir in "$subdirs_to_ignore $subdirs_to_create"
53do
54    rm -rf $dir        
55done
56
57exit $err_code
58