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