]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/estimate-test
Tweak more debug for FreeBSD to verify-data-test
[bacula/bacula] / regress / tests / estimate-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
9 #   then restore it.
10 #
11 TestName="estimate-test"
12 . scripts/functions
13 JobName=BackupClient1
14
15 scripts/cleanup
16 scripts/copy-confs
17
18 #
19 # Zap out any schedule in default conf file so that
20 #  it doesn't start during our test
21 #
22 outf="$tmp/sed_tmp"
23 echo "s%  Schedule =%# Schedule =%g" >${outf}
24 cp $scripts/bacula-dir.conf $tmp/1
25 sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
26
27 start_test
28
29 rm -rf ${cwd}/build/src/test ${cwd}/build/po/test
30 mkdir -p ${cwd}/build/src/test
31 touch ${cwd}/build/src/test/test1 ${cwd}/build/src/test/test2
32
33 cat <<END_OF_DATA >$tmp/bconcmds
34 @output /dev/null
35 messages
36 @$out $tmp/log1.out
37 label volume=TestVolume001 storage=File1 pool=File slot=1 drive=1
38 run job=$JobName yes
39 wait
40 messages
41 @#
42 @# now do a restore
43 @#
44 @$out $tmp/log2.out
45 restore where=$tmp/bacula-restores select all done
46 yes
47 wait
48 messages
49 quit
50 END_OF_DATA
51
52 run_bacula
53
54 check_two_logs
55 check_restore_diff
56
57 mv ${cwd}/build/src/test ${cwd}/build/po/test
58
59 cat <<END_OF_DATA >$tmp/bconcmds
60 @output /dev/null
61 messages
62 @$out $tmp/log3.out
63 estimate listing job=$JobName level=incremental
64 messages
65 quit
66 END_OF_DATA
67
68 run_bconsole
69
70 cat <<END_OF_DATA >$tmp/bconcmds
71 @output /dev/null
72 messages
73 @$out $tmp/log4.out
74 estimate listing job=$JobName level=incremental accurate=yes
75 messages
76 quit
77 END_OF_DATA
78
79 run_bconsole
80
81 cp $scripts/bacula-dir.conf $tmp/1
82 sed 's/JobDefs {/JobDefs { Accurate=yes/' $tmp/1>$scripts/bacula-dir.conf
83
84 cat <<END_OF_DATA >$tmp/bconcmds
85 @output /dev/null
86 messages
87 @$out $tmp/log5.out
88 reload
89 estimate listing job=$JobName level=incremental
90 messages
91 quit
92 END_OF_DATA
93
94 run_bconsole
95
96 cat <<END_OF_DATA >$tmp/bconcmds
97 @output /dev/null
98 messages
99 @$out $tmp/log6.out
100 estimate listing job=$JobName level=incremental accurate=no
101 messages
102 quit
103 END_OF_DATA
104
105 run_bconsole
106
107 rm -rf ${cwd}/build/po/test
108
109 grep test1 $tmp/log3.out > /dev/null
110 if [ $? = 0 ]; then
111     print_debug "ERROR: Normal estimate shouldn't detect test1 file in $tmp/log3.out"
112     dstat=2
113 fi
114
115 grep test1 $tmp/log4.out > /dev/null
116 if [ $? != 0 ]; then
117     print_debug "ERROR: Accurate=yes estimate should detect test1 file in $tmp/log4.out"
118     dstat=2
119 fi
120
121 grep test1 $tmp/log5.out > /dev/null
122 if [ $? != 0 ]; then
123     print_debug "ERROR: Accurate estimate should detect test1 file in $tmp/log5.out"
124     dstat=2
125 fi
126
127 grep test1 $tmp/log6.out > /dev/null
128 if [ $? = 0 ]; then
129     print_debug "ERROR: Accurate=no estimate shouldn't detect test1 file in $tmp/log6.out"
130     dstat=2
131 fi
132
133 check_for_zombie_jobs storage=File1
134
135 stop_bacula
136 end_test