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