]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/2drive-incremental-changer
Attempt to fix timing problem with console-dotcmd-test on FreeBSD
[bacula/bacula] / regress / tests / 2drive-incremental-changer
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 create some           
9 #   new files, do an Incremental and restore those two files.
10 #
11 # This script uses the autochanger and two drives
12 #
13 TestName="2drive-incremental-changer"
14 JobName="2drive2tape"
15 . scripts/functions
16
17 require_tape_drive
18 require_autochanger
19 require_second_drive
20
21 scripts/copy-2drive-confs
22 scripts/cleanup-2drive
23
24 change_jobname localhost-fd $JobName
25
26 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
27 if test ! -d ${cwd}/tmp/build ; then
28    mkdir -p ${cwd}/tmp/build
29 fi
30 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
31 cd ${cwd}/tmp
32 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
33 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
34 cd ${cwd}
35
36 # Turn off Prefer Mounted Volumes so we use 2 drives
37 outf="${cwd}/tmp/sed_tmp"
38 echo "s%# Prefer Mounted Volumes%  Prefer Mounted Volumes%g" >${outf}
39 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
40 # Comment the next line out to write everything to one drive
41 #  otherwise, it writes the two jobs to different drives
42 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
43
44 start_test
45
46 # Write out bconsole commands
47 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
48 @$out /dev/null
49 messages
50 @$out ${cwd}/tmp/log1.out
51 label storage=tape volume=TestVolume001 slot=$SLOT1 Pool=Default drive=$DRIVE1
52 label storage=tape volume=TestVolume002 slot=$SLOT2 Pool=Default drive=$DRIVE2
53 @#setdebug level=100 storage=tape
54 run job=NightlySave yes
55 run job=NightlySave yes
56 run job=NightlySave yes
57 run job=NightlySave yes
58 run job=NightlySave yes
59 @sleep 3
60 status storage=tape
61 wait
62 list volumes
63 list jobs
64 status storage=tape
65 messages
66 quit
67 END_OF_DATA
68
69 run_bacula
70
71 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
72 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
73
74 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
75 @$out /dev/null
76 messages
77 @$out ${cwd}/tmp/log1.out
78 @# Force Incremental on the second Volume
79 update volume=TestVolume001 VolStatus=Used
80 status storage=tape
81 @#setdebug level=400 storage=tape
82 run level=Incremental job=NightlySave yes
83 wait
84 list volumes
85 status storage=tape
86 messages
87 @# 
88 @# now do a restore
89 @#
90 @$out ${cwd}/tmp/log2.out
91 restore where=${cwd}/tmp/bacula-restores 
92 7
93 <${cwd}/tmp/restore-list
94
95 yes
96 wait
97 messages
98 quit
99 END_OF_DATA
100
101 run_bconsole
102 check_for_zombie_jobs storage=tape
103 stop_bacula
104
105 check_two_logs
106 #
107 # Delete .c files because we will only restored the txt files
108 #
109 rm -f ${cwd}/tmp/build/*.c
110 check_restore_tmp_build_diff
111
112 end_test