]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/restore2-by-file-test
Before done change
[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 scripts/check_for_zombie_jobs storage=File
45 bin/bacula stop 2>&1 >/dev/null
46 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
47 bstat=$?
48 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
49 rstat=$?
50 dstat=0
51 for i in `cat ${cwd}/tmp/restore2-list`; do  
52    diff $i ${cwd}/tmp/bacula-restores$i
53    if [ $? != 0 ] ; then
54       dstat=1
55    fi
56 done
57 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
58    echo " "
59    echo " "
60    echo "  !!!!! restore2-by-file-test Bacula source failed!!! !!!!! "
61    echo "  !!!!! restore2-by-file-test failed!!! !!!!! " >>test.out
62    echo " "
63    echo "Backup term status  = $bstat"
64    echo "Restore term status = $rstat"
65    echo "Diff status         = $dstat"
66    echo " "
67 else
68    echo "  ===== restore2-by-file-test Bacula source OK ===== "
69    echo "  ===== restore2-by-file-test OK ===== " >>test.out
70    scripts/cleanup
71 fi