]> git.sur5r.net Git - bacula/bacula/commitdiff
Add exclude-dir-test
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 10 Sep 2009 13:09:50 +0000 (15:09 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 10 Sep 2009 13:09:50 +0000 (15:09 +0200)
regress/DartTestfile.txt.in
regress/all-disk-tests
regress/tests/exclude-dir-test [new file with mode: 0755]

index 1069df0c4b60c0c3b44570bf3016dcbf16292545..e1bd8909343e3b80f3d4195fb7704aad4d22a4e1 100644 (file)
@@ -21,6 +21,7 @@ ADD_TEST(disk:data-encrypt-test "@regressdir@/tests/data-encrypt-test")
 ADD_TEST(disk:differential-test "@regressdir@/tests/differential-test")
 ADD_TEST(disk:encrypt-bug-test "@regressdir@/tests/encrypt-bug-test")
 ADD_TEST(disk:estimate-test "@regressdir@/tests/estimate-test")
+ADD_TEST(disk:exclude-dir-test "@regressdir@/tests/exclude-dir-test")
 ADD_TEST(disk:fast-two-pool-test "@regressdir@/tests/fast-two-pool-test")
 ADD_TEST(disk:fifo-test "@regressdir@/tests/fifo-test")
 ADD_TEST(disk:fileregexp-test "@regressdir@/tests/fileregexp-test")
index b5912d76f9dc3b7f93268d3d43abaaa1955ec983..60a30e919db66b19f479745c78e5a07def19a92e 100755 (executable)
@@ -24,6 +24,7 @@ nice tests/copy-volume-test
 nice tests/data-encrypt-test
 nice tests/encrypt-bug-test
 nice tests/estimate-test
+nice tests/exclude-dir-test
 nice tests/fifo-test
 nice tests/fileregexp-test
 nice tests/backup-to-null
diff --git a/regress/tests/exclude-dir-test b/regress/tests/exclude-dir-test
new file mode 100755 (executable)
index 0000000..6cfacc7
--- /dev/null
@@ -0,0 +1,100 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory using the compressed option
+#   then backup a second time and finally restore it
+#
+TestName="exclude-dir-test"
+JobName=exclude-dir
+. scripts/functions
+
+cwd=`pwd`
+scripts/cleanup
+scripts/copy-test-confs
+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
+
+cat >tmp/bconcmds <<END_OF_DATA
+@$out /dev/null
+messages
+@$out $tmp/log3.out
+estimate job=$JobName listing
+messages
+@$out $tmp/log1.out
+label storage=File volume=TestVolume001
+run job=$JobName yes
+wait
+messages
+@$out $tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores select all storage=File done
+yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File 
+stop_bacula
+
+check_two_logs
+
+# should be ok if we remove the testdir
+rm -rf ${cwd}/build/src/testdir
+check_restore_diff
+
+grep '/testdir' $tmp/log3.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "ERROR: Should not see testdir 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=$(grep -e 'build/po/fr.po$' $tmp/log3.out | wc -l)
+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
+
+end_test