]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore-by-file-tape
regress: Add test that mixes mssql and systemstate
[bacula/bacula] / regress / tests / restore-by-file-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #   to a tape where the maximum tape file size is set to 1M
5 #   then restore a few files from it.  Note, by setting the maximum 
6 #   file size to 1M, it runs very slow. There are about 64 files that
7 #   are created during each of the two backups.
8 #
9 TestName="restore-by-file-tape"
10 JobName=restorebyfile
11 . scripts/functions
12
13 require_tape_drive
14
15 scripts/copy-tape-confs
16 scripts/cleanup-tape
17
18 echo "${cwd}/build" >${cwd}/tmp/file-list
19 sed s%\^%${cwd}% ${cwd}/scripts/flist | sort | uniq >${cwd}/tmp/restore2-list
20
21 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
22 sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
23
24 change_jobname NightlySave $JobName
25 start_test
26
27 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
28 @$out /dev/null
29 messages
30 @$out   ${cwd}/tmp/log1.out
31 label storage=tape volume=TestVolume001 slot=0 pool=Default
32 run job=$JobName level=Full yes
33 wait
34 messages
35 @# 
36 @# now do a restore
37 @#
38 @$out   ${cwd}/tmp/log2.out
39 restore where=${cwd}/tmp/bacula-restores storage=tape file=<${cwd}/tmp/restore2-list
40 yes
41 wait
42 messages
43 quit
44 END_OF_DATA
45
46 run_bacula
47 check_for_zombie_jobs storage=tape
48 stop_bacula
49
50 dstat=0
51 #
52 # We need to stop and start Bacula to
53 #  test appending to a previously written tape
54 #
55 for i in `cat ${cwd}/tmp/restore2-list`; do
56    diff $i ${cwd}/tmp/bacula-restores$i
57    if [ $? != 0 ] ; then
58       dstat=1
59    fi
60 done
61
62 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
63 @$out /dev/null
64 messages
65 @$out   ${cwd}/tmp/log1.out
66 run job=$JobName  level=Full yes
67 wait
68 messages
69 @#
70 @# now do a restore
71 @#
72 @$out   ${cwd}/tmp/log2.out
73 restore where=${cwd}/tmp/bacula-restores
74 7
75 <${cwd}/tmp/restore2-list
76                                                                                         
77 yes
78 wait
79 messages
80 quit
81 END_OF_DATA
82
83 #
84 # Bacula was stopped, but we must restart it to
85 #  test appending to a previously written tape
86 #
87 run_bacula
88 check_for_zombie_jobs storage=tape
89 stop_bacula
90
91 check_two_logs
92
93 scripts/check_for_zombie_jobs storage=tape
94 stop_bacula
95 for i in `cat ${cwd}/tmp/restore2-list`; do
96    diff $i ${cwd}/tmp/bacula-restores$i
97    if [ $? != 0 ] ; then
98       dstat=1
99    fi
100 done
101
102 end_test