]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bextract-test
commit changes
[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=0
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 exit
59 bin/bextract -b working/restore.bsr -c bin/bacula-sd.conf ${cwd}/tmp ${cwd}/tmp/bacula-restores 2>&1 >/dev/null
60 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
61 bstat=$?
62 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
63 if [ $? != 0 -o $bstat != 0 ] ; then
64    echo " "
65    echo " "
66    echo "  !!!!! bextract-test Bacula source failed!!! !!!!! "
67    echo "  !!!!! bextract-test failed!!! !!!!! " >>test.out
68    if [ $bstat != 0 ] ; then
69       echo "  !!!!! Bad Job termination status     !!!!! "
70       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
71    else
72       echo "  !!!!! Restored files differ          !!!!! "
73       echo "  !!!!! Restored files differ          !!!!! " >>test.out
74    fi
75    echo " "
76 else
77    echo "  ===== bextract-test Bacula source OK ===== "
78    echo "  ===== bextract-test OK ===== " >>test.out
79    scripts/cleanup
80 fi