]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/bsr-read-test
Enhance virtual backup test
[bacula/bacula] / regress / tests / bsr-read-test
index 8c18e022dbf31189e699bce3074988d570dc8a75..5d0003d11a5499fff2b570a9cc0e6a87f08c2665 100755 (executable)
@@ -11,12 +11,12 @@ JobName=bsr-read
 scripts/cleanup
 scripts/copy-migration-confs
 scripts/prepare-disk-changer
+
 cp ${cwd}/build/configure ${cwd}/tmp
 cat ${cwd}/build/configure >> ${cwd}/tmp/configure
 echo "${cwd}/tmp/configure" >${cwd}/tmp/file-list
 echo "${cwd}/build" >>${cwd}/tmp/file-list
 
-
 change_jobname NightlySave $JobName
 start_test
 
@@ -24,11 +24,8 @@ cat <<END_OF_DATA >${cwd}/tmp/bconcmds
 @$out /dev/null
 messages
 @$out ${cwd}/tmp/log1.out
+label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
 label storage=File volume=TestVolume001 pool=Default
-label storage=File volume=TestVolume002 pool=Default
-label storage=File volume=TestVolume003 pool=Default
-update Volume=TestVolume001 maxvolbytes=120000
-update Volume=TestVolume002 maxvolbytes=120000
 run job=$JobName yes
 wait
 messages
@@ -56,6 +53,9 @@ messages
 run job=$JobName level=Full yes
 wait
 messages
+run job=$JobName level=Full yes
+wait
+messages
 @# 
 @# now do a restore
 @#
@@ -66,32 +66,41 @@ sql
 @# print the JobMedia records
 select * from JobMedia;
 
+@# 
+@# now do a restore
+@#
 restore
 3
-1
+2
 mark *
 done
 yes
 wait
 messages
 @# 
-@# now do a restore of the second job (to compare offset)
+@# now do a restore
 @#
 @$out ${cwd}/tmp/log3.out
 restore
 3
-2
+1
 mark *
 done
 yes
 wait
 messages
+restore all
+3
+3
+done
+yes
+wait
+messages
 @$out
-label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
-label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
-update volume=TestVolume003 volstatus=Used
+update volume=TestVolume001 volstatus=Used
 run job=migrate-job jobid=1 yes
 run job=migrate-job jobid=2 yes
+run job=migrate-job jobid=3 yes
 wait
 messages
 quit
@@ -104,4 +113,42 @@ stop_bacula
 check_two_logs
 # check_restore_tmp_build_diff
 dstat=0
+
+perl -ne '
+sub check_block {
+  return unless ($last_block || $last_bsr_block);
+  $nb = $last_block - $last_bsr_block;
+  if ($nb > 65000) {
+     print "ERROR: read too many bytes $nb\n";
+  }
+}
+sub print_stat {
+     if ($last_bsr_addr) {
+        $last_bsr_block = $last_bsr_addr & 0xFFFFFFFF;
+     }   
+     print "$last_job\nlast_bsr_block=$last_bsr_block last_block_read=$last_block\n";
+     check_block();
+     $last_bsr_block = $last_block=0;
+}
+
+if (/dircmd.c.+(JobId=\d+ job=\S+) .+client_name=.+-fd/) {
+  if ($last_job) {
+      print_stat();
+  }
+}
+
+$last_job=$1      if /dircmd.c.+(JobId=\d+ job=\S+)/;
+$last_bsr_addr=$1  if /fd_cmds.c:.+VolAddr=\d+-(\d+)/;
+$last_bsr_block=$1 if /fd_cmds.c:.+VolBlock=\d+-(\d+)/;
+$last_block=$1     if /read_record.c.+file:block=\d+:(\d+)/;
+END { 
+  print_stat();
+}' working/*-sd.trace > tmp/result
+
+grep ERROR tmp/result > /dev/null
+if [ $? -eq 0 ]; then
+    rstat=2
+    cat tmp/result
+fi
+
 end_test