]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/copy-job-test
backport code from master
[bacula/bacula] / regress / tests / copy-job-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then copy it
4 #   to another device.
5 #
6 # This script uses the virtual disk autochanger
7 #
8 TestName="copy-job-test"
9 JobName=CopyJobSave
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 sed 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf > ${cwd}/tmp/1
18 sed 's/Migrate/Copy/g' ${cwd}/tmp/1 > ${cwd}/bin/bacula-dir.conf
19
20
21 change_jobname NightlySave $JobName
22 start_test
23
24 #
25 # Note, we first backup into Pool Default, 
26 #          then Copy into Pool Full. 
27 #              Pool Default uses Storage=File
28 #              Pool Full    uses Storage=DiskChanger
29
30 # Write out bconsole commands
31 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
32 @$out /dev/null
33 messages
34 @$out ${cwd}/tmp/log1.out
35 @# setdebug level=100 storage=File
36 label storage=File volume=FileVolume001 Pool=Default
37 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
38 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
39 @# run two jobs (both will be copied)
40 run job=$JobName yes
41 run job=$JobName yes
42 run job=$JobName yes
43 wait
44 list jobs
45 list volumes
46 @#setdebug level=100 dir
47 @# should copy two jobs
48 @#setdebug level=51 storage=DiskChanger
49 run job=copy-job yes
50 wait
51 messages
52 @#purge volume=FileVolume001
53 list jobs 
54 list volumes
55 wait
56 messages
57 @$out ${cwd}/tmp/log3.out
58 @#
59 @# Now do another backup, but level Incremental
60 @#
61 run job=$JobName level=Incremental yes
62 wait
63 messages
64 @#
65 @# This final job that runs should be Incremental and
66 @# not upgraded to full.
67 list jobs
68 @# 
69 @# now do a restore
70 @#
71 @$out ${cwd}/tmp/log2.out
72 list volumes 
73 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
74 unmark *
75 mark *
76 done
77 yes
78 list volumes
79 wait
80 messages
81 quit
82 END_OF_DATA
83
84 run_bacula
85 check_for_zombie_jobs storage=File
86 stop_bacula
87
88 check_two_logs
89 check_restore_diff
90
91 grep 'Backup Level:' tmp/log3.out  | grep Incremental > /dev/null
92 if [ $? != 0 ]; then
93     bstat=2
94     print_debug "The incremental job must use copied jobs"
95 fi
96
97 end_test