]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/recycle-test
f21171b8a4e4b5261261ca3a524bf21c7d41571b
[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 all storage=File1
70 yes
71 wait
72 messages
73 @output
74 quit
75 END_OF_DATA
76 bin/bacula stop 2>&1 >/dev/null
77 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
78 bstat=$?
79 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
80 rstat=$?
81 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
82 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
83    echo " "
84    echo " "
85    echo "  !!!!! recycle-test Bacula source failed!!! !!!!! "
86    echo "  !!!!! recycle-test failed!!! !!!!! " >>test.out
87    echo " "
88 else
89    echo "  ===== recycle-test Bacula source OK ===== "
90    echo "  ===== recycle-test OK ===== " >>test.out
91    scripts/cleanup
92 fi