]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/lib-test-root
Fix root test
[bacula/bacula] / regress / tests / lib-test-root
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 echo " "
7 echo " "
8 echo " === /lib save/restore test ==="
9 echo " "
10 echo " "
11 UID=`/usr/bin/id -u`
12 if [ $UID != 0 ] ; then
13    echo " "
14    echo "You must be root to run this test."
15    echo "  ===== Test5 failed!!! ===== "
16    echo "  ===== Test5 failed!!! ===== " >>test.out
17    echo " "
18    exit 1
19 fi
20 cwd=`pwd`
21 scripts/copy-test-confs
22 echo "/lib" >/tmp/file-list
23 rm -rf /tmp/TestVolume001 /tmp/bacula-restores
24 bin/bacula stop 2>&1 >/dev/null
25 bin/drop_sqlite_tables
26 bin/make_sqlite_tables
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 label storage=File
32 TestVolume001
33 run job=NightlySave
34 yes
35 wait
36 messages
37 @# 
38 @# now do a restore
39 @#
40 restore
41 5
42 done
43 yes
44 @sleep 1
45 wait
46 messages
47 @output
48 quit
49 END_OF_DATA
50 bin/bacula stop 2>&1 >/dev/null
51 cd /
52 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/original
53 cd /tmp/bacula-restores
54 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored
55 diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
56 if [ $? != 0 ] ; then
57    echo " "
58    echo " "
59    echo "  ===== Test5 /lib failed!!! ===== "
60    echo "  ===== Test5 failed!!! ===== " >>test.out
61    echo " "
62 else
63    echo "  ===== Test5 /lib OK ===== "
64    echo "  ===== Test5 OK ===== " >>test.out
65    cd ${cwd}
66    scripts/cleanup
67 fi