]> git.sur5r.net Git - bacula/bacula/commitdiff
Add new tape and new disk tests
authorKern Sibbald <kern@sibbald.com>
Thu, 9 Oct 2003 14:46:09 +0000 (14:46 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 9 Oct 2003 14:46:09 +0000 (14:46 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@738 91ce42f0-d328-0410-95d8-f526ca767f89

regress/all-non-root-tape-tests
regress/all-non-root-tests
regress/scripts/cleanup
regress/tests/.cvsignore [new file with mode: 0644]
regress/tests/four-jobs-test [new file with mode: 0755]
regress/tests/restore-by-file-tape [new file with mode: 0755]
regress/tests/restore2-by-file-test
regress/tests/small-file-size-tape

index 13fffb0056d9ae0e8d55441745ded4a8af0d62a1..3fc6308a567bc46e5bc084dbddfab06e4ef073b5 100755 (executable)
@@ -6,6 +6,7 @@ tests/test0
 tests/backup-bacula-tape
 tests/small-file-size-tape
 tests/two-volume-tape
+tests/restore-by-file-tape
 echo " "
 echo " "
 echo "Test results"
index b673c81542fe8f87f085c8205b31ac5749862d84..fd9a976a344d46fdb62570bb786115811df2d18d 100755 (executable)
@@ -22,6 +22,7 @@ tests/recycle-test
 tests/span-vol-test
 tests/restore-by-file-test
 tests/restore2-by-file-test
+tests/four-jobs-test
 echo " "
 echo " "
 echo "Test results"
index 664066a34dd9428c4cd866382fdfd696d8453f20..4e13d2bf59891c6bc80178f1ee98fd6e10e154b4 100755 (executable)
@@ -7,3 +7,4 @@ 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 working/log
diff --git a/regress/tests/.cvsignore b/regress/tests/.cvsignore
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1
diff --git a/regress/tests/four-jobs-test b/regress/tests/four-jobs-test
new file mode 100755 (executable)
index 0000000..8a1ae5b
--- /dev/null
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory using the compressed option
+#   then backup four times, each with incremental then finally restore.
+#   It should require at least 4 different bsrs.
+#
+cwd=`pwd`
+scripts/copy-test-confs
+scripts/cleanup
+echo "${cwd}/build" >/tmp/file-list
+bin/bacula stop 2>&1 >/dev/null
+bin/drop_sqlite_tables
+bin/make_sqlite_tables
+
+echo " "
+echo " "
+echo " === Starting four-jobs-test  ==="
+echo " === Starting four-jobs-test  ===" >>working/log
+echo " "
+
+bin/bacula start 2>&1 >/dev/null
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+estimate job=CompressedTest listing
+estimate job=CompressedTest listing
+estimate job=CompressedTest listing
+messages
+@output tmp/log1.out
+label storage=File volume=TestVolume001
+run job=CompressedTest yes
+wait
+messages
+quit
+END_OF_DATA
+echo "Backup 1 done"
+# make some files for the incremental to pick up
+touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
+touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
+   
+#
+# run a second job
+#
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+run job=CompressedTest
+yes
+wait
+messages
+quit
+END_OF_DATA
+echo "Backup 2 done"
+touch ${cwd}/build/src/dird/*.c
+touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
+#
+# run a third job
+#
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+label storage=File volume=TestVolume001
+run job=CompressedTest yes
+wait
+messages
+quit
+END_OF_DATA
+echo "Backup 3 done"
+# make some files for the incremental to pick up
+touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
+#
+# run a fourth job
+#
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+label storage=File volume=TestVolume001
+run job=CompressedTest yes
+wait
+messages
+quit
+END_OF_DATA
+echo "Backup 4 done"
+# 
+# now do several restores to ensure we cleanup between jobs
+#
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+restore where=${cwd}/tmp/bacula-restores current all
+yes
+wait
+restore where=${cwd}/tmp/bacula-restores current all
+yes
+wait
+@output tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores current all
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+bin/bacula stop 2>&1 >/dev/null
+grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
+bstat=$?
+grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
+rstat=$?
+diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
+if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+   echo " "
+   echo " "
+   echo "  !!!!! four-jobs-test Bacula source failed!!! !!!!! "
+   echo "  !!!!! four-jobs-test failed!!! !!!!! " >>test.out
+   echo " "
+else
+   echo "  ===== four-jobs-test Bacula source OK ===== "
+   echo "  ===== four-jobs-test OK ===== " >>test.out
+   scripts/cleanup
+fi
diff --git a/regress/tests/restore-by-file-tape b/regress/tests/restore-by-file-tape
new file mode 100755 (executable)
index 0000000..a0358b2
--- /dev/null
@@ -0,0 +1,119 @@
+#!/bin/sh
+#
+# Run a simple backup of the Bacula build directory 
+#   to a tape where the maximum tape file size is set to 1M
+#   then restore a few files from it.
+#
+cwd=`pwd`
+bin/bacula stop  2>&1 >/dev/null
+scripts/copy-tape-confs
+scripts/cleanup-tape
+echo "${cwd}/build" >/tmp/file-list
+sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
+bin/drop_sqlite_tables
+bin/make_sqlite_tables
+cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
+sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
+
+echo " "
+echo " "
+echo " === Starting restore-by-file-tape test ==="
+echo " === Starting restore-by-file-tape test ===" >>working/log
+echo " "
+
+bin/bacula start 2>&1 >/dev/null
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+label storage=DDS-4 volume=TestVolume001 slot=0
+run job=NightlySave level=Full yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@output tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores
+7
+<${cwd}/tmp/restore2-list
+
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+dstat=0
+#
+# We need to stop and start Bacula to
+#  test appending to a previously written tape
+#
+bin/bacula stop  2>&1 >/dev/null
+bin/bacula start 2>&1 >/dev/null
+for i in `cat ${cwd}/tmp/restore2-list`; do
+   diff $i ${cwd}/tmp/bacula-restores$i
+   if [ $? != 0 ] ; then
+      dstat=1
+   fi
+done
+grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
+bstat=$?
+grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
+rstat=$?
+if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+   echo " "
+   echo " "
+   echo "  !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
+   echo "  !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
+   echo " "
+   bin/bacula stop 2>&1 >/dev/null
+   exit 1
+fi
+rm -rf ${cwd}/tmp/bacula-restores
+#
+# Now do a second backup and restore
+#
+bin/console -c bin/console.conf <<END_OF_DATA
+@output /dev/null
+messages
+@output tmp/log1.out
+run job=NightlySave level=Full yes
+wait
+messages
+@#
+@# now do a restore
+@#
+@output tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores
+7
+<${cwd}/tmp/restore2-list
+                                                                                        
+yes
+wait
+messages
+@output
+quit
+END_OF_DATA
+bin/bacula stop 2>&1 >/dev/null
+for i in `cat ${cwd}/tmp/restore2-list`; do
+   diff $i ${cwd}/tmp/bacula-restores$i
+   if [ $? != 0 ] ; then
+      dstat=1
+   fi
+done
+grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
+bstat=$?
+grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
+rstat=$?
+if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
+   echo " "
+   echo " "
+   echo "  !!!!! restore-by-file-tape test Bacula source failed!!! !!!!! "
+   echo "  !!!!! restore-by-file-tape test failed!!! !!!!! " >>test.out
+   echo " "
+else
+   echo "  ===== restore-by-file-tape test Bacula source OK ===== "
+   echo "  ===== restore-by-file-tape test OK ===== " >>test.out
+#  scripts/cleanup
+fi
index 0b39d0a51f2b17e5b193ee5d9e56c390a46dd9ca..5e419e746dc43720a79a96eea101fadad53f924e 100755 (executable)
@@ -7,7 +7,7 @@ cwd=`pwd`
 scripts/copy-test-confs
 scripts/cleanup
 echo "${cwd}/build" >/tmp/file-list
-sed s%\^%${cwd}% ${cwd}/scripts/flist >>${cwd}/tmp/restore2-list
+sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
 bin/bacula stop  2>&1 >/dev/null
 bin/drop_sqlite_tables
 bin/make_sqlite_tables
index 743cc17ff8062ba0271c1f75dbcf89f6b228ce28..9d16fef59bd33dd09e06bb6438a1e05384b16409 100755 (executable)
@@ -10,10 +10,8 @@ scripts/cleanup-tape
 echo "${cwd}/build" >/tmp/file-list
 bin/drop_sqlite_tables
 bin/make_sqlite_tables
-out="tmp/sed_tmp"
-echo "s%# Maximum File Size%  Maximum File Size%g" >${out}
 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
-sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
+sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
 
 echo " "
 echo " "