]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/copy-uncopied-test
regress: tweak prune-migration-test
[bacula/bacula] / regress / tests / copy-uncopied-test
1 #!/bin/sh
2 #
3 # Run a backup of the Bacula build directory on two Volumes
4 #   then copy it to another device.             
5 #
6 # This script uses the virtual disk autochanger and migration scripts
7 #
8 TestName="copy-uncopied-test"
9 JobName=MigVolBackup
10 . scripts/functions
11
12
13 scripts/cleanup
14 scripts/copy-migration-confs
15 scripts/prepare-disk-changer
16 echo "${cwd}/build" >${cwd}/tmp/file-list
17 #cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
18 #sed "s%# Maximum File Size%  Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
19
20 change_jobname NightlySave $JobName
21 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
22 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
23 rm -f ${cwd}/build/po/test.po >/dev/null
24
25 touch ${cwd}/tmp/log2.out
26
27 start_test
28
29 #
30 # Note, we first backup into Pool Default, 
31 #          then Copy into Pool Full. 
32 #              Pool Default uses Storage=File
33 #              Pool Full    uses Storage=DiskChanger
34
35 # Write out bconsole commands
36 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
37 @$out /dev/null
38 messages
39 @$out ${cwd}/tmp/log1.out
40 label storage=File volume=FileVolume001 Pool=Default
41 label storage=File volume=FileVolume002 Pool=Scratch
42 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Scratch drive=0
43 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Scratch drive=0
44 @# 
45 run job=$JobName level=Full yes
46 wait
47 run job=$JobName level=Full yes
48 wait
49 update volume=FileVolume001 VolStatus=Used
50 run job=$JobName level=Full yes
51 wait
52 messages
53 @$out ${cwd}/tmp/log11.out
54 @############################################################
55 @# should copy job 1,2,3
56 @# Expect: 3 copies (1,2,3)
57 @############################################################
58 setdebug level=200 dir
59 run job=copy-uncopied yes
60 @sleep 5 
61 wait
62 messages
63 list jobs
64 list volumes
65 list copies
66 @$out ${cwd}/tmp/log12.out
67 @############################################################
68 @# should not copy jobs
69 @# Expect: 3 copies (1,2,3)
70 @############################################################
71 run job=copy-uncopied yes
72 wait
73 messages
74 list copies
75 @$out ${cwd}/tmp/log13.out
76 @############################################################
77 @# should not have a copy of the copy
78 @# Expect: 2 copies (2,3)
79 @############################################################
80 delete jobid=1
81 run job=copy-uncopied yes
82 wait
83 messages
84 list copies
85 @$out ${cwd}/tmp/log14.out
86 @############################################################
87 @# should copy jobid=2
88 @# Expect: 2 copies (2,3)
89 @############################################################
90 delete jobid=8
91 run job=copy-uncopied yes
92 wait
93 messages
94 list copies
95 END_OF_DATA
96
97 run_bacula
98 check_for_zombie_jobs storage=File
99 stop_bacula
100
101 bstat=0
102 rstat=0
103 dstat=0
104 zstat=0
105
106 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log11.out
107 bstat=`expr $bstat + $?`
108
109 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log12.out
110 bstat=`expr $bstat + $?`
111
112 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log13.out
113 bstat=`expr $bstat + $?`
114
115 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log14.out
116 bstat=`expr $bstat + $?`
117
118 check_two_logs
119 end_test