3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
8 # Run a simple backup of the Bacula build directory
9 # prune file records, then restore only README files.
11 TestName="fileregexp-test"
19 # Zap out any schedule in default conf file so that
20 # it doesn't start during our test
23 echo "s% Schedule =%# Schedule =%g" >${outf}
24 echo "s%File Retention =%File Retention = 2 #%" >> ${outf}
25 cp ${scripts}/bacula-dir.conf ${tmp}/1
26 sed -f ${outf} ${tmp}/1 >${scripts}/bacula-dir.conf
28 change_jobname BackupClient1 $JobName
31 cat <<END_OF_DATA >${tmp}/bconcmds
35 label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0
48 cat <<END_OF_DATA >${tmp}/bconcmds
56 restore where=${tmp}/bacula-restores
67 check_for_zombie_jobs storage=File1
71 # The above restore should have restored some directories, but only
72 # files that have README in their name. There should in fact, be
73 # no other files restored COUNT_OTHER==0 and 13 README files restored.
74 # We complain if there are less than 11
76 COUNT_OTHER=`find ${tmp}/bacula-restores -type f | grep -v README | wc -l`
77 COUNT_README=`find ${tmp}/bacula-restores -type f | grep README | wc -l`
79 if [ $COUNT_OTHER -gt 0 -o $COUNT_README -lt 11 ]; then
80 print_debug "Found non matching files"
81 print_debug "Count_other=$COUNT_OTHER count_readme=$COUNT_README"
82 print_debug `find ${tmp}/bacula-restores -type f | grep -v README`
86 #check_two_logs # don't work because of "warning file count mismatch"
87 grep "Backup OK" ${tmp}/log1.out > /dev/null
89 print_debug "Found error in backup"