]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/recycle-test
d20ff409c609019d6453dd9a3a8e602b92f7c5d3
[bacula/bacula] / regress / tests / recycle-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory but 
4 #   create three volumes and do six backups causing the
5 #   volumes to be recycled, and cycling through the volumes
6 #   twice. Tests maxvoljobs and volretention.
7 #
8 cwd=`pwd`
9 scripts/copy-test-confs
10 scripts/cleanup
11 echo "${cwd}/build" >/tmp/file-list
12 bin/bacula stop 2>&1 >/dev/null
13 cd bin
14 ./drop_bacula_tables >/dev/null 2>&1
15 ./make_bacula_tables >/dev/null 2>&1
16 ./grant_bacula_privileges 2>&1 >/dev/null
17 cd ..
18
19 echo " "
20 echo " "
21 echo " === Starting recycle-test  ==="
22 echo " === Starting recycle-test  ===" >working/log
23 echo " "
24
25 bin/bacula start 2>&1 >/dev/null
26 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
27 @output /dev/null
28 messages
29 label storage=File1 volume=TestVolume001
30 label storage=File1 volume=TestVolume002
31 label storage=File1 volume=TestVolume003
32 update Volume=TestVolume001 volretention=10s
33 update Volume=TestVolume001 maxvoljobs=1
34 update Volume=TestVolume002 volretention=10s
35 update Volume=TestVolume002 maxvoljobs=1
36 update Volume=TestVolume003 volretention=10s
37 update Volume=TestVolume003 maxvoljobs=1
38 list volumes
39 run job=NightlySave storage=File1 level=full yes
40 wait
41 messages
42 list volumes
43 run job=NightlySave storage=File1 level=full yes
44 wait
45 messages
46 list volumes
47 run job=NightlySave storage=File1 level=full yes
48 wait
49 messages
50 list volumes
51 @sleep 10
52 run job=NightlySave storage=File1 level=full yes
53 wait
54 messages
55 list volumes
56 run job=NightlySave storage=File1 level=full yes
57 wait
58 messages
59 @output tmp/log1.out
60 list volumes
61 run job=NightlySave storage=File1 level=full yes
62 wait
63 messages
64 list volumes
65 @# 
66 @# now do a restore
67 @#
68 @output tmp/log2.out
69 restore where=${cwd}/tmp/bacula-restores select storage=File1
70 unmark *
71 mark *
72 done
73 yes
74 wait
75 messages
76 @output
77 quit
78 END_OF_DATA
79 scripts/check_for_zombie_jobs storage=File1
80 bin/bacula stop 2>&1 >/dev/null
81 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
82 bstat=$?
83 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
84 rstat=$?
85 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
86 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
87    echo " "
88    echo " "
89    echo "  !!!!! recycle-test Bacula source failed!!! !!!!! "
90    echo "  !!!!! recycle-test failed!!! !!!!! " >>test.out
91    echo " "
92 else
93    echo "  ===== recycle-test Bacula source OK ===== "
94    echo "  ===== recycle-test OK ===== " >>test.out
95    scripts/cleanup
96 fi