]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/auto-label-test
Final changes
[bacula/bacula] / regress / tests / auto-label-test
1 #!/bin/sh
2 #
3 #  Test if Bacula can automatically create a Volume label.
4 #
5
6 debug=0
7 if test "$debug" -eq 1 ; then
8   out="tee"
9 else
10   out="output"
11 fi
12 cwd=`pwd`
13 scripts/copy-test-confs
14 scripts/cleanup
15 echo "${cwd}/build" >/tmp/file-list
16
17 cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
18 sed "s%# Label Format%  Label Format%" ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
19
20 echo " "
21 echo " "
22 echo " === Starting auto-label-test at `date +%R:%S` ==="
23 echo " === Starting auto-label-test at `date +%R:%S` ===" >>working/log
24 echo " "
25
26 cat <<END_OF_DATA >tmp/bconcmds
27 @$out /dev/null
28 status all
29 status all
30 list pools
31 messages
32 @$out tmp/log1.out
33 run job=CompressedTest storage=File yes
34 list pools
35 list volumes
36 wait
37 messages
38 @# 
39 @# now do a restore
40 @#
41 @$out tmp/log2.out
42 restore where=${cwd}/tmp/bacula-restores select storage=File
43 unmark *
44 mark *
45 count
46 ls *
47 dir *
48 find Makefile
49 pwd
50 lsmark
51 estimate
52 ?
53 help
54 done
55 yes
56 wait
57 messages
58 @$out
59 quit
60 END_OF_DATA
61
62 if test "$debug" -eq 1 ; then
63   bin/bacula start
64   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
65 else
66   bin/bacula start 2>&1 >/dev/null
67   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
68 fi
69
70 scripts/check_for_zombie_jobs storage=File
71
72 bin/bacula stop 2>&1 >/dev/null
73 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
74 bstat=$?
75 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
76 rstat=$?
77 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
78 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
79    echo " "
80    echo " "
81    echo "  !!!!! auto-label-test failed!!! !!!!! "
82    echo "  !!!!! auto-label-test failed!!! !!!!! " >>test.out
83    if [ $bstat != 0 -o $rstat != 0 ] ; then
84       echo "  !!!!! Bad Job termination status     !!!!! "
85       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
86    else
87       echo "  !!!!! Restored files differ          !!!!! "
88       echo "  !!!!! Restored files differ          !!!!! " >>test.out
89    fi
90    echo " "
91 else
92    echo "  ===== auto-label-test OK ===== "
93    echo "  ===== auto-label-test OK ===== " >>test.out
94    scripts/cleanup
95 fi