]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add estimate test
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 2 Jul 2009 11:38:59 +0000 (11:38 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 2 Jul 2009 11:38:59 +0000 (11:38 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8948 91ce42f0-d328-0410-95d8-f526ca767f89

regress/DartTestfile.txt.in
regress/all-disk-tests
regress/tests/estimate-test [new file with mode: 0755]

index c3c3f666e9f4e528b128206ec27002d089166402..1069df0c4b60c0c3b44570bf3016dcbf16292545 100644 (file)
@@ -20,6 +20,7 @@ ADD_TEST(disk:copy-volume-test "@regressdir@/tests/copy-volume-test")
 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: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 f9b036071b42a4659c527a80376628cb6a3a24b6..b5912d76f9dc3b7f93268d3d43abaaa1955ec983 100755 (executable)
@@ -23,6 +23,7 @@ nice tests/copy-upgrade-test
 nice tests/copy-volume-test
 nice tests/data-encrypt-test
 nice tests/encrypt-bug-test
+nice tests/estimate-test
 nice tests/fifo-test
 nice tests/fileregexp-test
 nice tests/backup-to-null
diff --git a/regress/tests/estimate-test b/regress/tests/estimate-test
new file mode 100755 (executable)
index 0000000..212a5d4
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory
+#   then restore it.
+#
+TestName="estimate-test"
+. scripts/functions
+JobName=BackupClient1
+
+scripts/cleanup
+scripts/copy-confs
+
+#
+# Zap out any schedule in default conf file so that
+#  it doesn't start during our test
+#
+outf="$tmp/sed_tmp"
+echo "s%  Schedule =%# Schedule =%g" >${outf}
+cp $scripts/bacula-dir.conf $tmp/1
+sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
+
+start_test
+
+mkdir ${cwd}/build/src/test
+touch ${cwd}/build/src/test/test1 ${cwd}/build/src/test/test2
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log1.out
+label volume=TestVolume001 storage=File pool=Default
+run job=$JobName yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@$out $tmp/log2.out
+restore where=$tmp/bacula-restores select all done
+yes
+wait
+messages
+@$out
+quit
+END_OF_DATA
+
+run_bacula
+
+check_two_logs
+check_restore_diff
+
+mv ${cwd}/build/src/test ${cwd}/build/po/test
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log3.out
+estimate listing job=$JobName level=incremental
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+cp $scripts/bacula-dir.conf $tmp/1
+sed 's/JobDefs {/JobDefs { Accurate=yes/' $tmp/1>$scripts/bacula-dir.conf
+
+cat <<END_OF_DATA >$tmp/bconcmds
+@output /dev/null
+messages
+@$out $tmp/log4.out
+reload
+estimate listing job=$JobName level=incremental
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+rm -rf ${cwd}/build/po/test
+
+grep test1 $tmp/log3.out > /dev/null
+if [ $? = 0 ]; then
+    print_debug "Normal estimate shouldn't detect test1 file in $tmp/log3.out"
+    dstat=2
+fi
+
+grep test1 $tmp/log4.out > /dev/null
+if [ $? != 0 ]; then
+    print_debug "Accurate estimate should detect test1 file in $tmp/log4.out"
+    dstat=2
+fi
+
+check_for_zombie_jobs storage=File
+
+stop_bacula
+end_test