/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. set -e
  3. # Each test script should include testlib.sh
  4. source testlib.sh
  5. # When the test is ready, set this to false for nice outputs.
  6. # if you want to see what happens, use those flags
  7. # verbose="true"
  8. # warnings="true"
  9. # The conffile part of the test, see confs/* for details.
  10. source confs/base.conf
  11. source confs/tarball.conf
  12. export BM_ARCHIVE_ROOT="repository"
  13. export BM_ARCHIVE_METHOD="tarball"
  14. export BM_TARBALL_DIRECTORIES="$PWD/foo-*.d $PWD/bar[0-9][0-9] $PWD/static $PWD/rep-[a-zA-Z\-]*test"
  15. subdirs_to_create="$PWD/foo-bar.d $PWD/foo-foo.d $PWD/bar01 $PWD/bar21 $PWD/static $PWD/rep-sukria-test $PWD/rep-BackupManagertest"
  16. subdirs_to_ignore="foo.d bar-foo rep-132312-test"
  17. source $locallib/sanitize.sh
  18. # The test actions
  19. if [[ -e $BM_ARCHIVE_ROOT ]]; then
  20. rm -f $BM_ARCHIVE_ROOT/*
  21. fi
  22. for dir in "$subdirs_to_ignore $subdirs_to_create"
  23. do
  24. mkdir -p $dir
  25. done
  26. bm_init_env
  27. bm_init_today
  28. create_directories
  29. make_archives
  30. err_code=0
  31. for dir in $subdirs_to_create
  32. do
  33. name=$(get_dir_name $dir long)
  34. if [[ ! -e "$BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX$name.$TODAY.master.tar.gz" ]]; then
  35. err_code=$(($err_code + 1))
  36. echo "ERR: $BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX-$name.$TODAY.master.tar.gz"
  37. fi
  38. done
  39. rm -rf $BM_ARCHIVE_ROOT
  40. for dir in "$subdirs_to_ignore $subdirs_to_create"
  41. do
  42. rm -rf $dir
  43. done
  44. exit $err_code