]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/recycle-test
Updates
[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
13 echo " "
14 echo " "
15 echo " === Starting recycle-test at `date +%R:%S` ==="
16 echo " === Starting recycle-test at `date +%R:%S` ===" >working/log
17 echo " "
18
19 #bin/bacula start 2>&1 >/dev/null
20 bin/bacula start
21 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
22 @output /dev/null
23 messages
24 label storage=File1 volume=TestVolume001
25 label storage=File1 volume=TestVolume002
26 label storage=File1 volume=TestVolume003
27 update Volume=TestVolume001 volretention=10s
28 update Volume=TestVolume001 maxvoljobs=1
29 update Volume=TestVolume002 volretention=10s
30 update Volume=TestVolume002 maxvoljobs=1
31 update Volume=TestVolume003 volretention=10s
32 update Volume=TestVolume003 maxvoljobs=1
33 list volumes
34 run job=NightlySave storage=File1 level=full yes
35 wait
36 messages
37 list volumes
38 run job=NightlySave storage=File1 level=full yes
39 wait
40 messages
41 list volumes
42 run job=NightlySave storage=File1 level=full yes
43 wait
44 messages
45 list volumes
46 @sleep 10
47 run job=NightlySave storage=File1 level=full yes
48 wait
49 messages
50 list volumes
51 run job=NightlySave storage=File1 level=full yes
52 wait
53 messages
54 @output tmp/log1.out
55 list volumes
56 run job=NightlySave storage=File1 level=full yes
57 wait
58 messages
59 list volumes
60 @# 
61 @# now do a restore
62 @#
63 @output tmp/log2.out
64 restore where=${cwd}/tmp/bacula-restores select storage=File1
65 unmark *
66 mark *
67 done
68 yes
69 wait
70 messages
71 @output
72 quit
73 END_OF_DATA
74 scripts/check_for_zombie_jobs storage=File1
75 bin/bacula stop 2>&1 >/dev/null
76 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
77 bstat=$?
78 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
79 rstat=$?
80 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
81 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
82    echo " "
83    echo " "
84    echo "  !!!!! recycle-test Bacula source failed!!! !!!!! "
85    echo "  !!!!! recycle-test failed!!! !!!!! " >>test.out
86    if [ $bstat != 0 -o $rstat != 0 ] ; then
87       echo "  !!!!! Bad Job termination status     !!!!! "
88       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
89    else
90       echo "  !!!!! Restored files differ          !!!!! "
91       echo "  !!!!! Restored files differ          !!!!! " >>test.out
92    fi
93    echo " "
94 else
95    echo "  ===== recycle-test Bacula source OK ===== "
96    echo "  ===== recycle-test OK ===== " >>test.out
97    scripts/cleanup
98 fi