]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/copy-time-test
bdea3274947b31651f90379851c17595cb3ba97b
[bacula/bacula] / regress / tests / copy-time-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-time-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 -i 's/migrate/copy/g' ${cwd}/bin/bacula-dir.conf
18 sed -i 's/Migrate/Copy/g' ${cwd}/bin/bacula-dir.conf
19
20 change_jobname NightlySave $JobName
21 start_test
22
23 #
24 # Note, we first backup into Pool Default, 
25 #          then Copy into Pool Full. 
26 #              Pool Default uses Storage=File
27 #              Pool Full    uses Storage=DiskChanger
28
29 # Write out bconsole commands
30 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @output
32 messages
33 @$out ${cwd}/tmp/log1.out
34 label storage=File volume=FileVolume001 Pool=Default
35 label storage=File volume=FileVolume002 Pool=Special
36 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
37 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
38 list volumes
39 @# run three jobs
40 run job=$JobName Pool=Special level=Full yes
41 run job=$JobName level=Full yes
42 run job=$JobName level=Full yes
43 wait
44 messages
45 update volume=FileVolume001 VolStatus=Used
46 update volume=FileVolume002 VolStatus=Used
47 llist jobid=2,3
48 list jobs
49 list volumes
50 @#setdebug level=20 dir
51 @# should copy only jobid=2 and 3
52 run job=copy-time yes
53 run job=copy-time pool=Special yes
54 wait
55 messages
56 wait
57 list jobs
58 list volumes
59 purge volume=FileVolume001
60 purge volume=FileVolume002
61 @# 
62 @# now do a restore
63 @#
64 @$out ${cwd}/tmp/log2.out
65 restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger
66 unmark *
67 mark *
68 done
69 yes
70 wait
71 messages
72 @output
73 quit
74 END_OF_DATA
75
76 run_bacula
77 check_for_zombie_jobs storage=File
78 stop_bacula
79
80 print_debug "We must find 3 copy jobs into the log"
81 for i in 0 1 2; do
82     get_mig_info $i ${cwd}/tmp/log1.out
83     set $RET >/dev/null
84
85     if [ -n "$1" -a "$1" != 1 ]; then
86         bstat=2
87         print_debug "The first job should not been copied"
88     fi
89 done
90
91
92 check_two_logs
93 check_restore_diff
94 end_test