]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-incremental-2tape
Updates
[bacula/bacula] / regress / tests / 2drive-incremental-2tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do an Incremental and restore those two files.
5 #
6 # This script uses the autochanger and two tapes
7 #
8 . config.out
9 if test x${TAPE_DRIVE1} = x/dev/null ; then
10    echo "Skipping 2drive-incremenatal-2tape test. No second drive."
11    exit
12 fi
13 TestName="2drive-incremental-2tape"
14 JobName="2drive2tape"
15 . scripts/functions
16 set_debug 0
17
18 cwd=`pwd`
19
20 scripts/copy-2drive-confs
21 scripts/cleanup-2drive
22
23 change_jobname localhost-fd $JobName
24
25 echo "${cwd}/tmp/build" >/tmp/file-list
26 if test ! -d ${cwd}/tmp/build ; then
27    mkdir ${cwd}/tmp/build
28 fi
29 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
30 cd ${cwd}/tmp
31 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
32 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
33 cd ${cwd}
34
35 # Turn off Prefer Mounted Volumes so we use 2 drives
36 outf="tmp/sed_tmp"
37 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
38 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
39 # Comment the next line out to write everything to one drive
40 #  otherwise, it writes the two jobs to different drives
41 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
42
43 start_test
44
45 # Write out bconsole commands
46 cat <<END_OF_DATA >tmp/bconcmds
47 @output /dev/null
48 messages
49 @$out tmp/log1.out
50 label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
51 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1
52 @#setdebug level=100 storage=DDS-4
53 run job=NightlySave yes
54 run job=NightlySave yes
55 run job=NightlySave yes
56 run job=NightlySave yes
57 run job=NightlySave yes
58 @sleep 3
59 status storage=DDS-4
60 wait
61 list volumes
62 list jobs
63 status storage=DDS-4
64 messages
65 quit
66 END_OF_DATA
67
68 run_bacula
69
70 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
71 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
72
73 cat <<END_OF_DATA >tmp/bconcmds
74 @$out /dev/null
75 messages
76 @$out tmp/log1.out
77 @# Force Incremental on the second Volume
78 update volume=TestVolume001 VolStatus=Used
79 status storage=DDS-4
80 @#setdebug level=400 storage=DDS-4
81 run level=Incremental job=NightlySave yes
82 wait
83 list volumes
84 status storage=DDS-4
85 messages
86 @# 
87 @# now do a restore
88 @#
89 @$out tmp/log2.out
90 restore where=${cwd}/tmp/bacula-restores 
91 7
92 <${cwd}/tmp/restore-list
93
94 yes
95 wait
96 messages
97 @$out
98 quit
99 END_OF_DATA
100
101 run_bconsole
102 check_for_zombie_jobs storage=DDS-4
103 stop_bacula
104
105 check_two_logs
106 #
107 # Delete .c files because we will only restored the txt files
108 #
109 rm -f tmp/build/*.c
110 check_restore_tmp_build_diff
111
112 end_test