]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/copy-uncopied-test
Tweak cleaner output in accurate-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 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Allow Duplicate Jobs", "no", "Job", "MigVolBackup")'
28
29 start_test
30
31 #
32 # Note, we first backup into Pool Default, 
33 #          then Copy into Pool Full. 
34 #              Pool Default uses Storage=File
35 #              Pool Full    uses Storage=DiskChanger
36
37 # Write out bconsole commands
38 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
39 @$out /dev/null
40 messages
41 @$out ${cwd}/tmp/log1.out
42 label storage=File volume=FileVolume001 Pool=Default
43 label storage=File volume=FileVolume002 Pool=Scratch
44 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Scratch drive=0
45 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Scratch drive=0
46 @# 
47 run job=$JobName level=Full yes
48 wait
49 run job=$JobName level=Full yes
50 wait
51 update volume=FileVolume001 VolStatus=Used
52 run job=$JobName level=Full yes
53 wait
54 messages
55 @$out ${cwd}/tmp/log11.out
56 @############################################################
57 @# should copy job 1,2,3
58 @# Expect: 3 copies (1,2,3)
59 @############################################################
60 setdebug level=200 dir
61 run job=copy-uncopied yes
62 @sleep 5 
63 wait
64 messages
65 list jobs
66 list volumes
67 list copies
68 @$out ${cwd}/tmp/log12.out
69 @############################################################
70 @# should not copy jobs
71 @# Expect: 3 copies (1,2,3)
72 @############################################################
73 run job=copy-uncopied yes
74 wait
75 messages
76 list copies
77 @$out ${cwd}/tmp/log13.out
78 @############################################################
79 @# should not have a copy of the copy
80 @# Expect: 2 copies (2,3)
81 @############################################################
82 delete jobid=1
83 run job=copy-uncopied yes
84 wait
85 messages
86 list copies
87 @$out ${cwd}/tmp/log14.out
88 @############################################################
89 @# should copy jobid=2
90 @# Expect: 2 copies (2,3)
91 @############################################################
92 delete jobid=8
93 run job=copy-uncopied yes
94 wait
95 messages
96 list copies
97 END_OF_DATA
98
99 run_bacula
100 check_for_zombie_jobs storage=File
101 stop_bacula
102
103 bstat=0
104 rstat=0
105 dstat=0
106 zstat=0
107
108 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log11.out
109 bstat=`expr $bstat + $?`
110
111 perl -Mscripts::functions -e 'check_multiple_copies(3)' tmp/log12.out
112 bstat=`expr $bstat + $?`
113
114 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log13.out
115 bstat=`expr $bstat + $?`
116
117 perl -Mscripts::functions -e 'check_multiple_copies(2)' tmp/log14.out
118 bstat=`expr $bstat + $?`
119
120 check_two_logs
121 end_test