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