]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/verify-data-test
regress: Fix chown error in make setup
[bacula/bacula] / regress / tests / verify-data-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 #
7 # Run a simple backup of the Bacula build directory
8 #   then verify the data on the volume.           
9 #
10 TestName="verify-data-test"
11 JobName=VerifyVol
12 . scripts/functions
13
14 cwd=`pwd`
15 scripts/cleanup
16 scripts/copy-test-confs
17 echo "${cwd}/tmp/files" >$tmp/file-list
18 echo "${cwd}/build/src/dird"      >>$tmp/file-list
19 echo "${cwd}/build/src/filed"     >>$tmp/file-list
20
21 #
22 # Add this back when verify can handle sparse files
23 #  the same way that backup does
24 #
25 mkdir -p $tmp/files
26 dd if=${cwd}/build/configure of=$tmp/files/sparsefile bs=1 count=1 seek=10M > /dev/null
27
28 change_jobname NightlySave $JobName
29 start_test
30
31 cat <<END_OF_DATA >tmp/bconcmds
32 @output /dev/null
33 messages
34 @$out tmp/log1.out
35 label storage=File volume=TestVolume001
36 run job=$JobName level=full fileset=FS1 yes
37 run job=$JobName level=full fileset=FS5 yes
38 run job=$JobName level=full fileset=FSno5 yes
39 run job=$JobName level=full fileset=FS5nocheck yes
40 wait
41 messages
42 @# 
43 @# now do a verify volume
44 @#
45 @$out ${cwd}/tmp/log2.out
46 setdebug level=10 client
47 run job=VerifyData jobid=1 yes
48 run job=VerifyData jobid=2 yes
49 run job=VerifyData jobid=3 yes
50 run job=VerifyData jobid=4 yes
51 wait
52 messages
53 quit
54 END_OF_DATA
55
56 run_bacula
57
58 sleep 2
59 check_for_zombie_jobs storage=File 
60 stop_bacula
61
62 $bperl -e 'add_attribute("$conf/bacula-sd.conf", "BlockChecksum", "no", "Device")'
63
64 nbok=2
65 if [ x$FORCE_DEDUP = xyes ]; then
66     nbok=4
67 elif [ x$FORCE_ALIGNED = xyes ]; then
68     sed -i 's/DUALCASE/PUALCASE/g' $tmp/TestVolume001.add
69 else
70     sed -i 's/DUALCASE/PUALCASE/g' $tmp/TestVolume001
71 fi
72
73 cat <<END_OF_DATA >tmp/bconcmds
74 @$out tmp/log3.out
75 @# 
76 @# now do a verify volume with errors
77 @#
78 @$out ${cwd}/tmp/log3.out
79 setdebug level=10 client
80 run job=VerifyData jobid=1 yes
81 run job=VerifyData jobid=2 yes
82 run job=VerifyData jobid=3 yes
83 run job=VerifyData jobid=4 yes
84 wait
85 messages
86 quit
87 END_OF_DATA
88
89 run_bacula
90
91 sleep 2
92 check_for_zombie_jobs storage=File
93 stop_bacula
94
95 nb=`grep "^  Termination: *Backup OK" tmp/log1.out | wc -l`
96 if [ $nb -ne 4 ]; then
97     bstat=1
98 fi
99 nb=`grep "^  Termination: *Verify OK" tmp/log2.out | wc -l`
100 if [ $nb -ne 4 ]; then
101     rstat=1
102 fi
103 nb=`grep "^  Termination: *Verify OK" tmp/log3.out | wc -l`
104 if [ $nb -ne $nbok ]; then
105     rstat=2
106 fi
107 dstat=0
108 end_test