From: Eric Bollengier Date: Wed, 2 Sep 2020 13:16:07 +0000 (+0200) Subject: BEE Backport regress/tests/fs-error-test X-Git-Tag: Release-11.3.2~1228 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2fbbc3a1368fd2d9dcab4b05d8a0b8658480b4ba;p=thirdparty%2Fbacula.git BEE Backport regress/tests/fs-error-test This commit is the result of the squash of the following main commits: Author: Eric Bollengier Date: Tue Jul 21 10:28:13 2020 +0200 regress: Add copyright to regress scripts Author: Eric Bollengier Date: Fri Feb 22 10:16:16 2019 +0100 regress: Adapt fs-error-test to not report restore errors Author: Eric Bollengier Date: Wed Feb 20 09:56:03 2019 +0100 regress: Add simple test with NFS like errors --- diff --git a/regress/tests/fs-error-test b/regress/tests/fs-error-test new file mode 100755 index 0000000000..0bcb8591cd --- /dev/null +++ b/regress/tests/fs-error-test @@ -0,0 +1,98 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Run a simple backup of the Bacula build directory on a FS that will simulate a problem +# +TestName="fs-error-test" +JobName=backup +. scripts/functions + +scripts/cleanup +scripts/copy-confs + +# +# Zap out any schedule in default conf file so that +# it doesn't start during our test +# +outf="$tmp/sed_tmp" +echo "s% Schedule =%# Schedule =%g" >${outf} +cp $scripts/bacula-dir.conf $tmp/1 +sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf + +# move the volume in a specific directory +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "Archive Device", "$tmp/mnt", "Device")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "MaxWaitTime", "10s", "Job")' +$bperl -e 'set_global_maximum_concurrent_jobs(10)' + +mkdir $tmp/mnt $tmp/base +trap "fusermount -u $tmp/mnt" EXIT + +make -C $cwd/build/src/tools install-fs-io-error +$bin/fs-io-error -? 2> /dev/null > /dev/null +if [ $? != 1 ]; then + print_debug "ERROR: Fuse system not installed" + exit 0 +fi + +size=`du -sb $cwd/build | awk '{print $1 }'` +$bin/fs-io-error -b $tmp/base -e $size -d 50 -p '*/TestVolume001' -- fs-io-error -f $tmp/mnt > $tmp/fs-io-error.log 2>&1 & + +change_jobname BackupClient1 $JobName +start_test + +cat <$tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +setbandwidth limit=4MB/s client +setdebug level=200 trace=1 storage=File1 +label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0 +run job=$JobName level=full yes +run job=$JobName level=full yes +@sleep 5 +status dir +wait +messages +@$out $tmp/log3.out +llist jobid=1 +@$out $tmp/log4.out +llist jobid=2 +@# +@# now do a verify +@# +@$out $tmp/log5.out +setdebug level=4 storage=File1 +restore where=$tmp/bacula-restores1 jobid=1 all done yes +restore where=$tmp/bacula-restores2 jobid=2 all done yes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula + +# The restore is in error for sure +touch $tmp/log2.out +#check_two_logs + +job1=`awk 'BEGIN { IGNORECASE=1 } /joberrors:/ { print $2 }' $tmp/log3.out` +job2=`awk 'BEGIN { IGNORECASE=1 } /joberrors:/ { print $2 }' $tmp/log4.out` + +$rscripts/diff.pl -s $cwd/build -d $tmp/bacula-restores1/$cwd/build > /dev/null +if [ $? != 0 -a "$job1" = 0 ]; then + print_debug "ERROR: The first job should notify a problem" + estat=1 +fi + +$rscripts/diff.pl -s $cwd/build -d $tmp/bacula-restores2/$cwd/build > /dev/null +if [ $? != 0 -a "$job2" = 0 ]; then + print_debug "ERROR: The second job should notify a problem" + estat=1 +fi + +#check_restore_diff +end_test