]> git.sur5r.net Git - bacula/bacula/commitdiff
Create dummy to create test data
authorKern Sibbald <kern@sibbald.com>
Tue, 21 Sep 2010 13:58:59 +0000 (15:58 +0200)
committerKern Sibbald <kern@sibbald.com>
Tue, 21 Sep 2010 14:02:21 +0000 (16:02 +0200)
regress/tests/dummy-test [new file with mode: 0755]

diff --git a/regress/tests/dummy-test b/regress/tests/dummy-test
new file mode 100755 (executable)
index 0000000..de8572f
--- /dev/null
@@ -0,0 +1,186 @@
+#!/bin/sh
+#
+# This is a simple dummy test (copied from incremental-test), which
+#   simply runs some jobs then does not clean up at the end.
+#   This permits testing programs such as bconsole and bat with a little
+#   bit of data.
+#
+TestName="dummy-test"
+JobName=Incremental 
+. scripts/functions
+
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${tmpsrc}" >${tmp}/file-list
+mkdir -p ${tmpsrc}
+cp -p ${src}/src/dird/*.c ${tmpsrc}
+cd ${tmp}
+echo "${tmpsrc}/ficheriro1.txt" >restore-list
+echo "${tmpsrc}/ficheriro2.txt" >>restore-list
+cd ${cwd}
+
+change_jobname CompressedTest $JobName
+start_test
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+@#setdebug level=100 storage=File
+@#setdebug level=200 client
+@#setdebug level=100 director
+label storage=File volume=TestVolume001
+label storage=File volume=TestVolume002
+run job=$JobName yes
+status client
+wait
+messages
+quit
+END_OF_DATA
+
+run_bacula
+check_for_zombie_jobs storage=File
+#
+# Now create two new files to be restored later
+#
+sleep 1
+echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt
+cp -f ${tmpsrc}/dird.c ${tmpsrc}/ficheriro2.txt
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+@# Force Incremental on the second Volume
+update volume=TestVolume001 VolStatus=Used
+run level=Differential job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+sleep 1
+touch ${tmpsrc}/ficheriro1.txt
+touch ${tmpsrc}/ficheriro2.txt
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run level=Incremental job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+sleep 1
+cd ${tmpsrc}
+cp -f ficheriro2.txt 1
+sed "s%a%b%g" 1 >ficheriro2.txt
+rm -f 1
+cd ${cwd}
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run level=Differential job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+sleep 1
+touch ${tmpsrc}/ficheriro1.txt
+touch ${tmpsrc}/ficheriro2.txt
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run level=Incremental job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+sleep 1
+touch ${tmpsrc}/ficheriro1.txt
+touch ${tmpsrc}/ficheriro2.txt
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run level=Incremental job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+
+sleep 1
+touch ${tmpsrc}/ficheriro1.txt
+touch ${tmpsrc}/ficheriro2.txt
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+run level=Incremental job=$JobName yes
+wait
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+sleep 1
+touch ${tmpsrc}/ficheriro1.txt
+touch ${tmpsrc}/ficheriro2.txt
+
+cat <<END_OF_DATA >${tmp}/bconcmds
+@$out /dev/null
+messages
+@$out ${tmp}/log1.out
+setdebug level=200 storage=File
+run level=Incremental job=$JobName yes
+wait
+messages
+@# 
+@# now do a restore
+@#
+@$out ${tmp}/log2.out
+setdebug level=10 storage=File
+restore where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
+yes
+wait
+status client
+status storage=File
+messages
+quit
+END_OF_DATA
+
+run_bconsole
+check_for_zombie_jobs storage=File
+
+#
+#  Stop early to leave everything defined, Bacula running, ...
+#
+exit
+
+
+# The rest of this is not executed
+stop_bacula
+
+check_two_logs
+#
+# Delete .c files because we will only restored the txt files
+#
+rm -f ${tmpsrc}/*.c
+check_restore_tmp_build_diff
+end_test