From: Eric Bollengier Date: Tue, 21 Jul 2020 08:49:34 +0000 (+0200) Subject: BEE Backport regress scripts X-Git-Tag: Release-11.3.2~1396 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f26c4cb08703b595abe1609de92d2ad0f2f037b;p=thirdparty%2Fbacula.git BEE Backport regress scripts --- diff --git a/regress/tests/bad-password-test b/regress/tests/bad-password-test new file mode 100755 index 0000000000..09908de2fc --- /dev/null +++ b/regress/tests/bad-password-test @@ -0,0 +1,102 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Use incorrect name/password to connect each daemon +# and check that we are properly kicked out +# +TestName="bad-password-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 + +change_jobname BackupClient1 $JobName +start_test + +cat <$tmp/bconcmds +setdebug level=100 trace=1 client +setdebug level=100 trace=1 storage +quit +END_OF_DATA + +run_bacula + +cat <$tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +reload +status dir +@$out $tmp/log2.out +status client +@$out $tmp/log3.out +status storage +quit +END_OF_DATA + +run_bconsole + +cp $conf/*.conf $tmp/ +cp $tmp/bconcmds $tmp/bconcmds.tpl + +################################################################ +# Test FD with incorrect password +cp $tmp/*.conf $conf/ +sed s:/log:/log-client: $tmp/bconcmds.tpl > $tmp/bconcmds + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Password', 'xxx', 'Client')" +run_bconsole + +################################################################ +# Test SD with incorrect password +cp $tmp/*.conf $conf/ +sed s:/log:/log-sd: $tmp/bconcmds.tpl > $tmp/bconcmds + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Password', 'xxx', 'Storage')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Password', 'xxx', 'Autochanger')" +run_bconsole + +################################################################ +# Test DIR with incorrect password + +cp $tmp/*.conf $conf/ +sed s:/log:/log-cons: $tmp/bconcmds.tpl > $tmp/bconcmds + +$bperl -e "add_attribute('$conf/bconsole.conf', 'Password', 'xxx', 'Director')" +run_bconsole + +################################################################ +# Test back with good passwords +cp $tmp/*.conf $conf/ +sed s:/log:/log-back: $tmp/bconcmds.tpl > $tmp/bconcmds + +run_bconsole + +################################################################ +# Check logs, all daemons should answer the call +nb=`grep "Daemon started" $tmp/log-back* | wc -l` +if [ $nb != 3 ]; then + print_debug "ERROR: Should find 3 daemon status in $tmp/log-back*" + estat=1 +fi + +# Threads are taking some time to cleanup the memory +sleep 7 + +export CHECK_JOBMEDIA=0 +export CHECK_ENCRYPTION=0 + +stop_bacula +end_test diff --git a/regress/tests/base-job-test b/regress/tests/base-job-test index 1048a7a43e..39ec28ebeb 100755 --- a/regress/tests/base-job-test +++ b/regress/tests/base-job-test @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Run a basejob backup of the Bacula build directory diff --git a/regress/tests/bconsole-test b/regress/tests/bconsole-test index 4405e89997..6fe226c16e 100755 --- a/regress/tests/bconsole-test +++ b/regress/tests/bconsole-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a couple of tests with bconsole # @@ -62,12 +60,18 @@ if [ $? -ne 0 ]; then estat=5 fi -perl -Mscripts::functions \ +$bperl \ -e "extract_resource('$conf/bconsole.conf', 'Director', '$HOST-dir')" \ > $tmp/1 sed "s/$HOST-dir/bconsole-test-dir/" $tmp/1 >> $conf/bconsole.conf +$bperl \ + -e "add_attribute('$conf/bconsole.conf', 'HistoryFile', '$tmp/histfile', 'Director', 'bconsole-test-dir')" + +$bperl \ + -e "add_attribute('$conf/bconsole.conf', 'HistoryFileSize', '200', 'Director', 'bconsole-test-dir')" \ + $bin/bconsole -t -c $conf/bconsole.conf > $tmp/1 < /dev/null if [ $? -ne 0 ]; then print_debug "configuration tweak failed" @@ -116,8 +120,13 @@ if [ $? -ne 0 ]; then estat=13 fi +if [ ! -f $tmp/histfile ]; then + print_debug "bconsole history file not found" + estat=14 +fi + # Do not try to check jobmedia with this test export CHECK_JOBMEDIA=0 - +export CHECK_OPENFILE=0 stop_bacula end_test diff --git a/regress/tests/bextract-test b/regress/tests/bextract-test index e43c641e0d..bf03c14a32 100755 --- a/regress/tests/bextract-test +++ b/regress/tests/bextract-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a simple backup of the Bacula build directory but # split the archive into two volumes, then build a BSR with diff --git a/regress/tests/big-catalog b/regress/tests/big-catalog new file mode 100755 index 0000000000..f5ebc92a96 --- /dev/null +++ b/regress/tests/big-catalog @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Small test to setup a backup with $nb_files*2 to backup, +# then, we can run multiple full jobs over the directory +# and create a "large" catalog. +# +use strict; + +# use bacula functions +use scripts::functions; + +my $nb_files = 250000; +my $SD="storage=File"; + +# initialize the configuration +if ($FORCE_DEDUP eq 'yes') { + system("scripts/copy-test-confs"); +} else { + system("scripts/copy-fifo-confs"); + $SD = ""; +} + +start_test(); + +# cleanup the previous conf +cleanup(); + +# Create 500,000 files in files directory +create_many_hardlinks("$cwd/files", $nb_files); + +# initialize the fileset +add_to_backup_list("$cwd/files/"); + +# Do not use spooling +add_attribute("$conf/bacula-dir.conf", "SpoolData", "no", "Job"); + +# We will run the jobs as fast as possible +set_global_maximum_concurrent_jobs(10); + +start_bacula(); + +create_bconcmds( + "$out $tmp/log1.out", + "label volume=TestVolume001 pool=Scratch $SD"); + +run_bconsole(); + +create_bconcmds( + "run job=NightlySave level=full yes", + "run job=NightlySave level=full yes", + "run job=NightlySave level=full yes", + "run job=NightlySave level=full yes", + "run job=NightlySave level=full yes", + "run job=NightlySave level=full yes", + "wait", + "messages"); + +run_bconsole(); + +stop_bacula(); + +end_test(); diff --git a/regress/tests/big-files-test b/regress/tests/big-files-test index c9c942dda4..c63f3a049f 100755 --- a/regress/tests/big-files-test +++ b/regress/tests/big-files-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Test if Bacula can handle big fileset # This test create 2M files on a directory and diff --git a/regress/tests/big-fileset-test b/regress/tests/big-fileset-test index 1167bf4049..bf3082d8c5 100755 --- a/regress/tests/big-fileset-test +++ b/regress/tests/big-fileset-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Test if Bacula can handle big fileset # diff --git a/regress/tests/big-virtual-changer-test b/regress/tests/big-virtual-changer-test index 144c683b5d..9445c9af17 100755 --- a/regress/tests/big-virtual-changer-test +++ b/regress/tests/big-virtual-changer-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a simple backup of the Bacula build directory. Create three # tapes, each in a different pool, then run two jobs both of which diff --git a/regress/tests/big-vol-test b/regress/tests/big-vol-test index 38283779d7..45afaffead 100755 --- a/regress/tests/big-vol-test +++ b/regress/tests/big-vol-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Create a big Volume > 5 GB and backup to it to test disk # seeking on big volumes. We cheat and artifically grow @@ -13,11 +11,7 @@ TestName="big-vol-test" JobName=bigvol . scripts/functions -if test x$FORCE_CLOUD = xyes ; then - echo "\n=== Test $TestName skipped not compatible with Cloud ===" - exit 0 -fi - +unset FORCE_CLOUD scripts/cleanup scripts/copy-test-confs diff --git a/regress/tests/bls-test b/regress/tests/bls-test index 8df11a1516..ff7fa1b1bb 100755 --- a/regress/tests/bls-test +++ b/regress/tests/bls-test @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Run a simple backup of the Bacula build directory then bls diff --git a/regress/tests/bpipe-test b/regress/tests/bpipe-test index 5c2845b32a..80898e8add 100755 --- a/regress/tests/bpipe-test +++ b/regress/tests/bpipe-test @@ -1,9 +1,8 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # -# # Attempt to backup and restore a file with the bpipe plugin # TestName="bpipe-test" @@ -25,7 +24,6 @@ messages @$out ${cwd}/tmp/log1.out label storage=File1 volume=TestVolume001 estimate job=$JobName level=Full -setdebug level=100 client=$CLIENT @#setdebug level=50 traclient=$CLIENT run job=$JobName storage=File1 yes wait @@ -72,6 +70,23 @@ if [ $nb -ne 1 ]; then bstat=1 fi +nb=`grep $file $tmp/list | wc -l` +if [ $nb -ne 1 ]; then + print_debug "ERROR: Should find the RestoreObject for $file in $tmp/list" + bstat=1 +fi + +nb=`grep Makefile $tmp/list | wc -l` +if [ $nb -ne 1 ]; then + print_debug "ERROR: Should find the RestoreObject for Makefile in $tmp/list" + bstat=1 +fi + +nb=`grep restore_command $tmp/conf | wc -l` +if [ $nb -ne 2 ]; then + print_debug "ERROR: Should find the RestoreObject for Makefile and $file in $tmp/conf" + bstat=1 +fi cat <$tmp/obj restore_command="cat >$tmp/Makefile.bak" @@ -85,7 +100,7 @@ messages @$out ${cwd}/tmp/log3.out setdebug level=50 client=$CLIENT trace=1 @putfile obj1 $tmp/obj -restore where=${cwd}/tmp select all storage=File1 done +restore pluginrestoreconf="2:obj1" where=${cwd}/tmp select all storage=File1 done yes wait setdebug level=0 client=$CLIENT trace=0 @@ -98,15 +113,16 @@ run_bconsole # # Remove plugin so we can try the restore without the plugin # -mv -f ${cwd}/bin/plugins/bpipe-fd.so ${cwd}/bin/plugins/bpipe-fd.sox +mkdir -p $tmp/empty +$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Plugin Directory", "$tmp/empty", "FileDaemon")' cat <${cwd}/tmp/bconcmds @$out ${cwd}/tmp/log2.out @# @# now do a restore without the plugin @# -@$out ${cwd}/tmp/log2.out @#setdebug level=50 client=$CLIENT +status client restore where=${cwd}/tmp select all storage=File1 done yes wait @@ -123,12 +139,24 @@ stop_bacula # # Restore plugin # -mv -f ${cwd}/bin/plugins/bpipe-fd.sox ${cwd}/bin/plugins/bpipe-fd.so +#$bperl -e 'add_attribute("$conf/bacula-fd.conf", "Plugin Directory", "$plugin", "FileDaemon")' + +grep "bpipe-fd" $tmp/log2.out > /dev/null +if [ $? = 0 ]; then + print_debug "ERROR: Should not find plugin in client status output ($tmp/log2.out)" + estat=1 +fi check_two_logs # # ****FIXME**** test that all three files are restored correctly # +diff ${cwd}/Makefile ${cwd}/tmp/Makefile.bak +dstat=$? + +diff ${cwd}/${file} ${cwd}/tmp/${file} +dstat=$(($dstat + $?)) + diff ${cwd}/tmp/@bpipe@/${file} ${cwd}/${file} dstat=$(($dstat + $?)) diff --git a/regress/tests/bpipe-unittests b/regress/tests/bpipe-unittests new file mode 100755 index 0000000000..dd7b55b247 --- /dev/null +++ b/regress/tests/bpipe-unittests @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# This is an open_bpipe() unit test +# +TestName="bpipe_test" +. scripts/functions +make -C $src/src/tools install-unittests + +$bin/$TestName +exit $? diff --git a/regress/tests/bpipe2-test b/regress/tests/bpipe2-test new file mode 100755 index 0000000000..f41fd8cec8 --- /dev/null +++ b/regress/tests/bpipe2-test @@ -0,0 +1,121 @@ +#!/bin/sh +# +# Copyright (C) 2000-2020 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# Attempt to backup and restore a file with the bpipe plugin and +# play with stdout/stderr +# +TestName="bpipe2-test" +JobName=pluginTest +. scripts/functions + +scripts/cleanup +scripts/copy-plugin-confs + +file=bpipe.sh +rm -rf ${cwd}/tmp/* +echo "${cwd}/README" >${cwd}/tmp/file-list + +start_test + +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +label storage=File1 volume=TestVolume001 +run job=$JobName fileset=bpipe storage=File1 yes +wait +status client=$CLIENT +messages +@$out ${cwd}/tmp/log3.out +restore comment="Should finish in error" select all done yes +wait +messages +quit +END_OF_DATA + +# make check_two_logs happy +touch $tmp/log2.out + +run_bacula + +cat <${cwd}/tmp/bconcmds +@$out $tmp/files +list files jobid=1 +END_OF_DATA + +run_bconsole + +if ! test -f $tmp/bpipe.sh +then + print_debug "ERROR: Unable to find $tmp/bpipe.sh" + estat=1 +fi + +$rscripts/bpipe.sh > $tmp/1 2> /dev/null + +if ! diff $tmp/bpipe.sh $tmp/1 +then + print_debug "ERROR: Found a difference in $tmp/bpipe.sh and $tmp/1" + estat=1 +fi + +str="This is a message for Bacula" +grep "$str" $tmp/log1.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find string in job log $tmp/log1.out" + estat=1 +fi + +str="This is an error message" +grep "$str" $tmp/log3.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find '$str' in $tmp/log3.out" + estat=1 +fi + +str="An other line for Bacula" +grep "$str" $tmp/log1.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find '$str' in $tmp/log1.out" + estat=1 +fi + +str="This is an error message" +grep "$str" $tmp/log3.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find '$str' in $tmp/log3.out" + estat=1 +fi + +str="Last line for Bacula" +grep "$str" $tmp/log3.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find '$str' in $tmp/log3.out" + estat=1 +fi + +str="Error closing for file /@bpipe@/bpipe-error-restore.sh" +grep "$str" $tmp/log3.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find '$str' in $tmp/log3.out" + estat=1 +fi + +str="Error closing for file /@bpipe@/error" +grep "$str" $tmp/log1.out > /dev/null +if [ $? -ne 0 ] +then + print_debug "ERROR: Should find '$str' in $tmp/log1.out" + estat=1 +fi + +stop_bacula +end_test diff --git a/regress/tests/breaddir-unittests b/regress/tests/breaddir-unittests new file mode 100755 index 0000000000..f2632aa99d --- /dev/null +++ b/regress/tests/breaddir-unittests @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Copyright (C) 2000-2018 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# This is an breaddir() unit test +# +TestName="breaddir_test" +. scripts/functions +make -C $src/src/tools install-unittests + +$bin/$TestName +exit $? diff --git a/regress/tests/broken-media-bug-2-test b/regress/tests/broken-media-bug-2-test index dcdc8f07b0..fa7b8ca8a0 100755 --- a/regress/tests/broken-media-bug-2-test +++ b/regress/tests/broken-media-bug-2-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Show the broken media bug(s) again. Test by Graham Keeling. # @@ -43,9 +41,9 @@ echo "${cwd}/build" >${cwd}/tmp/file-list start_test -echo "Creating huge ${hugefilesize}M file..." -dd if=/dev/urandom of="$hugefile" bs=1M count="$hugefilesize" -echo "Done" +#echo "Creating huge ${hugefilesize}M file..." +dd if=/dev/urandom of="$hugefile" bs=1M count="$hugefilesize" >/dev/null 2>&1 +#echo "Done" cat >tmp/bconcmds <tmp/file-list + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +label storage=File1 +TestVolume001 +run job=$JobName storage=File1 +yes +wait +sql +select * from JobMedia; + +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File1 +$bin/bacula-ctl-sd stop + +print_debug "Corrupting the volume..." +echo "BB02" >> $tmp/TestVolume001 + +$bin/bacula-ctl-sd start + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName storage=File1 level=full yes +wait +sql +select * from JobMedia; + +messages +purge volume=TestVolume001 +quit +END_OF_DATA + +run_bconsole + +echo "volume=TestVolume001" >$tmp/bscan.bsr +bscan_libdbi + +# If the database has a password pass it to bscan +if test "x${db_password}" = "x"; then + PASSWD= +else + PASSWD="-P ${db_password}" +fi + +if test "$debug" -eq 1 ; then + $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -S -p -b $tmp/bscan.bsr -s -c $conf/bacula-sd.conf $tmp +else + $bin/bscan -w working $BSCANLIBDBI -u ${db_user} -n ${db_name} $PASSWD -S -r -p -v -b $tmp/bscan.bsr -s -c $conf/bacula-sd.conf $tmp >$tmp/log3.out 2>&1 +fi + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log2.out +restore where=$tmp/bacula-restores1 jobid=3 all done yes +restore where=$tmp/bacula-restores2 jobid=4 all done yes +wait +messages +quit +END_OF_DATA + +$bin/bacula-ctl-sd stop +$bin/bacula-ctl-sd start -p + +run_bconsole +stop_bacula + +$rscripts/diff.pl -s $tmp/bacula-restores1/$cwd/build -d $cwd/build +if [ $? != 0 ]; then + print_debug "ERROR: Unable to restore jobid 1 after bscan" + estat=1 +fi +$rscripts/diff.pl -s $tmp/bacula-restores2/$cwd/build -d $cwd/build +if [ $? != 0 ]; then + print_debug "ERROR: Unable to restore jobid 2 after bscan" + estat=1 +fi +end_test diff --git a/regress/tests/bscan-tape b/regress/tests/bscan-tape index cf5adc3dc6..669d851eef 100755 --- a/regress/tests/bscan-tape +++ b/regress/tests/bscan-tape @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a simple backup of the Bacula build directory using the compressed option # then backup four times, each with incremental then diff --git a/regress/tests/bscan-test b/regress/tests/bscan-test index 81a07de274..89e19714bb 100755 --- a/regress/tests/bscan-test +++ b/regress/tests/bscan-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a simple backup of the Bacula build directory but # split the archive into two volumes then bscan it diff --git a/regress/tests/bsr-opt-test b/regress/tests/bsr-opt-test index 3bacfc1b93..08961a127a 100755 --- a/regress/tests/bsr-opt-test +++ b/regress/tests/bsr-opt-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2018 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a simple backup of the Bacula build directory but # split the archive into two volumes, then restore @@ -23,6 +21,9 @@ change_jobname NightlySave $JobName start_test MaxVolBytes=3000000 +if test x$FORCE_DEDUP = xyes; then + MaxVolBytes=60000 +fi cat <${cwd}/tmp/bconcmds @$out /dev/null messages @@ -81,7 +82,7 @@ if [ $? != 0 -o $bsrstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then echo " " exit 1 else - echo " ===== End bsr-opt-test OK `date +%R:%S` ===== " - echo " ===== End bsr-opt-test OK `date +%R:%S` ===== " >>test.out + echo " ===== bsr-opt-test Bacula source OK `date +%R:%S` ===== " + echo " ===== bsr-opt-test OK `date +%R:%S` ===== " >>test.out scripts/cleanup fi diff --git a/regress/tests/bsr-read-test b/regress/tests/bsr-read-test index cd607b0fff..6148ae48a4 100755 --- a/regress/tests/bsr-read-test +++ b/regress/tests/bsr-read-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Run a backup of a small file, then do several other backups # to expand the size of a volume. Then do a restore of the first @@ -15,7 +13,6 @@ JobName=bsr-read scripts/cleanup scripts/copy-migration-confs -scripts/prepare-disk-changer cp ${cwd}/build/configure ${cwd}/tmp cat ${cwd}/build/configure >> ${cwd}/tmp/configure diff --git a/regress/tests/bsr-skip-issue-test b/regress/tests/bsr-skip-issue-test new file mode 100755 index 0000000000..248a7e7159 --- /dev/null +++ b/regress/tests/bsr-skip-issue-test @@ -0,0 +1,110 @@ +#!/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 +# then restore it. +# Full Pool1 FileVolume001 +# Incr Pool1 FileVolume002 -> FileVolume001 +# Incr Pool1 - FileVolume001 +# +# The 2nd incremental will spread data on a new volume +# and on the previous volume. +# +# Volume SessTime/SessId FI New FI +# rt-incr-disk1-10915 1563431298/23607 13 = 45 +# rt-incr-disk1-3547 1565527787/4 2 = 46 +# rt-incr-disk1-3547 1565527787/4 5 = 47 +# rt-incr-disk1-3547 1565527787/4 9 = 48 +# rt-incr-disk1-3547 1565527787/4 13 = 49 +# rt-incr-disk1-3547 1565527787/1151 2 = 50 +# rt-incr-disk1-10915 1565527787/1151 4 = 51 +# rt-incr-disk1-10915 1565527787/1151 10 = 52 + +TestName="bsr-skip-issue-test" +JobName=Vbackup +. scripts/functions + + +scripts/cleanup +scripts/copy-migration-confs +echo "${cwd}/build" >${cwd}/tmp/file-list + +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'Accurate', 'yes', 'Job')" +$bperl -e "add_attribute('$conf/bacula-dir.conf', 'SpoolData', 'no', 'Job')" +$bperl -e "add_attribute('$conf/bacula-sd.conf', 'MaximumFileSize', '1MB', 'Device')" + +rm -f $cwd/build/inc1 $cwd/build/inc2 $cwd/build/diff1 + +change_jobname NightlySave $JobName +start_test + +# Write out bconsole commands +cat <${cwd}/tmp/bconcmds +@output /dev/null +messages +@$out ${cwd}/tmp/log1.out +@#setdebug level=100 storage=File +label storage=File volume=FileVolume001 Pool=Special +label storage=File volume=FileVolume002 Pool=Special +update volume=FileVolume002 maxvolbytes=1MB +label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 +@# run several jobs +@exec "sh -c 'date > ${cwd}/build/date'" +run job=$JobName level=Full pool=Special yes +wait +update volume=FileVolume001 volstatus=Used +messages +list jobs +END_OF_DATA + +run_bacula + +$cwd/bin/bacula-ctl-sd restart + +cat <${cwd}/tmp/bconcmds +@$out ${cwd}/tmp/log1.out +@exec "touch $cwd/build/po/fr.po" +@exec "sh -c 'cp $cwd/build/po/fr.po $cwd/build/inc1'" +@exec "sh -c 'cp $cwd/build/po/fr.po $cwd/build/inc3'" +run job=$JobName level=Incremental pool=Special yes +wait mount +update volume=FileVolume001 volstatus=Append +mount storage=File drive=0 slot=0 +wait +messages +list jobs +@exec "touch $cwd/build/po/de.po" +@exec "sh -c 'cp $cwd/build/po/de.po $cwd/build/inc2'" +run job=$JobName level=Incremental pool=Special yes +wait +messages +@# should Consolidate Full, Incremental +run job=$JobName level=VirtualFull yes +wait +messages +list jobs +@# +@# now do a restore of the consolidated Full +@# +@$out $tmp/log2.out +@#delete jobid=1,2,3 yes +restore where=${cwd}/tmp/restore1 select all done yes +wait +messages +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + +# +# We only used one log so copy it to the second log +# so that any restore errors will be picked up +# +check_two_logs +check_restore_diff + +end_test diff --git a/regress/tests/bsr-test b/regress/tests/bsr-test index e88f37fed6..1f94c979c6 100755 --- a/regress/tests/bsr-test +++ b/regress/tests/bsr-test @@ -1,9 +1,8 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # -# # Run a simple backup of the Bacula build directory # then restore it. Used to generate BSR files. # diff --git a/regress/tests/btape-fill-full-changer b/regress/tests/btape-fill-full-changer index 1a6cb1c5f5..22d827be14 100755 --- a/regress/tests/btape-fill-full-changer +++ b/regress/tests/btape-fill-full-changer @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Test the fill command in btape diff --git a/regress/tests/btape-fill-full-tape b/regress/tests/btape-fill-full-tape index af58430f4e..1e8c9211a2 100755 --- a/regress/tests/btape-fill-full-tape +++ b/regress/tests/btape-fill-full-tape @@ -1,9 +1,8 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # -# # Test the fill command in btape # TestName="btape-fill-full-tape" diff --git a/regress/tests/btape-test b/regress/tests/btape-test index 272da07647..46a934991d 100755 --- a/regress/tests/btape-test +++ b/regress/tests/btape-test @@ -1,9 +1,8 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # -# # Test the test command in btape # TestName="btape-test" diff --git a/regress/tests/btape-test-changer b/regress/tests/btape-test-changer index 4980bc08c0..f0f2efed65 100755 --- a/regress/tests/btape-test-changer +++ b/regress/tests/btape-test-changer @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Test the test command in btape diff --git a/regress/tests/btape-test-tape b/regress/tests/btape-test-tape index e4f4f72569..d58afc5746 100755 --- a/regress/tests/btape-test-tape +++ b/regress/tests/btape-test-tape @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Test the test command in btape # @@ -20,12 +18,12 @@ change_jobname $JobName start_test if test "$debug" -eq 1 ; then - $bin/btape -c bin/bacula-sd.conf Drive-0 <${cwd}/tmp/log1.out 2>&1 + $bin/btape -w $tmp -c bin/bacula-sd.conf Drive-0 <${cwd}/tmp/log1.out 2>&1 test quit END_OF_DATA @@ -47,12 +45,12 @@ cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 sed -e 's%64512%262144%' ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf if test "$debug" -eq 1 ; then - $bin/btape -c bin/bacula-sd.conf Drive-0 <${cwd}/tmp/log2.out 2>&1 + $bin/btape -w $tmp -c bin/bacula-sd.conf Drive-0 <${cwd}/tmp/log2.out 2>&1 test quit END_OF_DATA diff --git a/regress/tests/bug-1227 b/regress/tests/bug-1227 index 54e8e098fb..c84883a715 100755 --- a/regress/tests/bug-1227 +++ b/regress/tests/bug-1227 @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Test that reproduce bug 1227 # diff --git a/regress/tests/bug-7640 b/regress/tests/bug-7640 new file mode 100755 index 0000000000..83a5c762bb --- /dev/null +++ b/regress/tests/bug-7640 @@ -0,0 +1,124 @@ +#!/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 then create some +# new files, do an Incremental and restore those two files. +# +TestName="bug-7640" +JobName=bug-7640 +. scripts/functions + +${rscripts}/cleanup +${rscripts}/copy-test-confs +echo $tmp/big >${tmp}/file-list +echo $cwd/build/po >>${tmp}/file-list + +dd if=/dev/zero of=$tmp/big seek=1000000 count=1 +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "SpoolData", "No", "Job")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "ClientRunBeforeJob", "\"sleep 30\"", "Job", "NightlySave")' +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "MaximumConcurrentJobs", "10", "Device")' +sed -i 's/sparse=yes;//' $conf/bacula-dir.conf + +change_jobname NightlySave $JobName +start_test + +cat <${tmp}/bconcmds +@output /dev/null +messages +@$out ${tmp}/log1.out +label storage=File volume=TestVolume000 +label storage=File volume=TestVolume001 +label storage=File volume=TestVolume002 +setdebug level=10 storage +@# With VolUse=15s nothing restored for JobId 2 +@#update volume=TestVolume000 VolUse=15s +@# With VolUse=20s both JobId 2 and 3 restore wrong size +update volume=TestVolume000 VolUse=20s +update volume=TestVolume001 maxvolbytes=100MB +sql +select VolumeName, MediaId FROM Media; + +run job=$JobName level=full yes +@sleep 15 +setbandwidth limit="5000 kb/s" client=$CLIENT +run job=$JobName level=full yes +run job=$JobName level=full yes +@sleep 20 +run job=$JobName level=full yes +@sleep 10 +@#status client +@#status dir +@#status storage +@sleep 10 +setbandwidth limit=0 client=$CLIENT +wait +messages +sql +select jobid, mediaid, firstindex,lastindex,volindex from JobMedia order by jobid,volindex; +select * from JobMedia order by jobid,volindex; + +@$out $tmp/jobmedia2 +list jobmedia jobid=2 +@$out $tmp/jobmedia3 +list jobmedia jobid=3 +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File + +cat <${tmp}/bconcmds +@# +@# now do a restore that will fail (JobId 2) +@# +@$out ${tmp}/log2.out +setdebug level=10 storage=File +@# Select by JobId 2 +restore where=${tmp}/bacula-restores storage=File +3 +2 +cd $tmp +m big +done +yes +wait +@# Select by JobId 3 +restore where=${tmp}/bacula-restores2 storage=File +3 +3 +cd $tmp +m big +done +yes +wait +@#status client +@#status storage=File +messages +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + +grep -q TestVolume000 $tmp/jobmedia2 && grep -q TestVolume001 $tmp/jobmedia2 && grep -q TestVolume002 $tmp/jobmedia2 + +if [ $? -ne 0 ]; then + print_debug "ERROR: should find TestVolume{000, 001 and 002} volumes for JobId 2" + estat=1 +fi + +grep -q TestVolume001 $tmp/jobmedia3 && grep -q TestVolume002 $tmp/jobmedia3 + +if [ $? -ne 0 ]; then + print_debug "ERROR: should find TestVolume{001 and 002} for JobId 3" + estat=1 +fi + +$bin/bls -c $conf/bacula-sd.conf -j -V 'TestVolume000|TestVolume001|TestVolume002' FileStorage > $tmp/bls.jobs +$bin/bls -c $conf/bacula-sd.conf -V 'TestVolume000|TestVolume001|TestVolume002' FileStorage > $tmp/bls.files + +check_two_logs +end_test diff --git a/regress/tests/bug-897 b/regress/tests/bug-897 index f81fc0f39f..4fd1a0e594 100755 --- a/regress/tests/bug-897 +++ b/regress/tests/bug-897 @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Test bug 897 # diff --git a/regress/tests/bug-fatal-test b/regress/tests/bug-fatal-test index 911d3cbd67..b610c34b58 100755 --- a/regress/tests/bug-fatal-test +++ b/regress/tests/bug-fatal-test @@ -1,9 +1,7 @@ #!/bin/sh # -# Copyright (C) 2000-2015 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS -# - # # Test RunScript # diff --git a/regress/tests/bug-rwhere-7768 b/regress/tests/bug-rwhere-7768 new file mode 100755 index 0000000000..faf474b837 --- /dev/null +++ b/regress/tests/bug-rwhere-7768 @@ -0,0 +1,73 @@ +#!/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 then restore a subdirectory +# to see if some extra directories are restored also. +# +# On Windows, it creates a problem when using RegexWhere +# +# RegexWhere: !F:/priv/RZB1_Swiadectwa!!i,!^!F:/priv/RESTORE! +# Bacula is trying to restore F:/priv/ and the regex engine is +# creating a directory "F:/priv/RESTOREF:/priv/" which is not possible +# +TestName="bug-rwhere-7768" +JobName=bug-rwhere-7768 +. scripts/functions + +${rscripts}/cleanup +${rscripts}/copy-test-confs +echo $cwd/build >${tmp}/file-list + +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "SpoolData", "No", "Job")' +sed -i 's/!restored/restored/i' $conf/bacula-fd.conf + +change_jobname NightlySave $JobName +start_test + +cat <${tmp}/bconcmds +@output /dev/null +messages +@$out ${tmp}/log1.out +label storage=File volume=TestVolume000 +run job=$JobName level=full yes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File + +cat <${tmp}/bconcmds +@# +@# now do a restore that will fail (JobId 2) +@# +@$out ${tmp}/log2.out +setdebug level=10 storage=File +restore strip_prefix="$cwd/build" add_prefix="$cwd/tmp" where=/ storage=File +5 +cd $cwd/build +m po +done +yes +wait +messages +@$out $tmp/log3.out +list joblog jobid=2 +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + +nb=`grep $tmp $tmp/log3.out | grep -v po | wc -l` +if [ $nb -gt 0 ]; then + print_debug "ERROR: Should not find a line with $tmp in $tmp/log3.out, only po directory was selected" + estat=1 +fi + +check_two_logs +end_test diff --git a/regress/tests/bvfs-cmds-test b/regress/tests/bvfs-cmds-test index 9d85f1f4f3..760fe15e42 100755 --- a/regress/tests/bvfs-cmds-test +++ b/regress/tests/bvfs-cmds-test @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Run a simple backup of the Bacula build directory then create some @@ -21,7 +21,7 @@ cp -p $src/src/dird/*.c $tmpsrc change_jobname CompressedTest $JobName start_test -$bperl -e 'add_attribute("$conf/bacula-dir.conf", "ClientRunBeforeJob", "sleep 2", "Job")' +$bperl -e 'add_attribute("$conf/bacula-dir.conf", "ClientRunAfterJob", "sleep 2", "Job")' cat <$tmp/bconcmds @$out /dev/null @@ -88,7 +88,7 @@ grep '^2$' $tmp/log5.out >/dev/null # with a limit estat=`expr $estat + $?` grep '^3$' $tmp/log6.out >/dev/null # with a filter on the date estat=`expr $estat + $?` -grep '^2$' $tmp/log7.out >/dev/null # with a filter on the date +grep '^1$' $tmp/log7.out >/dev/null # with a filter on the date estat=`expr $estat + $?` stop_bacula diff --git a/regress/tests/bvfs-restore-test b/regress/tests/bvfs-restore-test index 68acd6b31c..632ae45fbd 100755 --- a/regress/tests/bvfs-restore-test +++ b/regress/tests/bvfs-restore-test @@ -1,5 +1,8 @@ #!/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 then create some # new files, do an Incremental and restore those two files. # test the bvfs interface diff --git a/regress/tests/bvfs-test b/regress/tests/bvfs-test index ca4f515ef3..3cba72cd79 100755 --- a/regress/tests/bvfs-test +++ b/regress/tests/bvfs-test @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2000-2017 Kern Sibbald +# Copyright (C) 2000-2020 Kern Sibbald # License: BSD 2-Clause; see file LICENSE-FOSS # # Run a simple backup of the Bacula build directory then create some @@ -18,6 +18,8 @@ echo "${cwd}/build" >> ${tmp}/file-list mkdir -p ${tmpsrc} cp -p ${src}/src/dird/*.c ${tmpsrc} +mkdir $tmpsrc/directory +echo test > $tmpsrc/directory/1 cd ${tmp} echo "${tmpsrc}/ficheriro1.txt" >restore-list echo "${tmpsrc}/ficheriro2.txt" >>restore-list @@ -85,14 +87,23 @@ cd ${tmpsrc} cp -f ficheriro2.txt 1 sed "s%a%b%g" 1 >ficheriro2.txt rm -f 1 +rm -rf directory cd ${cwd} cat <${tmp}/bconcmds @$out /dev/null messages @$out ${tmp}/log1.out -run level=Differential job=$JobName yes +run level=Differential accurate=yes job=$JobName yes wait messages +@$out $tmp/log35.out +.bvfs_update jobid=1,2,3,4 +.bvfs_lsdir jobid=1,2,3 path=$tmp/build/ +.bvfs_lsdir jobid=1,4 path=$tmp/build/ +@$out $tmp/log36.out +sql +SELECT * FROM PathVisibility JOIN Path USING (PathId) WHERE JobId=4; + quit END_OF_DATA @@ -148,6 +159,18 @@ rm -f ${tmpsrc}/dird_conf.c touch ${tmpsrc}/ficheriro2.txt ln ${tmpsrc}/ficheriro2.txt ${tmpsrc}/hardlink2 +# A linux system has 2000 symlinks +for i in `seq 1 4000` +do + cat /etc/hosts > ${tmpsrc}/file$i.txt + ln ${tmpsrc}/file$i.txt ${tmpsrc}/hl.$i +done + +for i in `seq 1 50` +do + ln ${tmpsrc}/file$i.txt ${tmpsrc}/hl2.$i +done + cat <${tmp}/bconcmds @$out /dev/null messages @@ -159,9 +182,9 @@ messages @$out ${tmp}/log3.out .bvfs_update .bvfs_lsdir path=$tmpsrc/ jobid=1,2,3,4,5,6,7,8 -.bvfs_lsfile path=$tmpsrc/ jobid=1,2,3,4,5,6,7,8 +.bvfs_lsfile path=$tmpsrc/ jobid=1,2,3,4,5,6,7,8 limit=5000 @$out ${tmp}/log31.out -.bvfs_lsfile path=$tmpsrc/ jobid=1,2,3,4,5,6,7 +.bvfs_lsfile path=$tmpsrc/ jobid=1,2,3,4,5,6,7 limit=5000 @$out ${tmp}/log32.out .bvfs_lsfile path=$tmpsrc/ jobid=1,2,3,4,5,6,7,8 filename=ficheriro1.txt quit @@ -238,14 +261,13 @@ cat <${tmp}/bconcmds .bvfs_cleanup path=b21 END_OF_DATA -jidx=`awk -F '\t' '/ficheriro2.txt|hardlinks2/ { lstat=$5 } - END { print ".bvfs_decode_lstat lstat=\"" lstat "\"" -} ' $tmp/log3.out | $bin/bconsole -c $conf/bconsole.conf | awk -F= '/LinkFI/ { print $2 } '` +# We get the last of ficheriro2.txt and hardlink2 to get the LinkFI +jidx=`awk -F '\t' '/ficheriro2.txt|hardlink2/ { print "@echo fileid=" $3; print ".bvfs_decode_lstat lstat=\"" $5 "\"" } ' $tmp/log3.out | $bin/bconsole -c $conf/bconsole.conf | awk -F= '/LinkFI=[1-9][0-9]*/ { print $2 } '` + +fileid=`awk -F '\t' '/ficheriro2.txt|hardlink2/ { print "@echo fileid=" $3; print ".bvfs_decode_lstat lstat=\"" $5 "\"" } ' $tmp/log3.out | $bin/bconsole -c $conf/bconsole.conf | awk -F= '/fileid=/ { fileid=$2 } /LinkFI=[1-9][0-9]*/ { print fileid } '` -awk '/ficheriro2.txt/ { if (!id) { id=$3 } } /hardlink2/ { if (!id) { id=$3 } } - END { - print ".bvfs_restore jobid=1,2,3,4,5,6,7,8 hardlink=8,'$jidx' fileid=" id " path=b21" - } ' $tmp/log3.out >> $tmp/bconcmds +# We take the last between ficheriro2.txt and hardlink2, and we restore both via the hardlink command +echo ".bvfs_restore jobid=1,2,3,4,5,6,7,8 hardlink=8,$jidx fileid=$fileid path=b21" >> $tmp/bconcmds cat <>${tmp}/bconcmds @$out $tmp/log2.out @@ -295,6 +317,17 @@ if [ $? != 0 ]; then estat=1 fi +nb=`grep directory/ $tmp/log35.out | wc -l` +if [ $nb != 1 ]; then + print_debug "ERROR: Should find only one time directory/ in $tmp/log35.out" + estat=1 +fi + +nb=`grep directory/ $tmp/log36.out | wc -l` +if [ $nb != 0 ]; then + print_debug "ERROR: Should not find directory/ in $tmp/log36.out" + estat=1 +fi # # Delete .c files because we will only restored the txt files diff --git a/regress/tests/cancel-all-test b/regress/tests/cancel-all-test new file mode 100755 index 0000000000..8405c7c022 --- /dev/null +++ b/regress/tests/cancel-all-test @@ -0,0 +1,87 @@ +#!/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 +# and test the cancel all command +# +# We test "cancel all" => no/. nothing canceled, restore possible +# We test "cancel all" => yes and "cancel all yes", two canceled jobs +# +TestName="cancel-all-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 + +change_jobname BackupClient1 $JobName +start_test + +cat <$tmp/bconcmds +@output /dev/null +messages +@$out $tmp/log1.out +label volume=TestVolume001 storage=File1 pool=File slot=1 drive=0 +setbandwidth limit=2MB/s client +run job=$JobName yes +@sleep 2 +cancel all +no +cancel all +. +setbandwidth limit=100MB/s client +wait +messages +@# +@# now do a restore +@# +@$out $tmp/log2.out +setdebug level=4 storage=File1 +restore where=$tmp/bacula-restores select all done +yes +wait +messages +@$out $tmp/log3.out +setbandwidth limit=2MB/s client +run job=$JobName level=full yes +@sleep 2 +cancel all +yes +setbandwidth limit=100MB/s client +wait +messages +@$out $tmp/log3.out +setbandwidth limit=2MB/s client +run job=$JobName level=full yes +@sleep 2 +cancel all yes +setbandwidth limit=100MB/s client +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File1 +stop_bacula + +nb=`grep "Backup Canceled" $tmp/log3.out | wc -l` +if [ $nb != 2 ]; then + print_debug "ERROR: Should find two jobs canceled in $tmp/log3.out" + estat=1 +fi + +check_two_logs +check_restore_diff +end_test diff --git a/regress/tests/copy-sqlquery-duplicate-test b/regress/tests/copy-sqlquery-duplicate-test index ea78754065..ae49539ade 100755 --- a/regress/tests/copy-sqlquery-duplicate-test +++ b/regress/tests/copy-sqlquery-duplicate-test @@ -1,5 +1,8 @@ #!/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 then copy it # to another device. #