]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/dev-test-root
Apply fixes in bug #890
[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
7 TestName="dev-test-root"
8 . scripts/functions
9
10 require_root
11
12 scripts/cleanup
13 scripts/copy-test-confs
14 echo "/dev" >/tmp/file-list
15
16 start_test
17
18 cat <<END_OF_DATA >tmp/bconcmds
19 @output /dev/null
20 messages
21 @output tmp/log1.out
22 label storage=File volume=TestVolume001
23 run job=NightlySave yes
24 wait
25 messages
26 @# 
27 @# now do a restore
28 @#
29 @output tmp/log2.out
30 restore where=${cwd}/tmp/bacula-restores select all done
31 yes
32 wait
33 messages
34 @output
35 quit
36 END_OF_DATA
37
38 run_bacula  
39 check_for_zombie_jobs storage=File
40 stop_bacula
41
42 # More cleanup needed below
43
44 cd /
45 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original
46 cd ${cwd}/tmp/bacula-restores
47 ${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored
48 cd ${cwd}/tmp
49 #
50 # Use sed to cut out parts that *always* change
51 #
52 cat >sed.scr <<END_OF_DATA
53 s%.*dev$%dev%
54 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ptmx%dev/ptmx%
55 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ttyp1%dev/ttyp1%
56 s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/null%dev/null%
57 END_OF_DATA
58
59 # strip file system change messages then sed and sort
60 grep -v "Skip: File system change prohibited." original >1
61 sed -f sed.scr 1 | sort >original
62 #
63 mv -f restored 1
64 sed -f sed.scr 1 | sort >restored
65 rm -f sed.scr
66 #
67 cd ${cwd}
68 diff tmp/original tmp/restored 2>&1 1>/dev/null
69 if [ $? != 0 ] ; then
70    echo " "
71    echo " "
72    echo "  ===== !!!! dev-test-root failed !!!! ===== "
73    echo "  ===== !!!! dev-test-root failed !!!! ===== " >>test.out
74    echo " "
75 else
76    echo "  ===== dev-test-root OK ===== "
77    echo "  ===== dev-test-root OK ===== " >>test.out
78    scripts/cleanup
79 fi