]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/dev-test-root
Make FreeBSD config correctly for tapes
[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 bin/drop_sqlite_tables
21 bin/make_sqlite_tables
22 echo " "
23 echo " "
24 echo " === Starting /dev save/restore test ==="
25 echo " "
26 echo " "
27 bin/bacula start 2>&1 >/dev/null
28 bin/console -c bin/console.conf <<END_OF_DATA
29 @output /dev/null
30 messages
31 @output tmp/log1.out
32 label storage=File
33 TestVolume001
34 run job=NightlySave
35 yes
36 wait
37 messages
38 @# 
39 @# now do a restore
40 @#
41 @output tmp/log2.out
42 restore where=${cwd}/tmp/bacula-restores select all
43 yes
44 wait
45 messages
46 @output
47 quit
48 END_OF_DATA
49 bin/bacula stop 2>&1 >/dev/null
50 cd /
51 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original
52 cd ${cwd}/tmp/bacula-restores
53 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored
54 cd ${cwd}/tmp
55 cat >sed.scr <<END_OF_DATA
56 s%.*dev$%dev%
57 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ptmx%dev/ptmx%
58 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ttyp1%dev/ttyp1%
59 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/null%dev/null%
60 END_OF_DATA
61 sed -f sed.scr original | sort >original
62 #
63 sed -f sed.scr restored | sort >restored
64 rm -f sed.scr
65 #
66 cd ${cwd}
67 diff tmp/original tmp/restored 2>&1 1>/dev/null 2>&1 1>/dev/null
68 if [ $? != 0 ] ; then
69    echo " "
70    echo " "
71    echo "  ===== dev test failed!!! ===== "
72    echo "  ===== dev test failed!!! ===== " >>test.out
73    echo " "
74 else
75    echo "  ===== dev test OK ===== "
76    echo "  ===== dev test OK ===== " >>test.out
77    scripts/cleanup
78 fi