]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bextract-test
Update
[bacula/bacula] / regress / tests / bextract-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory but 
4 #   split the archive into two volumes, then build a BSR with
5 #   the restore command and use bextract to restore the files.
6 #
7 debug=1
8 if test "$debug" -eq 1 ; then
9   out="tee"
10 else
11   out="output"
12 fi
13
14 cwd=`pwd`
15 scripts/copy-test-confs
16 scripts/cleanup
17 echo "${cwd}/build" >/tmp/file-list
18
19 echo " "
20 echo " "
21 echo " === Starting bextract-test at `date +%R:%S` ==="
22 echo " === Starting bextract-test at `date +%R:%S` ===" >working/log
23 echo " "
24
25 cat <<END_OF_DATA >tmp/bconcmds
26 @output /dev/null
27 messages
28 @$out tmp/log1.out
29 label storage=File1 volume=TestVolume001
30 label storage=File1 volume=TestVolume002
31 update Volume=TestVolume001 MaxVolBytes=3000000
32 run job=NightlySave storage=File1 yes
33 wait
34 messages
35 @# 
36 @# now build the bsr file
37 @#
38 @$out tmp/log2.out
39 restore bootstrap=${cwd}/working/restore.bsr where=${cwd}/tmp/bacula-restores select all storage=File1 done
40 no
41 wait
42 messages
43 @$out
44 quit
45 END_OF_DATA
46
47 if test "$debug" -eq 1 ; then
48   bin/bacula start
49   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
50 else
51   bin/bacula start 2>&1 >/dev/null
52   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
53 fi
54
55 scripts/check_for_zombie_jobs storage=File1
56 bin/bacula stop 2>&1 >/dev/null
57 mkdir -p ${cwd}/tmp/bacula-restores
58 bin/bextract -b working/restore.bsr -c bin/bacula-sd.conf ${cwd}/tmp ${cwd}/tmp/bacula-restores 2>&1 >/dev/null
59 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
60 bstat=$?
61 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
62 if [ $? != 0 -o $bstat != 0 ] ; then
63    echo " "
64    echo " "
65    echo "  !!!!! bextract-test Bacula source failed!!! !!!!! "
66    echo "  !!!!! bextract-test failed!!! !!!!! " >>test.out
67    if [ $bstat != 0 ] ; then
68       echo "  !!!!! Bad Job termination status     !!!!! "
69       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
70    else
71       echo "  !!!!! Restored files differ          !!!!! "
72       echo "  !!!!! Restored files differ          !!!!! " >>test.out
73    fi
74    echo " "
75 else
76    echo "  ===== bextract-test Bacula source OK ===== "
77    echo "  ===== bextract-test OK ===== " >>test.out
78    scripts/cleanup
79 fi