From: Kern Sibbald Date: Fri, 14 Sep 2007 17:17:12 +0000 (+0000) Subject: Update to trunk X-Git-Tag: Release-2.2.4~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d0f528dcb0bd8e5c39f65ba69777054800ff6f8;p=bacula%2Fbacula Update to trunk git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@5562 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/Makefile b/regress/Makefile new file mode 100644 index 0000000000..d33f78c0cf --- /dev/null +++ b/regress/Makefile @@ -0,0 +1,69 @@ +# +# Makefile for Bacula regression testing +# +# Before running, you must create a file named config containing +# the configuration parameters. Create it by doing: +# +# cp prototype.conf config +# +# Then edit config and set the value for what are appropriate for you. +# + +first_rule: all + +all: + +setup: bacula sed + +# +# Some machines cannot handle the sticky bit and other garbage that +# is in weird-files, so we load and run it only on Linux machines. +# +bacula: all + @rm -rf bin build weird-files tmp + @rm -f w.tar.gz w.tar + @cp weird-files.tar.gz w.tar.gz + @-gunzip w.tar.gz + @-tar xf w.tar + @rm -f w.tar.gz w.tar + @rm -rf tmp working + mkdir tmp working + echo "Doing: scripts/setup" + scripts/setup + +sed: + echo "Doing: scripts/do_sed" + scripts/do_sed + +# Run all non-root userid tests +test: + ./all-non-root-tests + +# run all file and tape tests +full_test: + ./all-tape-and-file-tests + +# These tests require you to run as root +root_test: + ./all-root-tests + +clean: + scripts/cleanup + rm -f /tmp/file-list + rm -fr tmp/* working/* + rm -f test.out + rm -f diff + rm -f 1 2 3 scripts/1 scripts/2 scripts/3 tests/1 tests/2 tests/3 + find . -name .#* -exec rm -rf {} \; + +# Reset our userid after running as root +reset: + chown -R ${USER}:${USER} . tmp working + scripts/cleanup + rm -f /tmp/file-list tmp/file-list + rm -f tmp/* working/* + +distclean: clean + rm -rf bin build weird-files weird-files weird-files2 tmp working + rm -f scripts/*.conf + diff --git a/regress/Makefile.in b/regress/Makefile.in deleted file mode 100644 index 6d8c2505ed..0000000000 --- a/regress/Makefile.in +++ /dev/null @@ -1,74 +0,0 @@ -# -# Makefile for Bacula regression testing -# -# Note, Makefile is built from Makefile.in, which you should not really -# need to change, by envoking: -# -# ./config -# e.g. -# -# ./config kern.conf -# -# - -# suck in user's configuration -@CONFIG@ - -first_rule: all - -all: - -setup: bacula sed - -# -# Some machines cannot handle the sticky bit and other garbage that -# is in weird-files, so we load and run it only on Linux machines. -# -bacula: all - @rm -rf bin build weird-files tmp - @rm -f w.tar.gz w.tar - @cp weird-files.tar.gz w.tar.gz - @-gunzip w.tar.gz - @-tar xf w.tar - @rm -f w.tar.gz w.tar - @rm -rf tmp working - mkdir tmp working - echo "Doing: scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS} ${OPENSSL}" - scripts/setup ${BACULA_SOURCE} ${EMAIL} ${WHICHDB} ${TCPWRAPPERS} ${SMTP_HOST} ${OPENSSL} - -sed: - echo "Doing: scripts/do_sed ${EMAIL} ${TAPE_DRIVE} ${AUTOCHANGER} ${AUTOCHANGER_PATH} ${TAPE_DRIVE1} ${SMTP_HOST}" - scripts/do_sed ${EMAIL} ${TAPE_DRIVE} ${AUTOCHANGER} ${AUTOCHANGER_PATH} ${TAPE_DRIVE1} ${SMTP_HOST} - -# Run all non-root userid tests -test: - ./all-non-root-tests - -# run all file and tape tests -full_test: - ./all-tape-and-file-tests - -# These tests require you to run as root -root_test: - ./all-root-tests - -clean: - scripts/cleanup - rm -f /tmp/file-list - rm -fr tmp/* working/* - rm -f test.out - rm -f diff - rm -f 1 2 3 scripts/1 scripts/2 scripts/3 tests/1 tests/2 tests/3 - find . -name .#* -exec rm -rf {} \; - -# Reset our userid after running as root -reset: - chown -R ${USER}:${USER} . tmp working - scripts/cleanup - rm -f /tmp/file-list tmp/file-list - rm -f tmp/* working/* - -distclean: clean - rm -rf bin build weird-files weird-files weird-files2 tmp working - rm -f scripts/*.conf - diff --git a/regress/README b/regress/README index 09dbc73bbe..d289c630a3 100644 --- a/regress/README +++ b/regress/README @@ -13,13 +13,12 @@ system uses MySQL, you can use SQLite here. To set it up, create your personal configuration file, by -copying prototype.conf to xxx.conf or simply editing prototype.conf -directly. +copying prototype.conf to config or simply editing prototype.conf +directly then copying it to the file config. -Then edit your conf file and define appropriate values -for the variables that are in that file. If you want to see -a real example, look at kern.conf, but please don't use my -email address! +You must end up with a file named config in the main regress +directory that has all the specifications that correspond to +your system. If you are using SQLite, make sure that depkgs is pre-built if it isn't already: (cd your-depkgs; make sqlite). @@ -38,7 +37,6 @@ SQLite as the database, while my production uses MySQL. Then do: - ./config xxx.conf make setup You run the above one time. This will build a Makefile from diff --git a/regress/README.mingw32 b/regress/README.mingw32 index c6f1cfe671..14e6df0087 100644 --- a/regress/README.mingw32 +++ b/regress/README.mingw32 @@ -7,14 +7,14 @@ Date: 30 August 2007 04:09:00 Hey guys, I've made a bit of progress on the win32 regression scripts. In order to use the win32 bacula regression scripts, it is important to have -some unix tools (mainly sed). To make things simple, I downloaded UnxUtils -from http://sourceforge.net/projects/unxutils +some unix tools (such as sed, grep, and diff). To make things simple, I +downloaded UnxUtils from http://sourceforge.net/projects/unxutils -Extract this somewhere on your hdd ( I extracted to C:\unxutils ) and add -the usr\local\wbin path from wherever you extracted the utils ( for me it -was C:\unxutils\usr\local\wbin ) to your {$PATH} on your windows box. If you -also want to make use of the shell (from unxutils) you may want to add the -./bin directory as well (or just copy the sh.exe file to usr\local\wbin). +Extract this somewhere on your hdd and add the the files in usr\local\wbin to +c:\regress\tools and then add c:\regress\tools to your {$PATH} on your windows +box. If you also want to make use of the shell (from unxutils) you may want +to add the ./bin directory as well (or just copy the sh.exe file to +usr\local\wbin). Now that you have a working toolset (with sed) we can continue setting up regression tools. Compile the Ming32 version of bacula (from linux) and then @@ -35,8 +35,10 @@ bin\bacula_cats.dll > nul" and replace "cats_sqlite.dll" with binaries from the bacula sources and create a local bacula testing platform. ----------- -At this point all three of the bacula daemons fail miserably mentioning -something about bacula.dll. I will try figuring out what else is wrong -because when I installed the same build of bacula with the installer the -system ran fine. I'm guessing there are some outdated test configurations -and filenames causing bacula to go on the fritz. +After the "make setup" all the configuration files are blank, so you must +fix that before running the scripts. + +With the above, most of the regressions scripts seem to function flawlessly. + +[KES] The ones that fail have probably been modified on the Unix side + after the port was done, so they may need some minor updates. diff --git a/regress/config b/regress/config deleted file mode 100755 index 6088502400..0000000000 --- a/regress/config +++ /dev/null @@ -1,9 +0,0 @@ -#/bin/sh -# -# First argument is expected to be a user's configuration file -# -if ! test -f $1 ; then - echo "Arg1 must specify a config file (e.g. prototype.conf)" - exit 1 -fi -sed -e "/@CONFIG@/r $1" -e "s/@CONFIG@//" Makefile.in >Makefile diff --git a/regress/endtime b/regress/endtime index faf419f70d..0502fec376 100755 --- a/regress/endtime +++ b/regress/endtime @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python from time import time as now t = now() diff --git a/regress/prototype.conf b/regress/prototype.conf index eebf594360..17053a9423 100644 --- a/regress/prototype.conf +++ b/regress/prototype.conf @@ -35,3 +35,7 @@ TCPWRAPPERS="--with-tcp-wrappers" # Bacula configuration options here, such as --disable-batch-insert # OPENSSL="--with-openssl" + +# You may put your real host name here, but localhost is valid also +# and it has the advantage that it works on a non-newtworked machine +HOST="localhost" diff --git a/regress/scripts/bacula-dir.conf.regexwhere.in b/regress/scripts/bacula-dir.conf.regexwhere.in index 89aed77398..f522aaf8b3 100644 --- a/regress/scripts/bacula-dir.conf.regexwhere.in +++ b/regress/scripts/bacula-dir.conf.regexwhere.in @@ -38,7 +38,7 @@ JobDefs { Name = "DefaultRestore" Type = Restore Storage = File - Client=localhost-fd + Client=@hostname@-fd FileSet="FS_TESTJOB" Messages = Standard Pool = Default diff --git a/regress/scripts/do_sed b/regress/scripts/do_sed index ea614601b3..b502715ffa 100755 --- a/regress/scripts/do_sed +++ b/regress/scripts/do_sed @@ -1,44 +1,40 @@ #!/bin/sh # -if test $# != 6 ; then - echo "First arg must be email name" - echo " and the second must be a tape drive" - echo " and the third must be a tape control name or /dev/null" - echo " and the fourth must be the full path to the mtx program" - echo " and the fifth must be tape drive 1 or /dev/null" - echo " and the sixth must be the smtp or email host" - exit 1 -fi cwd=`pwd` +. ${cwd}/config mkdir -p ${cwd}/bin out="/tmp/sed_tmp" -HOST="localhost" # Create sed command script echo "s%@sbindir@%${cwd}/bin%g" >${out} echo "s%@scriptdir@%${cwd}/bin%g" >>${out} echo "s%@working_dir@%${cwd}/working%g" >>${out} echo "s%@piddir@%${cwd}/working%g" >>${out} echo "s%@subsysdir@%${cwd}/working%g" >>${out} -echo "s%@job_email@%${1}%g" >>${out} -echo "s%@tape_drive@%${2}%g" >>${out} -echo "s%@autochanger@%${3}%g" >>${out} +echo "s%@job_email@%${EMAIL}%g" >>${out} +echo "s%@tape_drive@%${TAPE_DRIVE}%g" >>${out} +echo "s%@autochanger@%${AUTOCHANGER}%g" >>${out} echo "s%@tmpdir@%${cwd}/tmp%g" >>${out} echo "s%@hostname@%${HOST}%g" >>${out} -echo "s%@changer_path@%${4}%g" >>${out} -echo "s%@tape_drive1@%${5}%g" >>${out} -echo "s%@smtp_host@%${6}%g" >>${out} +echo "s%@changer_path@%${AUTOCHANGER_PATH}%g" >>${out} +echo "s%@tape_drive1@%${TAPE_DRIVE1}%g" >>${out} +echo "s%@smtp_host@%${SMTP_HOST}%g" >>${out} echo "s%@disk_drive@%${cwd}/tmp/disk-changer%g" >>${out} - -echo "# " >config.out -echo "# Autochanger conf" >>config.out -echo "# " >>config.out -echo "AUTOCHANGER=\"${3}\"" >>config.out -echo "TAPE_DRIVE1=\"${5}\"" >>config.out - +echo "s%@hostname@%${hostname}%g" >>${out} +echo "s%@hostname1@%${hostname1}%g" >>${out} +echo "s%@hostname2@%${hostname2}%g" >>${out} +echo "s%@hostname3@%${hostname3}%g" >>${out} +echo "s%@hostname1_files@%${hostname1_files}%g" >>${out} +echo "s%@hostname_files@%${hostname_files}%g" >>${out} +echo "s%@hostname2_files@%${hostname2_files}%g" >>${out} +echo "s%@hostname3_files@%${hostname3_files}%g" >>${out} +echo "s%@hostname1_password@%${hostname1_password}%g" >>${out} +echo "s%@hostname2_password@%${hostname2_password}%g" >>${out} +echo "s%@hostname3_password@%${hostname3_password}%g" >>${out} # process .in files with sed script sed -f ${out} ${cwd}/scripts/bacula-dir.conf.errors.in >${cwd}/scripts/bacula-dir.conf.errors sed -f ${out} ${cwd}/scripts/test-bacula-dir.conf.in >${cwd}/scripts/test-bacula-dir.conf +sed -f ${out} ${cwd}/scripts/multi-client-bacula-dir.conf.in >${cwd}/scripts/multi-client-bacula-dir.conf sed -f ${out} ${cwd}/scripts/bacula-dir.conf.regexwhere.in >${cwd}/scripts/bacula-dir.conf.regexwhere sed -f ${out} ${cwd}/scripts/bacula-dir.conf.maxtime.in >${cwd}/scripts/bacula-dir.conf.maxtime sed -f ${out} ${cwd}/scripts/new-test-bacula-dir.conf.in >${cwd}/scripts/new-test-bacula-dir.conf @@ -79,7 +75,7 @@ sed s%/tmp%${cwd}/tmp%g /tmp/bac$$ >${cwd}/bin/bacula-sd.conf chmod 777 ${cwd}/scripts/cleanup-*tape ${cwd}/scripts/cleanup-*drive ${cwd}/scripts/prepare-two-tapes rm -f /tmp/bac$$ cp ${cwd}/bin/mtx-changer /tmp/bac$$ -sed "s%^MTX.*$%MTX=${4}%g" /tmp/bac$$ >${cwd}/bin/mtx-changer +sed "s%^MTX.*$%MTX=${AUTOCHANGER_PATH}%g" /tmp/bac$$ >${cwd}/bin/mtx-changer chmod 777 ${cwd}/bin/mtx-changer # get proper SD tape definitions diff --git a/regress/scripts/flist b/regress/scripts/flist index 87f103defe..d33e45a88b 100644 --- a/regress/scripts/flist +++ b/regress/scripts/flist @@ -10,7 +10,7 @@ /build/platforms/Makefile.in /build/platforms/redhat/Makefile.in /build/scripts/Makefile.in -/build/src/win32/filed/winservice.cpp +/build/src/win32/filed/service.cpp /build/src/filed/restore.c /build/autoconf/configure.in /build/examples/afs-bacula diff --git a/regress/scripts/functions b/regress/scripts/functions index 4791db9c7a..910b57fe04 100644 --- a/regress/scripts/functions +++ b/regress/scripts/functions @@ -177,6 +177,5 @@ else set_debug 0 fi -# Source the second drive variables -touch ${cwd}/config.out -. ${cwd}/config.out +# Source the configuration variables +. ${cwd}/config diff --git a/regress/scripts/multi-client-bacula-dir.conf.in b/regress/scripts/multi-client-bacula-dir.conf.in new file mode 100644 index 0000000000..fdd4f0a350 --- /dev/null +++ b/regress/scripts/multi-client-bacula-dir.conf.in @@ -0,0 +1,376 @@ +# +# Default Bacula Director Configuration file +# +# The only thing that MUST be changed is to add one or more +# file or directory names in the Include directive of the +# FileSet resource. +# +# For Bacula release 2.2.2 +# +# You might also want to change the default email address +# from root to your address. See the "mail" and "operator" +# directives in the Messages resource. +# + +Director { # define myself + Name = @hostname@-dir + DIRport = 8101 # where we listen for UA connections + QueryFile = "@scriptdir@/query.sql" + WorkingDirectory = "@working_dir@" + PidDirectory = "@piddir@" + SubSysDirectory = "@subsysdir@" + Maximum Concurrent Jobs = 10 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" # Console password + Messages = Daemon +} + +# +# Define the main nightly save backup job +# By default, this job will back up to disk in /tmp +Job { + Name = "NightlySave" + Type = Backup + Client=@hostname@-fd + FileSet="Full Set" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 10 +} + +Job { + Name = @hostname1@ + Type = Backup + Client = @hostname1@-fd + FileSet = "@hostname1@-FileSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 10 +} + +Job { + Name = @hostname2@ + Type = Backup + Client = @hostname2@-fd + FileSet = "@hostname2@-FileSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 10 +} + +Job { + Name = @hostname3@ + Type = Backup + Client = @hostname3@-fd + FileSet = "@hostname3@-FileSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Maximum Concurrent Jobs = 10 +} + + + +Job { + Name = "MonsterSave" + Type = Backup + Client=@hostname@-fd + FileSet="Full Set" + Storage = File1 + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + + +Job { + Name = "VerifyVolume" + Type = Verify + Level = VolumeToCatalog + Client=@hostname@-fd + FileSet="Full Set" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + + +Job { + Name = "SparseTest" + Type = Backup + Client=@hostname@-fd + FileSet="SparseSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + +Job { + Name = "CompressedTest" + Type = Backup + Client=@hostname@-fd + FileSet="CompressedSet" + Storage = File + Messages = Standard + Pool = Default + Maximum Concurrent Jobs = 10 + Write Bootstrap = "@working_dir@/NightlySave.bsr" +# Max Run Time = 15 seconds +} + +Job { + Name = "SparseCompressedTest" + Type = Backup + Client=@hostname@-fd + FileSet="SparseCompressedSet" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + + +# Backup the catalog database (after the nightly save) +Job { + Name = "BackupCatalog" + Type = Backup + Client=@hostname@-fd + FileSet="Catalog" +# Schedule = "WeeklyCycleAfterBackup" + Storage = File + Messages = Standard + Pool = Default + # This creates an ASCII copy of the catalog + RunBeforeJob = "@sbindir@/make_catalog_backup -u regress" + # This deletes the copy of the catalog + RunAfterJob = "@sbindir@/delete_catalog_backup" + Write Bootstrap = "@working_dir@/BackupCatalog.bsr" +} + +# Standard Restore template, to be changed by Console program +Job { + Name = "RestoreFiles" + Type = Restore + Client=@hostname@-fd + FileSet="Full Set" + Storage = File + Messages = Standard + Pool = Default + Where = /tmp/bacula-restores +} + + +# List of files to be backed up +FileSet { + Name = "Full Set" + Include { Options { signature=MD5 } + File = @hostname_files@ + } +} + +FileSet { + Name = "@hostname1@-FileSet" + Include { Options { signature=MD5 } + File = @hostname1_files@ + } +} + +FileSet { + Name = "@hostname2@-FileSet" + Include { Options { signature=MD5 } + File = @hostname2_files@ + } +} + +FileSet { + Name = "@hostname3@-FileSet" + Include { Options { signature=MD5 } + File = @hostname3_files@ + } +} + +FileSet { + Name = "SparseSet" + Include { Options { signature=MD5; sparse=yes } + File=tmp/bconcmds @output /dev/null messages @$out tmp/log1.out +setdebug level=3 dir +setdebug level=3 storage=DDS-4 +setdebug level=3 client label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0 label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1 status storage=DDS-4 diff --git a/regress/tests/incremental-2tape b/regress/tests/incremental-2tape index 5d94967d04..35b2621c7a 100755 --- a/regress/tests/incremental-2tape +++ b/regress/tests/incremental-2tape @@ -5,6 +5,7 @@ # # This script uses the autochanger and two tapes # +. scripts/functions if test x${AUTOCHANGER} = x/dev/null ; then echo "incremental-2tape test skipped. No autochanger." exit diff --git a/regress/tests/lib-tape-root b/regress/tests/lib-tape-root index 06289cd1d4..c0cec63d76 100755 --- a/regress/tests/lib-tape-root +++ b/regress/tests/lib-tape-root @@ -4,6 +4,7 @@ # then restore it. # cwd=`pwd` +. scripts/functions bin/bacula stop 2>&1 >/dev/null cd bin ./drop_bacula_tables >/dev/null 2>&1 diff --git a/regress/tests/multi-client-test b/regress/tests/multi-client-test new file mode 100755 index 0000000000..c2dc95bd26 --- /dev/null +++ b/regress/tests/multi-client-test @@ -0,0 +1,79 @@ +#!/bin/sh +# +# Run four jobs at the same time, with two Volumes. +# Set max Vol bytes of first volume +# to less than total backup to force Bacula to use the second +# Volume. +# +TestName="multi-client-test" +JobName=Multi-client +. scripts/functions + +scripts/cleanup +scripts/copy-test-confs +/bin/cp -f scripts/multi-client-bacula-dir.conf bin/bacula-dir.conf + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +@# Make sure we can contact all clients +@#setdebug level=100 dir +status client=${HOST}-fd +status client=${hostname1}-fd +status client=${hostname2}-fd +status client=${hostname3}-fd +setdebug level=1 dir +label storage=File1 +TestVolume001 +label storage=File1 +TestVolume002 +update Volume=TestVolume001 MaxVolBytes=900000000 +status storage=File1 +@#llist volume=TestVolume001 +@#llist volume=TestVolume002 +run job=${hostname1} level=Full Storage=File1 yes +run job=${hostname2} level=Full Storage=File1 yes +@# run job=${hostname3} level=Full Storage=File1 yes +status storage=File1 +run job=$JobName level=Full Storage=File1 yes +@sleep 2 +status dir +status storage=File1 +@sleep 5 +messages +wait +status storage=File1 +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores client=${hostname}-fd select storage=File1 +unmark * +mark * +done +yes +wait +messages +@output +status dir +status storage=File1 +quit +END_OF_DATA + +run_bacula +stop_bacula + +check_two_logs +#if test "$debug" -eq 1 ; then +# diff -r ${hostname_files} ${cwd}/tmp/bacula-restores/${hostname_files} +#else +# diff -r ${hostname_files} ${cwd}/tmp/bacula-restores/${hostname_files} 2>&1 >/dev/null +#fi +#dstat=$? +dstat=0 +end_test diff --git a/regress/tests/usr-tape-root b/regress/tests/usr-tape-root index 0f5002d928..64d9040c35 100755 --- a/regress/tests/usr-tape-root +++ b/regress/tests/usr-tape-root @@ -4,6 +4,7 @@ # then restore it. # cwd=`pwd` +. scripts/functions scripts/copy-tape-confs scripts/cleanup-tape echo "/usr" >/tmp/file-list