]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/dev-test-root
Before done change
[bacula/bacula] / regress / tests / dev-test-root
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 MUID=`/usr/bin/id -u`
7 if [ $MUID != 0 ] ; then
8    echo " "
9    echo "You must be root to run this test."
10    echo "  ===== dev test failed!!! ===== "
11    echo "  ===== dev test failed!!! ===== " >>test.out
12    echo " "
13    exit 1
14 fi
15 cwd=`pwd`
16 scripts/copy-test-confs
17 scripts/cleanup
18 echo "/dev" >/tmp/file-list
19 bin/bacula stop 2>&1 >/dev/null
20 cd bin
21 ./drop_bacula_tables >/dev/null 2>&1
22 ./make_bacula_tables >/dev/null 2>&1
23 ./grant_bacula_privileges 2>&1 >/dev/null
24 cd ..
25 echo " "
26 echo " "
27 echo " === Starting /dev save/restore test ==="
28 echo " "
29 echo " "
30 bin/bacula start 2>&1 >/dev/null
31 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
32 @output /dev/null
33 messages
34 @output tmp/log1.out
35 label storage=File
36 TestVolume001
37 run job=NightlySave
38 yes
39 wait
40 messages
41 @# 
42 @# now do a restore
43 @#
44 @output tmp/log2.out
45 restore where=${cwd}/tmp/bacula-restores select all
46 yes
47 wait
48 messages
49 @output
50 quit
51 END_OF_DATA
52 bin/bacula stop 2>&1 >/dev/null
53 cd /
54 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original
55 cd ${cwd}/tmp/bacula-restores
56 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored
57 cd ${cwd}/tmp
58 cat >sed.scr <<END_OF_DATA
59 s%.*dev$%dev%
60 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ptmx%dev/ptmx%
61 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ttyp1%dev/ttyp1%
62 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/null%dev/null%
63 END_OF_DATA
64 sed -f sed.scr original | sort >original
65 #
66 sed -f sed.scr restored | sort >restored
67 rm -f sed.scr
68 #
69 cd ${cwd}
70 diff tmp/original tmp/restored 2>&1 1>/dev/null 2>&1 1>/dev/null
71 if [ $? != 0 ] ; then
72    echo " "
73    echo " "
74    echo "  ===== dev test failed!!! ===== "
75    echo "  ===== dev test failed!!! ===== " >>test.out
76    echo " "
77 else
78    echo "  ===== dev test OK ===== "
79    echo "  ===== dev test OK ===== " >>test.out
80    scripts/cleanup
81 fi