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