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.
7 TestName="bsr-read-test"
12 scripts/copy-migration-confs
13 scripts/prepare-disk-changer
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
20 change_jobname NightlySave $JobName
23 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
26 @$out ${cwd}/tmp/log1.out
27 label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
28 label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0
29 label storage=File volume=TestVolume001 pool=Default
30 label storage=File volume=TestVolume002 pool=Default
31 label storage=File volume=TestVolume003 pool=Default
32 update Volume=TestVolume001 maxvolbytes=120000
33 update Volume=TestVolume002 maxvolbytes=120000
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
64 @$out ${cwd}/tmp/log2.out
65 setdebug level=30 trace=1 fd
66 setdebug level=500 trace=1 storage=File
68 @# print the JobMedia records
69 select * from JobMedia;
80 @# now do a restore of the second job (to compare offset)
82 @$out ${cwd}/tmp/log3.out
92 update volume=TestVolume003 volstatus=Used
93 run job=migrate-job jobid=1 yes
94 run job=migrate-job jobid=2 yes
101 check_for_zombie_jobs storage=File
105 # check_restore_tmp_build_diff
110 $nb = $last_bloc - $last_bsr_bloc;
112 print "ERROR: read too much bytes $nb\n";
116 print "$last_job\nlast_bsr_bloc=$last_bsr_bloc last_bloc_read=$last_bloc\n";
118 $last_bsr_bloc = $last_bloc=0;
121 if (/dircmd.c.+(JobId=\d+ job=\S+) .+client_name=.+-fd/) {
127 $last_job=$1 if /dircmd.c.+(JobId=\d+ job=\S+)/;
128 $last_bsr_bloc=$1 if /fd_cmds.c:.+VolBlock=\d+-(\d+)/;
129 $last_bloc=$1 if /read_record.c.+file:block=\d+:(\d+)/;
132 }' working/*-sd.trace > tmp/result
134 grep ERROR tmp/result > /dev/null
135 if [ $? -eq 0 ]; then