]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/base-job-test
tweak debug
[bacula/bacula] / regress / tests / base-job-test
1 #!/bin/sh
2 #
3 # Run a basejob backup of the Bacula build directory
4 #   then restore it.
5 #
6
7 TestName="base-job-test"
8 JobName=backup
9 . scripts/functions
10 $rscripts/cleanup
11
12 copy_test_confs
13 sed 's/backup_advance/base_backup/' $rscripts/bacula-dir.conf.accurate > $tmp/1
14 sed 's/Name = backup/Name = backup; Base = base_backup/' $tmp/1 > $conf/bacula-dir.conf
15 sed s/all,/all,saved,/ $conf/bacula-fd.conf > tmp/1
16 cp tmp/1 $conf/bacula-fd.conf
17
18 change_jobname BackupClient1 $JobName
19
20 p() {
21     echo "##############################################" >> ${cwd}/tmp/log1.out
22     echo "$*" >> ${cwd}/tmp/log1.out
23     echo "##############################################" >> ${cwd}/tmp/log2.out
24     echo "$*" >> ${cwd}/tmp/log2.out
25 }
26
27 # cleanup
28 rm -rf ${cwd}/build/accurate.new
29 rm -rf ${cwd}/build/accurate
30
31
32 # add extra files
33 mkdir ${cwd}/build/accurate
34 mkdir ${cwd}/build/accurate/dirtest
35 echo "test test" > ${cwd}/build/accurate/dirtest/hello
36 echo "test test" > ${cwd}/build/accurate/xxx
37 echo "test test" > ${cwd}/build/accurate/yyy
38 echo "test test" > ${cwd}/build/accurate/zzz
39 echo "test test" > ${cwd}/build/accurate/zzzzzz
40 echo "test test" > ${cwd}/build/accurate/xxxxxx
41 echo "test test" > ${cwd}/build/accurate/yyyyyy
42 echo "test test" > ${cwd}/build/accurate/xxxxxxxxx
43 echo "test test" > ${cwd}/build/accurate/yyyyyyyyy
44 echo "test test" > ${cwd}/build/accurate/zzzzzzzzz
45 echo ${cwd}/build > ${cwd}/tmp/file-list
46
47 start_test
48
49 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
50 @output /dev/null
51 messages
52 label volume=TestVolume001 storage=File pool=Default
53 messages
54 END_OF_DATA
55
56 run_bacula
57
58 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
59 @$out ${cwd}/tmp/log1.out
60 run job=backup level=full yes
61 wait
62 messages
63 @# 
64 @# now do a restore
65 @#
66 @$out ${cwd}/tmp/log2.out  
67 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
68 yes
69 wait
70 messages
71 @$out
72 END_OF_DATA
73
74 ################################################################
75 p First :  We just run a full backup and restore
76 ################################################################
77
78 run_bconsole
79 check_for_zombie_jobs storage=File
80
81 check_two_logs
82 check_restore_diff
83
84 rm -rf ${cwd}/tmp/bacula-restores
85
86 ################################################################
87 p Now do a second backup using base backup
88 ################################################################
89
90 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
91 @$out ${cwd}/tmp/log1.out
92 run job=base_backup level=base yes
93 wait
94 messages
95 update volume=TestVolume001 volstatus=Used
96 label volume=TestVolume002 storage=File pool=Default
97 run job=backup level=full yes
98 wait
99 messages
100 @# 
101 @# now do a restore
102 @#
103 @$out ${cwd}/tmp/log2.out  
104 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
105 yes
106 wait
107 messages
108 END_OF_DATA
109
110
111 run_bconsole
112 check_for_zombie_jobs storage=File
113
114 check_two_logs
115 check_restore_diff
116
117 rm -rf ${cwd}/tmp/bacula-restores
118
119 ################################################################
120 p Now do a third backup after making few changes
121 ################################################################
122 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
123 @$out ${cwd}/tmp/log1.out
124 run job=backup level=incremental yes
125 wait
126 messages
127 @# 
128 @# now do a restore
129 @#
130 @$out ${cwd}/tmp/log2.out  
131 restore fileset=FS_TESTJOB where=${cwd}/tmp/bacula-restores select all done
132 yes
133 wait
134 messages
135 END_OF_DATA
136
137 rm ${cwd}/build/accurate/yyyyyy  # delete a file
138 rmdir ${cwd}/build/accurate/dirtest
139
140
141 run_bconsole
142 check_for_zombie_jobs storage=File
143
144 check_two_logs
145 check_restore_diff
146 check_files_written ${cwd}/tmp/log1.out 3
147
148 rm -rf ${cwd}/tmp/bacula-restores
149
150 stop_bacula
151 end_test