1#!/bin/sh 2# 3# Run a simple backup then create some 4# new files, do an Incremental and restore those two files. 5# 6TestName="comment-test" 7JobName=Incremental 8. scripts/functions 9 10${rscripts}/cleanup 11${rscripts}/copy-test-confs 12 13# Directory to backup. 14# This directory will be created by setup_data(). 15BackupDirectory="${tmpsrc}" 16 17# Use a tgz to setup data to be backuped. 18# Data will be placed at "${tmp}/data/". 19setup_data data/flat-c.tgz 20 21# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list". 22echo "${BackupDirectory}" >${tmp}/file-list 23 24mkdir -p ${tmpsrc} 25cp -p ${tmp}/data/*.c ${tmpsrc} 26echo "${tmpsrc}/ficheriro1.txt" >${tmp}/restore-list 27echo "${tmpsrc}/ficheriro2.txt" >>${tmp}/restore-list 28 29change_jobname CompressedTest $JobName 30start_test 31 32cat <<END_OF_DATA >${tmp}/bconcmds 33@$out /dev/null 34messages 35@$out ${tmp}/log1.out 36run comment="This is a comment for $JobName" job=$JobName yes 37status client 38@sleep 5 39status dir 40label storage=File volume=TestVolume001 41mount storage=File 42wait 43messages 44@$out $tmp/log3.out 45sql 46SELECT Comment FROM Job WHERE JobId=1; 47 48quit 49END_OF_DATA 50 51run_bareos 52check_for_zombie_jobs storage=File 53# 54# Now create two new files to be restored later 55# 56sleep 1 57echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt 58echo "ficheriro2.txt" >${tmpsrc}/ficheriro2.txt 59 60cat <<END_OF_DATA >${tmp}/bconcmds 61@$out /dev/null 62messages 63@$out ${tmp}/log1.out 64@# Force Incremental on the second Volume 65update volume=TestVolume001 VolStatus=Used 66run comment="This is the incremental job" level=Differential job=$JobName yes 67@sleep 5 68status dir 69label storage=File volume=TestVolume002 70mount storage=File 71wait 72messages 73@$out $tmp/log3.out 74sql 75SELECT Comment FROM Job WHERE JobId=2; 76 77quit 78END_OF_DATA 79 80run_bconsole 81 82cat <<END_OF_DATA >${tmp}/bconcmds 83@$out /dev/null 84messages 85@$out ${tmp}/log2.out 86@# 87@# now do a restore 88@# 89restore comment="Ticket #1220 requested by toto@bareos.org" where=${tmp}/bareos-restores storage=File file=<${tmp}/restore-list 90yes 91status dir 92wait 93messages 94@$out $tmp/log3.out 95sql 96SELECT Comment FROM Job WHERE JobId=3; 97 98quit 99END_OF_DATA 100 101run_bconsole 102check_for_zombie_jobs storage=File 103stop_bareos 104 105check_two_logs 106check_restore_files_diff `cat ${tmp}/restore-list` 107 108grep "This is a comment for $JobName" $tmp/log3.out >/dev/null 109if [ $? != 0 ]; then 110 print_debug "ERR: Can't find comment" 111 estat=1 112fi 113grep "Ticket #1220 requested by toto@bareos.org" $tmp/log3.out >/dev/null 114if [ $? != 0 ]; then 115 print_debug "ERR: Can't find comment" 116 estat=1 117fi 118grep "This is the incremental job" $tmp/log3.out >/dev/null 119if [ $? != 0 ]; then 120 print_debug "ERR: Can't find comment" 121 estat=1 122fi 123end_test 124