]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-bacula-tape
Update tests
[bacula/bacula] / regress / tests / backup-bacula-tape
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #   to a tape then restore it, we do that twice to ensure that
5 #   we can correctly append to a tape.
6 #
7 cwd=`pwd`
8 bin/bacula stop  2>&1 >/dev/null
9 scripts/copy-tape-confs
10 scripts/cleanup-tape
11 echo "${cwd}/build" >/tmp/file-list
12 bin/drop_sqlite_tables
13 bin/make_sqlite_tables
14
15 echo " "
16 echo " "
17 echo " === Starting Bacula tape test ==="
18 echo " === Starting Bacula tape test ===" >>working/log
19 echo " "
20
21 bin/bacula start 2>&1 >/dev/null
22 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
23 @output /dev/null
24 messages
25 @output tmp/log1.out
26 label storage=DDS-4 volume=TestVolume001 slot=0
27 run job=NightlySave yes
28 wait
29 messages
30 @# 
31 @# now do a restore
32 @#
33 @output tmp/log2.out
34 restore where=${cwd}/tmp/bacula-restores select all
35 yes
36 wait
37 messages
38 @#
39 @# Now do a second backup
40 @#
41 @output /dev/null
42 messages
43 @output tmp/log1.out
44 label storage=DDS-4 volume=TestVolume001 slot=0
45 run job=NightlySave yes
46 wait
47 messages
48 @# 
49 @# now do a second restore
50 @#
51 @output tmp/log2.out
52 restore where=${cwd}/tmp/bacula-restores select all
53 yes
54 wait
55 messages
56 @output
57 quit
58 END_OF_DATA
59 bin/bacula stop 2>&1 >/dev/null
60 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
61 bstat=$?
62 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
63 rstat=$?
64 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
65 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
66    echo " "
67    echo " "
68    echo "  !!!!! Bacula tape test Bacula source failed!!! !!!!! "
69    echo "  !!!!! Bacula tape test failed!!! !!!!! " >>test.out
70    echo " "
71 else
72    echo "  ===== Bacula tape test Bacula source OK ===== "
73    echo "  ===== Bacula tape test OK ===== " >>test.out
74    scripts/cleanup
75 fi