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