]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/exclude-dir-test
regress: add function to create many dirs
[bacula/bacula] / regress / tests / exclude-dir-test
index 7cea3dc7c2fb4cdd3bc2a9e020c51665807e5aed..b60bb8b80b95da5ed8a317f6ff1c8225119d7f54 100755 (executable)
@@ -10,15 +10,37 @@ JobName=exclude-dir
 cwd=`pwd`
 scripts/cleanup
 scripts/copy-test-confs
-echo "${cwd}/build" >${cwd}/tmp/file-list
-sed 's/Include {/Include { Exclude Dir Containing = ".nobkp"/' $conf/bacula-dir.conf > $tmp/1
+cat >> $conf/bacula-dir.conf <<EOF
+FileSet {
+  Name = "ExcludeDir"
+  Include { 
+    Exclude Dir Containing = ".nobkp"
+    Options {
+      signature=MD5
+      compression=GZIP
+    }
+    File = "$cwd/build"
+  }
+  Include { 
+    Exclude Dir Containing = "bacula-dir.conf"
+    Options {
+      signature=MD5
+      compression=GZIP
+    }
+    File = "$conf"
+    File = "$rscripts"
+    File = "$cwd/build/po"
+  }
+}
+EOF
+sed 's/FileSet="CompressedSet"/FileSet=ExcludeDir/' $conf/bacula-dir.conf >$tmp/1
 cp -f $tmp/1 $conf/bacula-dir.conf
 change_jobname CompressedTest $JobName
 start_test
 
-mkdir ${cwd}/build/src/testdir
-touch ${cwd}/build/src/testdir/.nobkp
-cp ${cwd}/build/src/dird/*.c ${cwd}/build/src/testdir
+mkdir -p ${cwd}/build/src/xxtestdir
+touch ${cwd}/build/src/xxtestdir/.nobkp
+cp ${cwd}/build/src/dird/*.c ${cwd}/build/src/xxtestdir
 
 cat >tmp/bconcmds <<END_OF_DATA
 @$out /dev/null
@@ -45,13 +67,33 @@ stop_bacula
 
 check_two_logs
 
-# should be ok if we remove the testdir
-rm -rf ${cwd}/build/src/testdir
+# should be ok if we remove the xxtestdir
+rm -rf ${cwd}/build/src/xxtestdir
 check_restore_diff
 
-grep '/testdir' $tmp/log3.out > /dev/null
+grep '/xxtestdir' $tmp/log3.out > /dev/null
 if [ $? = 0 ]; then
-    print_debug "ERROR: Should not see testdir in estimate output"
+    print_debug "ERROR: Should not see xxtestdir in estimate output"
+    bstat=2
+fi
+
+# build/po is included 2 times with a different exclude file
+# we shouldn't see scripts and bin
+nb=`egrep -c 'build/po/fr.po$' $tmp/log3.out`
+if [ $nb != 2 ]; then
+    print_debug "ERROR: Should see fr.po two times"
+    bstat=2
+fi
+
+grep $rscripts $tmp/log3.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "ERROR: Should not $rscripts in estimate output"
+    bstat=2
+fi
+
+grep $conf $tmp/log3.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "ERROR: Should not $conf in estimate output"
     bstat=2
 fi