]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-changer
8d4a5c6a7cc49700efd7af88308530899539aa53
[bacula/bacula] / regress / tests / 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 tapes
12 #
13 TestName="incremental-changer"
14 JobName=incrementalchanger
15 . scripts/functions
16
17 require_tape_drive
18 require_autochanger
19
20 scripts/cleanup
21 scripts/copy-2tape-confs
22 scripts/prepare-two-tapes
23
24 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
25 if test ! -d ${cwd}/tmp/build ; then
26    mkdir -p ${cwd}/tmp/build
27 fi
28 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
29 cd ${cwd}/tmp
30 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
31 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
32 cd ${cwd}
33
34 start_test
35
36 # Write out bconsole commands
37 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
38 @$out /dev/null
39 messages
40 @$out ${cwd}/tmp/log1.out
41 label storage=tape volume=TestVolume001 slot=$SLOT1 Pool=Default drive=$DRIVE1
42 label storage=tape volume=TestVolume002 slot=$SLOT2 Pool=Default drive=$DRIVE1
43 run job=NightlySave yes
44 wait
45 messages
46 quit
47 END_OF_DATA
48
49 run_bacula
50
51 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
52 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
53
54 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
55 @$out /dev/null
56 messages
57 @$out ${cwd}/tmp/log1.out
58 @# Force Incremental on the second Volume
59 update volume=TestVolume001 VolStatus=Used
60 run level=Incremental job=NightlySave yes
61 wait
62 messages
63 @# 
64 @# now do a restore
65 @#
66 @$out ${cwd}/tmp/log2.out
67 restore where=${cwd}/tmp/bacula-restores 
68 7
69 <${cwd}/tmp/restore-list
70
71 yes
72 wait
73 messages
74 quit
75 END_OF_DATA
76
77 run_bconsole
78
79 check_for_zombie_jobs storage=tape
80 stop_bacula
81 check_two_logs
82 rstat=$?
83
84 #
85 # Delete .c files because we will only restored the txt files
86 #
87 rm -f ${cwd}/tmp/build/*.c
88
89 check_restore_tmp_build_diff
90 end_test