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