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