]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/estimate-test
ebl Add estimate test
[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 mkdir ${cwd}/build/src/test
25 touch ${cwd}/build/src/test/test1 ${cwd}/build/src/test/test2
26
27 cat <<END_OF_DATA >$tmp/bconcmds
28 @output /dev/null
29 messages
30 @$out $tmp/log1.out
31 label volume=TestVolume001 storage=File pool=Default
32 run job=$JobName yes
33 wait
34 messages
35 @#
36 @# now do a restore
37 @#
38 @$out $tmp/log2.out
39 restore where=$tmp/bacula-restores select all done
40 yes
41 wait
42 messages
43 @$out
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 @output /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 cp $scripts/bacula-dir.conf $tmp/1
66 sed 's/JobDefs {/JobDefs { Accurate=yes/' $tmp/1>$scripts/bacula-dir.conf
67
68 cat <<END_OF_DATA >$tmp/bconcmds
69 @output /dev/null
70 messages
71 @$out $tmp/log4.out
72 reload
73 estimate listing job=$JobName level=incremental
74 messages
75 quit
76 END_OF_DATA
77
78 run_bconsole
79
80 rm -rf ${cwd}/build/po/test
81
82 grep test1 $tmp/log3.out > /dev/null
83 if [ $? = 0 ]; then
84     print_debug "Normal estimate shouldn't detect test1 file in $tmp/log3.out"
85     dstat=2
86 fi
87
88 grep test1 $tmp/log4.out > /dev/null
89 if [ $? != 0 ]; then
90     print_debug "Accurate estimate should detect test1 file in $tmp/log4.out"
91     dstat=2
92 fi
93
94 check_for_zombie_jobs storage=File
95
96 stop_bacula
97 end_test