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