]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/auto-label-test
b507d888dc17ae385b5242b17401a016e779e47b
[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 @output /dev/null
28 messages
29 @$out tmp/log1.out
30 status all
31 status all
32 list pools
33 messages
34 @#setdebug level=400 storage=File
35 run job=CompressedTest storage=File yes
36 list pools
37 list volumes
38 wait
39 messages
40 @# 
41 @# now do a restore
42 @#
43 @$out tmp/log2.out
44 restore where=${cwd}/tmp/bacula-restores select storage=File
45 unmark *
46 mark *
47 count
48 ls *
49 dir *
50 find Makefile
51 pwd
52 lsmark
53 estimate
54 ?
55 help
56 done
57 yes
58 wait
59 messages
60 @$out
61 quit
62 END_OF_DATA
63
64 if test "$debug" -eq 1 ; then
65   bin/bacula start
66   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
67 else
68   bin/bacula start 2>&1 >/dev/null
69   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
70 fi
71
72 scripts/check_for_zombie_jobs storage=File
73
74 bin/bacula stop 2>&1 >/dev/null
75 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
76 bstat=$?
77 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
78 rstat=$?
79 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
80 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
81    echo " "
82    echo " "
83    echo "  !!!!! auto-label-test failed!!! !!!!! "
84    echo "  !!!!! auto-label-test failed!!! !!!!! " >>test.out
85    if [ $bstat != 0 -o $rstat != 0 ] ; then
86       echo "  !!!!! Bad Job termination status     !!!!! "
87       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
88    else
89       echo "  !!!!! Restored files differ          !!!!! "
90       echo "  !!!!! Restored files differ          !!!!! " >>test.out
91    fi
92    echo " "
93 else
94    echo "  ===== auto-label-test OK ===== "
95    echo "  ===== auto-label-test OK ===== " >>test.out
96    scripts/cleanup
97 fi