3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a backup of a small file, then do several other backups
9 # to expand the size of a volume. Then do a restore of the first
10 # file, and make sure it doesn't read to the end of the disk.
12 TestName="bsr-read-test"
17 scripts/copy-migration-confs
18 scripts/prepare-disk-changer
20 cp ${cwd}/build/configure ${cwd}/tmp
21 cat ${cwd}/build/configure >> ${cwd}/tmp/configure
22 echo "${cwd}/tmp/configure" >${cwd}/tmp/file-list
23 echo "${cwd}/build" >>${cwd}/tmp/file-list
25 change_jobname NightlySave $JobName
28 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @$out ${cwd}/tmp/log1.out
32 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
33 label storage=File volume=TestVolume001 pool=Default
38 @# print the JobMedia records
40 select * from JobMedia;
46 check_for_zombie_jobs storage=File
49 echo "${cwd}/build" >${cwd}/tmp/file-list
51 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
54 @$out ${cwd}/tmp/log1.out
55 run job=$JobName level=Full yes
58 run job=$JobName level=Full yes
61 run job=$JobName level=Full yes
67 @$out ${cwd}/tmp/log2.out
68 setdebug level=30 trace=1 fd
69 setdebug level=500 trace=1 storage=File
71 @# print the JobMedia records
72 select * from JobMedia;
88 @$out ${cwd}/tmp/log3.out
104 update volume=TestVolume001 volstatus=Used
105 run job=migrate-job jobid=1 yes
106 run job=migrate-job jobid=2 yes
107 run job=migrate-job jobid=3 yes
114 check_for_zombie_jobs storage=File
118 # check_restore_tmp_build_diff
123 return unless ($last_block || $last_bsr_block);
124 $nb = $last_block - $last_bsr_block;
126 print "ERROR: read too many bytes $nb\n";
130 if ($last_bsr_addr) {
131 $last_bsr_block = $last_bsr_addr & 0xFFFFFFFF;
133 print "$last_job\nlast_bsr_block=$last_bsr_block last_block_read=$last_block\n";
135 $last_bsr_block = $last_block=0;
138 if (/dircmd.c.+(JobId=\d+ job=\S+) .+client_name=.+-fd/) {
144 $last_job=$1 if /dircmd.c.+(JobId=\d+ job=\S+)/;
145 $last_bsr_addr=$1 if /fd_cmds.c:.+VolAddr=\d+-(\d+)/;
146 $last_bsr_block=$1 if /fd_cmds.c:.+VolBlock=\d+-(\d+)/;
147 $last_block=$1 if /read_record.c.+file:block=\d+:(\d+)/;
150 }' working/*-sd.trace > tmp/result
152 grep ERROR tmp/result > /dev/null
153 if [ $? -eq 0 ]; then