1#!/bin/sh 2# 3# Run a simple backup 4# to two tapes where the maximum tape file size is set to 1M 5# Note, this test simulates the tape filling and writing to 6# the next tape. One minor wrinkle: we create the two tapes 7# in the Scratch pool, so they should be switched to the Default 8# Pool automatically. 9# We set TestVolume001 to not in the changer, so the algorithm 10# should find TestVolume002 and use it rather than blocking. 11# 12# Note we use the viritual disk autochanger 13# 14TestName="scratch-pool-test" 15JobName=scratch-pool 16. scripts/functions 17 18cwd=`pwd` 19scripts/cleanup 20scripts/copy-2disk-confs 21scripts/prepare-disk-changer 22 23 24# Directory to backup. 25# This directory will be created by setup_data(). 26BackupDirectory="${tmp}/data" 27 28# Use a tgz to setup data to be backed up. 29# Data will be placed at "${tmp}/data/". 30setup_data data/small.tgz 31 32# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 33echo "${BackupDirectory}" >${tmp}/file-list 34 35 36 37outf="${cwd}/tmp/sed_tmp" 38echo "s%# Maximum File Size% Maximum File Size%g" >${outf} 39cp ${cwd}/bin/bareos-sd.conf ${cwd}/tmp/1 40sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bareos-sd.conf 41 42change_jobname NightlySave $JobName 43start_test 44 45# Write out bconsole commands 46cat <<END_OF_DATA >${cwd}/tmp/bconcmds 47@$out /dev/null 48messages 49@$out ${cwd}/tmp/log1.out 50label storage=tape volume=TestVolume001 slot=1 pool=Scratch drive=0 51label storage=tape volume=TestVolume002 slot=2 pool=Scratch drive=0 52update Volume=TestVolume001 MaxVolBytes=2000000 pool=Scratch drive=0 53update Volume=TestVolume001 inchanger=no pool=Scratch drive=0 54@#setdebug level=200 storage=tape 55llist volume=TestVolume001 56llist volume=TestVolume002 57run job=$JobName yes 58wait 59messages 60list volumes 61llist volume=TestVolume001 62@# 63@# now do a restore 64@# 65@$out ${cwd}/tmp/log2.out 66restore where=${cwd}/tmp/bareos-restores select all storage=tape done 67yes 68wait 69messages 70quit 71END_OF_DATA 72 73run_bareos 74check_for_zombie_jobs storage=tape 75stop_bareos 76 77check_two_logs 78check_restore_diff 79end_test 80