]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore2-by-file-test
acf8a457bedb442d34cd37dd951d1818faf34010
[bacula/bacula] / regress / tests / restore2-by-file-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then restore a few selected files.
5 #
6 cwd=`pwd`
7 scripts/copy-test-confs
8 scripts/cleanup
9 echo "${cwd}/build" >/tmp/file-list
10 sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list
11 bin/bacula stop  2>&1 >/dev/null
12 cd bin
13 ./drop_bacula_tables >/dev/null 2>&1
14 ./make_bacula_tables >/dev/null 2>&1
15 ./grant_bacula_privileges 2>&1 >/dev/null
16 cd ..
17
18 echo " "
19 echo " "
20 echo " === Starting restore2-by-file-test ==="
21 echo " === Starting restore2-by-file-test ===" >>working/log
22 echo " "
23
24 bin/bacula start 2>&1 >/dev/null
25 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
26 @output /dev/null
27 messages
28 @output tmp/log1.out
29 label storage=File volume=TestVolume001
30 run job=CompressedTest yes
31 wait
32 messages
33 @# 
34 @# now do a restore
35 @#
36 @output tmp/log2.out
37 restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore2-list
38 yes
39 wait
40 messages
41 @output
42 quit
43 END_OF_DATA
44 bin/bacula stop 2>&1 >/dev/null
45 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
46 bstat=$?
47 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
48 rstat=$?
49 dstat=0
50 for i in `cat ${cwd}/tmp/restore2-list`; do  
51    diff $i ${cwd}/tmp/bacula-restores$i
52    if [ $? != 0 ] ; then
53       dstat=1
54    fi
55 done
56 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
57    echo " "
58    echo " "
59    echo "  !!!!! restore2-by-file-test Bacula source failed!!! !!!!! "
60    echo "  !!!!! restore2-by-file-test failed!!! !!!!! " >>test.out
61    echo " "
62    echo "Backup term status  = $bstat"
63    echo "Restore term status = $rstat"
64    echo "Diff status         = $dstat"
65    echo " "
66 else
67    echo "  ===== restore2-by-file-test Bacula source OK ===== "
68    echo "  ===== restore2-by-file-test OK ===== " >>test.out
69    scripts/cleanup
70 fi