]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-2disk
Make verify job log same as other logs -- fixes bug #2328
[bacula/bacula] / regress / tests / incremental-2disk
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 virtual disk autochanger
12 #
13 TestName="incremental-2disk"
14 JobName=Inc2disk
15 . scripts/functions
16
17 scripts/cleanup
18 scripts/copy-2disk-confs
19 scripts/prepare-disk-changer
20
21 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
22 if test ! -d ${cwd}/tmp/build ; then
23    mkdir -p ${cwd}/tmp/build
24 fi
25 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
26 cd ${cwd}/tmp
27 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
28 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
29 cd ${cwd}
30
31 change_jobname $JobName
32 start_test
33
34 # Write out bconsole commands
35 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
36 @$out /dev/null
37 messages
38 @$out ${cwd}/tmp/log1.out
39 label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=0
40 label storage=tape volume=TestVolume002 slot=2 Pool=Default drive=0
41 run job=$JobName yes
42 wait
43 messages
44 quit
45 END_OF_DATA
46
47 run_bacula
48
49 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
50 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
51
52
53 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
54 @$out /dev/null
55 messages
56 @$out ${cwd}/tmp/log1.out
57 @# Force Incremental on the second Volume
58 update volume=TestVolume001 VolStatus=Used
59 run level=Incremental job=$JobName yes
60 wait
61 messages
62 @# 
63 @# now do a restore
64 @#
65 @$out ${cwd}/tmp/log2.out
66 restore where=${cwd}/tmp/bacula-restores 
67 7
68 <${cwd}/tmp/restore-list
69
70 yes
71 wait
72 messages
73 quit
74 END_OF_DATA
75
76 run_bconsole
77
78 check_for_zombie_jobs storage=File
79 stop_bacula
80 #
81 # Delete .c files because we will only restored the txt files
82 #
83 rm -f ${cwd}/tmp/build/*.c
84
85 check_two_logs
86 check_restore_tmp_build_diff
87
88 #
89 # This script seems to more or less randomly fail, so we
90 #  add extra code here to produce a "dump" in the event of
91 #  an error.
92 #
93 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
94    cat ${cwd}/tmp/log1.out
95    echo "  "
96    cat ${cwd}/tmp/log2.out
97    echo "  "
98    diff -r ${cwd}/tmp/build ${cwd}/tmp/bacula-restores${cwd}/tmp/build
99 fi
100
101 end_test