]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/scripts/cleanup
Big backport from Enterprise
[bacula/bacula] / regress / scripts / cleanup
index d1eaea50402b17d87fffeedd70e485f544691af9..9f5fbbb53f65c1db30bd4ac8f1a9d021b0ebb541 100755 (executable)
@@ -1,22 +1,69 @@
 #!/bin/sh
 #
+# Copyright (C) 2000-2016 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
 # Cleanup left over files -- both before and after test run
 #
-rm -rf /tmp/FileVolume* tmp/FileVolume*  
-rm -rf /tmp/TestVolume001 /tmp/bacula-restores /tmp/Small*
-rm -rf tmp/original tmp/bacula-restores tmp/Small* tmp/TestVolume*
-rm -rf tmp/restored tmp/largefile tmp/bscan.bsr tmp/log*.out
-rm -rf /tmp/sed_tmp /tmp/file-list
-rm -rf tmp/build tmp/restore-list tmp/restore2-list
-rm -rf tmp/fd.out tmp/dir.out tmp/sd.out tmp/*.jpg
-rm -rf working/log tmp/TEST-*
-rm -rf working/*.bsr
-rm -rf tmp/disk-changer /tmp/disk-changer
+. scripts/functions
+
+cwd=`pwd`
+chmod -R u+rwx ${tmp}
+rm -rf ${tmp}/FileVolume*
+rm -rf ${tmp}/TestVolume001 ${tmp}bacula-restores ${tmp}/Small*
+rm -rf ${tmp}/sed_tmp ${tmp}/file-list
+rm -rf ${tmp}/*
+rm -rf ${working}/log ${tmp}/TEST-*
+rm -rf ${working}/log ${tmp}/Backup-*
+rm -rf ${working}/*.bsr ${working}/log*.sd
+rm -rf ${working}/*.trace ${working}/*.traceback ${working}/*.state
+rm -rf ${working}/@*
+rm -rf ${working}/*
+rm -rf ${tmp}disk-changer
+rm -f ${cwd}/bin/plugins/test-plugin-fd.so
+rm -rf ${cwd}/mnt
 find . -name "gigaslam.gif" -exec rm -f {} \;
 
-bin/bacula stop 2>&1 >/dev/null
-cd bin
-./drop_bacula_tables >/dev/null 2>&1
-./make_bacula_tables >/dev/null 2>&1
+
+# bin directory does not always exist
+if [ -d ${bin} ] ; then
+  if [ -f ${bin}/bacula ] ; then
+     ${bin}/bacula stop -KILL 2>&1 >/dev/null
+  fi
+fi
+
+cd ${scripts}
+./drop_bacula_tables      >/dev/null 2>&1
+./make_bacula_tables      >/dev/null 2>&1
 ./grant_bacula_privileges >/dev/null 2>&1
-cd ..
+cd ${cwd}
+
+if [ x$USE_VTAPE = xyes ]; then
+   rm -rf ${working}/ach
+fi
+
+if [ x$FORCE_DEDUP = xyes ]; then
+   rm -rf ${working}/dde
+   rm -rf ${working}/ddefd
+fi
+
+# Remove cloud test volumes
+if [ x$FORCE_CLOUD = xyes ]; then
+   drv=`echo $CLOUD_DRIVER | tr 'A-Z' 'a-z'`
+   if [ "${drv}" = s3 -o "${drv}" = fakes3 ]; then
+      if [ x${CLOUD_HOSTNAME} != x ]; then
+         if [ x${CLOUD_PROTOCOL} = xHTTPS ]; then
+            endpoint=""
+         else
+            endpoint="--endpoint-url=http://${CLOUD_HOSTNAME}"
+         fi
+      fi
+      if [ x${CLOUD_REGION} != x ]; then
+         region="--region ${CLOUD_REGION}"
+      else
+         region=""
+      fi
+      aws configure set default.s3.signature_version s3v4
+      aws s3 rm s3://${CLOUD_BUCKETNAME} $endpoint --recursive --include 'TestVol*' --include 'Vol*' $region 2>/dev/null >/dev/null
+   fi
+fi