1#!/bin/sh 2# 3# This is a simple dummy test (copied from incremental-test), which 4# simply runs some jobs then does not clean up at the end. 5# This permits testing programs such as bconsole and bat with a little 6# bit of data. 7# 8TestName="dummy-test" 9JobName=Incremental 10. scripts/functions 11 12${rscripts}/cleanup 13${rscripts}/copy-test-confs 14echo "${tmpsrc}" >${tmp}/file-list 15mkdir -p ${tmpsrc} 16cp -p ${src}/src/dird/*.c ${tmpsrc} 17cd ${tmp} 18echo "${tmpsrc}/ficheriro1.txt" >restore-list 19echo "${tmpsrc}/ficheriro2.txt" >>restore-list 20cd ${cwd} 21 22change_jobname CompressedTest $JobName 23start_test 24 25cat <<END_OF_DATA >${tmp}/bconcmds 26@$out /dev/null 27messages 28@$out ${tmp}/log1.out 29@#setdebug level=100 storage=File 30@#setdebug level=200 client 31@#setdebug level=100 director 32label storage=File volume=TestVolume001 33label storage=File volume=TestVolume002 34run job=$JobName yes 35status client 36wait 37messages 38quit 39END_OF_DATA 40 41run_bareos 42check_for_zombie_jobs storage=File 43# 44# Now create two new files to be restored later 45# 46sleep 1 47echo "ficheriro1.txt" >${tmpsrc}/ficheriro1.txt 48cp -f ${tmpsrc}/dird.c ${tmpsrc}/ficheriro2.txt 49 50cat <<END_OF_DATA >${tmp}/bconcmds 51@$out /dev/null 52messages 53@$out ${tmp}/log1.out 54@# Force Incremental on the second Volume 55update volume=TestVolume001 VolStatus=Used 56run level=Differential job=$JobName yes 57wait 58messages 59quit 60END_OF_DATA 61 62run_bconsole 63 64sleep 1 65touch ${tmpsrc}/ficheriro1.txt 66touch ${tmpsrc}/ficheriro2.txt 67 68cat <<END_OF_DATA >${tmp}/bconcmds 69@$out /dev/null 70messages 71@$out ${tmp}/log1.out 72run level=Incremental job=$JobName yes 73wait 74messages 75quit 76END_OF_DATA 77 78run_bconsole 79 80sleep 1 81cd ${tmpsrc} 82cp -f ficheriro2.txt 1 83sed "s%a%b%g" 1 >ficheriro2.txt 84rm -f 1 85cd ${cwd} 86cat <<END_OF_DATA >${tmp}/bconcmds 87@$out /dev/null 88messages 89@$out ${tmp}/log1.out 90run level=Differential job=$JobName yes 91wait 92messages 93quit 94END_OF_DATA 95 96run_bconsole 97 98sleep 1 99touch ${tmpsrc}/ficheriro1.txt 100touch ${tmpsrc}/ficheriro2.txt 101cat <<END_OF_DATA >${tmp}/bconcmds 102@$out /dev/null 103messages 104@$out ${tmp}/log1.out 105run level=Incremental job=$JobName yes 106wait 107messages 108quit 109END_OF_DATA 110 111run_bconsole 112 113sleep 1 114touch ${tmpsrc}/ficheriro1.txt 115touch ${tmpsrc}/ficheriro2.txt 116cat <<END_OF_DATA >${tmp}/bconcmds 117@$out /dev/null 118messages 119@$out ${tmp}/log1.out 120run level=Incremental job=$JobName yes 121wait 122messages 123quit 124END_OF_DATA 125 126run_bconsole 127 128sleep 1 129touch ${tmpsrc}/ficheriro1.txt 130touch ${tmpsrc}/ficheriro2.txt 131cat <<END_OF_DATA >${tmp}/bconcmds 132@$out /dev/null 133messages 134@$out ${tmp}/log1.out 135run level=Incremental job=$JobName yes 136wait 137messages 138quit 139END_OF_DATA 140 141run_bconsole 142sleep 1 143touch ${tmpsrc}/ficheriro1.txt 144touch ${tmpsrc}/ficheriro2.txt 145 146cat <<END_OF_DATA >${tmp}/bconcmds 147@$out /dev/null 148messages 149@$out ${tmp}/log1.out 150setdebug level=200 storage=File 151run level=Incremental job=$JobName yes 152wait 153messages 154@# 155@# now do a restore 156@# 157@$out ${tmp}/log2.out 158setdebug level=10 storage=File 159restore where=${tmp}/bareos-restores storage=File file=<${tmp}/restore-list 160yes 161wait 162status client 163status storage=File 164messages 165quit 166END_OF_DATA 167 168run_bconsole 169check_for_zombie_jobs storage=File 170 171# 172# Stop early to leave everything defined, Bareos running, ... 173# 174exit 175 176 177# The rest of this is not executed 178stop_bareos 179 180check_two_logs 181# 182# Delete .c files because we will only restored the txt files 183# 184rm -f ${tmpsrc}/*.c 185check_restore_diff "${tmpsrc}" 186end_test 187