]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/virtual-backup-test
baculum: Add module to check resource dependencies
[bacula/bacula] / regress / tests / virtual-backup-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory then do a 
9 #   Virtual Full backup to another device.
10 #
11 # This script uses the disk autochanger
12 #
13 TestName="virtual-backup-test"
14 JobName=Vbackup
15 . scripts/functions
16
17
18 scripts/cleanup
19 scripts/copy-migration-confs
20 scripts/prepare-disk-changer
21 echo "${cwd}/build" >${cwd}/tmp/file-list
22
23 change_jobname NightlySave $JobName
24 start_test
25
26 #
27 # Note, we first backup into Pool Default, 
28 #          then Migrate into Pool Full. 
29 #              Pool Default uses Storage=File
30 #              Pool Full    uses Storage=DiskChanger
31
32 # Write out bconsole commands
33 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
34 @output /dev/null
35 messages
36 @$out ${cwd}/tmp/log1.out
37 @#setdebug level=100 storage=File
38 label storage=File volume=FileVolume001 Pool=Default
39 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
40 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
41 @# run several jobs
42 @exec "sh -c 'date > ${cwd}/build/date'"
43 run job=$JobName level=Full yes
44 wait
45 messages
46 list jobs
47 @exec "sh -c 'touch ${cwd}/build/src/dird/*.c'"
48 run job=$JobName level=Incremental yes
49 wait
50 messages
51 list jobs
52 @exec "sh -c 'touch ${cwd}/build/src/dird/*.o'"
53 run job=$JobName level=Differential yes
54 wait
55 messages
56 list jobs
57 @exec "sh -c 'date > ${cwd}/build/date'"
58 @exec "sh -c 'touch ${cwd}/build/src/dird/*.o'"
59 run job=$JobName level=Incremental yes
60 wait
61 messages
62 list jobs
63 list volumes
64 @# 
65 @# now do a normal restore of normal backups
66 @#
67 setdebug level=10 dir
68 restore where=${cwd}/tmp/bacula-restores select
69 unmark *
70 mark *
71 done
72 yes
73 list volumes
74 @# should Consolidate Full, Differential and Incremental
75 @#setdebug level=150 storage=DiskChanger
76 @#setdebug level=100 dir
77 run job=$JobName level=VirtualFull yes
78 wait
79 messages
80 list volumes
81 llist jobs
82 @# 
83 @# now do a restore of the consolidated Full
84 @#
85 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
86 unmark *
87 mark *
88 done
89 yes
90 wait
91 list volumes
92 list jobs
93 messages
94 quit
95 END_OF_DATA
96
97 run_bacula
98 check_for_zombie_jobs storage=File
99 stop_bacula
100
101 #
102 # We only used one log so copy it to the second log
103 #  so that any restore errors will be picked up
104 #
105 cp -f ${cwd}/tmp/log1.out ${cwd}/tmp/log2.out
106 check_two_logs
107 check_restore_diff
108 end_test