]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bsr-read-test
regress: tweak the message in the update_win32()
[bacula/bacula] / regress / tests / bsr-read-test
1 #!/bin/sh
2 #
3 # Run a backup of a small file, then do several other backups
4 #   to expand the size of a volume.  Then do a restore of the first
5 #   file, and make sure it doesn't read to the end of the disk.
6 #
7 TestName="bsr-read-test"
8 JobName=bsr-read
9 . scripts/functions
10
11 scripts/cleanup
12 scripts/copy-migration-confs
13 scripts/prepare-disk-changer
14
15 cp ${cwd}/build/configure ${cwd}/tmp
16 cat ${cwd}/build/configure >> ${cwd}/tmp/configure
17 echo "${cwd}/tmp/configure" >${cwd}/tmp/file-list
18 echo "${cwd}/build" >>${cwd}/tmp/file-list
19
20 change_jobname NightlySave $JobName
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=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
28 label storage=File volume=TestVolume001 pool=Default
29 run job=$JobName yes
30 wait
31 messages
32 list jobs
33 @# print the JobMedia records
34 sql
35 select * from JobMedia;
36
37 quit
38 END_OF_DATA
39
40 run_bacula
41 check_for_zombie_jobs storage=File
42 stop_bacula
43
44 echo "${cwd}/build" >${cwd}/tmp/file-list
45
46 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
47 @$out /dev/null
48 messages
49 @$out ${cwd}/tmp/log1.out
50 run job=$JobName level=Full yes
51 wait
52 messages
53 run job=$JobName level=Full yes
54 wait
55 messages
56 run job=$JobName level=Full yes
57 wait
58 messages
59 @# 
60 @# now do a restore
61 @#
62 @$out ${cwd}/tmp/log2.out
63 setdebug level=30 trace=1 fd
64 setdebug level=500 trace=1 storage=File
65 sql
66 @# print the JobMedia records
67 select * from JobMedia;
68
69 @# 
70 @# now do a restore
71 @#
72 restore
73 3
74 2
75 mark *
76 done
77 yes
78 wait
79 messages
80 @# 
81 @# now do a restore
82 @#
83 @$out ${cwd}/tmp/log3.out
84 restore
85 3
86 1
87 mark *
88 done
89 yes
90 wait
91 messages
92 restore all
93 3
94 3
95 done
96 yes
97 wait
98 messages
99 update volume=TestVolume001 volstatus=Used
100 run job=migrate-job jobid=1 yes
101 run job=migrate-job jobid=2 yes
102 run job=migrate-job jobid=3 yes
103 wait
104 messages
105 quit
106 END_OF_DATA
107
108 run_bacula
109 check_for_zombie_jobs storage=File
110 stop_bacula
111
112 check_two_logs
113 # check_restore_tmp_build_diff
114 dstat=0
115
116 perl -ne '
117 sub check_block {
118   return unless ($last_block || $last_bsr_block);
119   $nb = $last_block - $last_bsr_block;
120   if ($nb > 65000) {
121      print "ERROR: read too many bytes $nb\n";
122   }
123 }
124 sub print_stat {
125      if ($last_bsr_addr) {
126         $last_bsr_block = $last_bsr_addr & 0xFFFFFFFF;
127      }   
128      print "$last_job\nlast_bsr_block=$last_bsr_block last_block_read=$last_block\n";
129      check_block();
130      $last_bsr_block = $last_block=0;
131 }
132
133 if (/dircmd.c.+(JobId=\d+ job=\S+) .+client_name=.+-fd/) {
134   if ($last_job) {
135       print_stat();
136   }
137 }
138
139 $last_job=$1      if /dircmd.c.+(JobId=\d+ job=\S+)/;
140 $last_bsr_addr=$1  if /fd_cmds.c:.+VolAddr=\d+-(\d+)/;
141 $last_bsr_block=$1 if /fd_cmds.c:.+VolBlock=\d+-(\d+)/;
142 $last_block=$1     if /read_record.c.+file:block=\d+:(\d+)/;
143 END { 
144   print_stat();
145 }' working/*-sd.trace > tmp/result
146
147 grep ERROR tmp/result > /dev/null
148 if [ $? -eq 0 ]; then
149     rstat=2
150     cat tmp/result
151 fi
152
153 end_test