]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/usr-tape-root
Pull regression truncate-test from Branch-9.1
[bacula/bacula] / regress / tests / usr-tape-root
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the /usr directory
9 #   then restore it.
10 #
11 cwd=`pwd`
12 . scripts/functions
13 scripts/copy-tape-confs
14 scripts/cleanup-tape
15 echo "/usr" >${cwd}/tmp/file-list
16
17 echo " "
18 echo " "
19 echo " === Starting usr-tape-root test ==="
20 echo " "
21 echo " "
22
23 cat <<END_OF_DATA > ${cwd}/tmp/bconcmds
24 @$out /dev/null
25 messages
26 @$out tmp/log1.out
27 label storage=tape Volume=TestVolume001 slot=0
28 run job=NightlySave yes
29 wait
30 messages
31 @# 
32 @# now do a restore
33 @#
34 @$out tmp/log2.out
35 restore where=${cwd}/tmp/bacula-restores select all done
36 yes
37 wait
38 messages
39 @output
40 quit
41 END_OF_DATA
42 run_bacula
43 stop_bacula
44 cd /
45 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-usr-test lib >${cwd}/tmp/original
46 cd ${cwd}/tmp/bacula-restores
47 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-usr-test lib >${cwd}/tmp/restored
48 cd ${cwd}/tmp
49 sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1
50 sort <1 >original
51 #
52 sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1
53 sort <1 >restored
54 rm -f 1
55 #
56 cd ${cwd}
57 diff tmp/original tmp/restored 2>&1 1>/dev/nul
58 if [ $? != 0 ] ; then
59    echo " "
60    echo " "
61    echo "  ===== !!!! usr-tape-root failed !!!! ===== "
62    echo "  ===== !!!! usr-tape-root failed !!!! ===== " >>test.out
63    echo " "
64 else
65    echo "  ===== usr-tape-root OK ===== "
66    echo "  ===== usr-tape-root OK ===== " >>test.out
67    scripts/cleanup
68 fi