From: Kern Sibbald Date: Mon, 24 Mar 2008 21:17:09 +0000 (+0000) Subject: Fail tests requiring tape drive if none present X-Git-Tag: Release-3.0.0~1640 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=08777c18b882f6f451603b453ee32215748f6cff;p=bacula%2Fbacula Fail tests requiring tape drive if none present git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6674 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/DartTestfile.txt.in b/regress/DartTestfile.txt.in index 05b0d50a3d..a5bdb1731d 100644 --- a/regress/DartTestfile.txt.in +++ b/regress/DartTestfile.txt.in @@ -43,7 +43,7 @@ ADD_TEST(all-non-root:2drive-concurrent-test "@regressdir@/tests/2drive-concurre ADD_TEST(all-non-root:2drive-incremental-2disk "@regressdir@/tests/2drive-incremental-2disk") ADD_TEST(all-non-root-2tape:incremental-2tape "@regressdir@/tests/incremental-2tape") ADD_TEST(all-non-root-2tape:two-volume-tape "@regressdir@/tests/two-volume-tape") -ADD_TEST(all-non-root-tape:2drive-incremental-2t2da-tape "@regressdir@/tests/2drive-incremental-2t2da-tape") +ADD_TEST(all-non-root-2drive-tape:2drive-incremental-2t2da-tape "@regressdir@/tests/2drive-incremental-2t2da-tape") ADD_TEST(all-non-root-tape:ansi-label-1t1d-tape "@regressdir@/tests/ansi-label-1t1d-tape") ADD_TEST(all-non-root-tape:backup-bacula-1t1d-tape "@regressdir@/tests/backup-bacula-1t1d-tape") ADD_TEST(all-non-root-tape:bscan-1t1d-tape "@regressdir@/tests/bscan-1t1d-tape") diff --git a/regress/prototype.conf b/regress/prototype.conf index c5381a28d1..b0ba660fcd 100644 --- a/regress/prototype.conf +++ b/regress/prototype.conf @@ -9,9 +9,12 @@ SMTP_HOST="localhost" SQLITE3_DIR=${HOME}/bacula/depkgs/sqlite3 SQLITE_DIR=${HOME}/bacula/depkgs/sqlite +# set to /dev/null if you do not have a tape drive TAPE_DRIVE="/dev/nst0" + # if you don't have an autochanger set AUTOCHANGER to /dev/null AUTOCHANGER="/dev/sg0" + # For two drive tests -- set to /dev/null if you do not have it TAPE_DRIVE1="/dev/null" @@ -56,4 +59,3 @@ BASEPORT=8101 # test machines, add some indication of the machine. # SITE_NAME=-bacula-${HOST} - diff --git a/regress/scripts/cleanup-tape.in b/regress/scripts/cleanup-tape.in index 98ed537766..1fbefe6d49 100755 --- a/regress/scripts/cleanup-tape.in +++ b/regress/scripts/cleanup-tape.in @@ -4,5 +4,9 @@ # scripts/cleanup +a=`bin/mtx-changer @autochanger@ loaded 0 @tape_drive@ 0` +if test $a = 0 ; then + bin/mtx-changer @autochanger@ load 1 @tape_drive@ 0 +fi mt -f @tape_drive@ rewind mt -f @tape_drive@ weof diff --git a/regress/scripts/functions b/regress/scripts/functions index 78fbffda28..6518f0f034 100644 --- a/regress/scripts/functions +++ b/regress/scripts/functions @@ -25,13 +25,37 @@ if [ $MUID != 0 ] ; then fi } +require_tape_drive() +{ +if test x${TAPE_DRIVE} = x/dev/null ; then + echo "$TestName test needs a tape drive, but has none." + exit 1 +fi +} + +require_second_drive() +{ +if test x${TAPE_DRIVE1} = x/dev/null ; then + echo "$JobName needs second drive, but has none." + exit 1 +fi +} + +require_autochanger() +{ +if test x${AUTOCHANGER} = x/dev/null ; then + echo "$TestName needs an autochanger, but has none." + exit 1 +fi +} + + skip_if_no_autochanger() { if test x${AUTOCHANGER} = x/dev/null ; then echo "$TestName test skipped. No autochanger." exit fi - } set_debug() diff --git a/regress/tests/2drive-incremental-2t2d-tape b/regress/tests/2drive-incremental-2t2d-tape index 613d4a2ba3..f9ec1e669c 100755 --- a/regress/tests/2drive-incremental-2t2d-tape +++ b/regress/tests/2drive-incremental-2t2d-tape @@ -3,16 +3,15 @@ # Run a simple backup of the Bacula build directory then create some # new files, do an Incremental and restore those two files. # -# This script uses the autochanger and two tapes +# This script uses the autochanger and two drives # TestName="2drive-incremental-2t2da-tape" JobName="2drive2tape" . scripts/functions -if test x${TAPE_DRIVE1} = x/dev/null ; then - echo "Skipping 2drive-incremental-2tape test. No second drive." - exit -fi +require_tape_drive +require_autochanger +require_second_drive scripts/copy-2drive-confs diff --git a/regress/tests/2drive-incremental-2t2da-tape b/regress/tests/2drive-incremental-2t2da-tape index 613d4a2ba3..fd09b9b21f 100755 --- a/regress/tests/2drive-incremental-2t2da-tape +++ b/regress/tests/2drive-incremental-2t2da-tape @@ -3,17 +3,15 @@ # Run a simple backup of the Bacula build directory then create some # new files, do an Incremental and restore those two files. # -# This script uses the autochanger and two tapes +# This script uses the autochanger and two drives # TestName="2drive-incremental-2t2da-tape" JobName="2drive2tape" . scripts/functions -if test x${TAPE_DRIVE1} = x/dev/null ; then - echo "Skipping 2drive-incremental-2tape test. No second drive." - exit -fi - +require_tape_drive +require_autochanger +require_second_drive scripts/copy-2drive-confs scripts/cleanup-2drive diff --git a/regress/tests/ansi-label-1t1d-tape b/regress/tests/ansi-label-1t1d-tape index d574b058ae..141316a6bc 100755 --- a/regress/tests/ansi-label-1t1d-tape +++ b/regress/tests/ansi-label-1t1d-tape @@ -12,6 +12,8 @@ TestName="ansi-label-1t1d-tape" JobName=backuptape . scripts/functions +require_tape_drive + scripts/copy-tape-confs /bin/cp -f scripts/ansi-sd-tape.conf bin/bacula-sd.conf scripts/cleanup-tape diff --git a/regress/tests/backup-bacula-1t1d-tape b/regress/tests/backup-bacula-1t1d-tape index dd67072039..4a80a8f201 100755 --- a/regress/tests/backup-bacula-1t1d-tape +++ b/regress/tests/backup-bacula-1t1d-tape @@ -10,6 +10,8 @@ TestName="backup-bacula-1t1d-tape" JobName=backuptape . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/backup-win32-tape b/regress/tests/backup-win32-tape index 2c67ddce85..36c556caa8 100755 --- a/regress/tests/backup-win32-tape +++ b/regress/tests/backup-win32-tape @@ -8,6 +8,8 @@ TestName="backup-win32-tape" JobName=backupwintape . scripts/functions +require_tape_drive_drive + scripts/cleanup-tape scripts/copy-win32-confs diff --git a/regress/tests/bscan-1t1d-tape b/regress/tests/bscan-1t1d-tape index 8c09fadf4d..e6a070d8bf 100755 --- a/regress/tests/bscan-1t1d-tape +++ b/regress/tests/bscan-1t1d-tape @@ -9,6 +9,8 @@ TestName="bscan-1t1d-tape" JobName=bscantape . scripts/functions +require_tape_drive + copy_tape_confs echo "${cwd}/build" >tmp/file-list diff --git a/regress/tests/bscan-fast-tape b/regress/tests/bscan-fast-tape index 7e2b38e329..110c007f7d 100755 --- a/regress/tests/bscan-fast-tape +++ b/regress/tests/bscan-fast-tape @@ -9,6 +9,8 @@ TestName="bscan-tape" JobName=bscantape . scripts/functions +require_tape_drive + copy_tape_confs echo "${cwd}/build" >${cwd}/tmp/file-list diff --git a/regress/tests/btape-fill-full-tape b/regress/tests/btape-fill-full-tape index 7c32d04cda..dc3fcec98c 100755 --- a/regress/tests/btape-fill-full-tape +++ b/regress/tests/btape-fill-full-tape @@ -6,6 +6,8 @@ TestName="btape-fill-full-tape" JobName=AutoLabel . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/eighty-simultaneous-jobs-tape b/regress/tests/eighty-simultaneous-jobs-tape index 3fe631fceb..4b79c09143 100755 --- a/regress/tests/eighty-simultaneous-jobs-tape +++ b/regress/tests/eighty-simultaneous-jobs-tape @@ -6,6 +6,8 @@ TestName="eighty-simultaneous-jobs-tape" JobName=EightySimultaneousJobs . scripts/functions +require_tape_drive + scripts/cleanup-tape scripts/copy-tape-confs diff --git a/regress/tests/eot-fail-tape b/regress/tests/eot-fail-tape index 33bf4035b1..44c36d07b9 100755 --- a/regress/tests/eot-fail-tape +++ b/regress/tests/eot-fail-tape @@ -7,6 +7,8 @@ TestName="eot-fail-tape" JobName=eotfailtape . scripts/functions +require_tape_drive + scripts/cleanup-tape scripts/copy-tape-confs diff --git a/regress/tests/fixed-block-size-1t1d-tape b/regress/tests/fixed-block-size-1t1d-tape index 0e6ea48f72..e34c3f5305 100755 --- a/regress/tests/fixed-block-size-1t1d-tape +++ b/regress/tests/fixed-block-size-1t1d-tape @@ -8,6 +8,8 @@ TestName="fixed-block-size-1t1d-tape" JobName=fixedblocksize . scripts/functions +require_tape_drive + copy_tape_confs echo "${cwd}/build" >${cwd}/tmp/file-list diff --git a/regress/tests/four-concurrent-jobs-1t1d-tape b/regress/tests/four-concurrent-jobs-1t1d-tape index 738d8178ae..b4fcc2a8e1 100755 --- a/regress/tests/four-concurrent-jobs-1t1d-tape +++ b/regress/tests/four-concurrent-jobs-1t1d-tape @@ -6,6 +6,8 @@ TestName="four-concurrent-jobs-1t1d-tape" JobName=FourConcurrentJobs . scripts/functions +require_tape_drive + scripts/cleanup-tape scripts/copy-tape-confs diff --git a/regress/tests/four-jobs-1t1d-tape b/regress/tests/four-jobs-1t1d-tape index 2a912e2f9f..3a850186a1 100755 --- a/regress/tests/four-jobs-1t1d-tape +++ b/regress/tests/four-jobs-1t1d-tape @@ -8,6 +8,8 @@ TestName="four-jobs-1t1d-tape" JobName=fourjobstape . scripts/functions +require_tape_drive + scripts/cleanup-tape scripts/copy-tape-confs echo "${cwd}/build" >${cwd}/tmp/file-list diff --git a/regress/tests/incremental-1t1d-tape b/regress/tests/incremental-1t1d-tape index 75dc046a9d..2e83c7a45d 100755 --- a/regress/tests/incremental-1t1d-tape +++ b/regress/tests/incremental-1t1d-tape @@ -7,6 +7,8 @@ TestName="incremental-1t1d-tape" JobName=IncTape . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/incremental-2media-tape b/regress/tests/incremental-2media-tape index 65014880f8..62ecc5e340 100755 --- a/regress/tests/incremental-2media-tape +++ b/regress/tests/incremental-2media-tape @@ -10,6 +10,8 @@ TestName="incremental-2media-tape" JobName=Inc2mediaTape . scripts/functions +require_tape_drive +require_second_drive scripts/cleanup # Get conf files diff --git a/regress/tests/memory-bug-tape b/regress/tests/memory-bug-tape index 6ae57fed6e..15f5c89158 100755 --- a/regress/tests/memory-bug-tape +++ b/regress/tests/memory-bug-tape @@ -9,6 +9,8 @@ TestName="four-concurrent-jobs-tape" JobName=FourConcurrentJobs . scripts/functions +require_tape_drive + scripts/cleanup-tape scripts/copy-tape-confs diff --git a/regress/tests/relabel-1t1d-tape b/regress/tests/relabel-1t1d-tape index a4bca3f26a..d929db3358 100755 --- a/regress/tests/relabel-1t1d-tape +++ b/regress/tests/relabel-1t1d-tape @@ -8,6 +8,8 @@ TestName="relabel-1t1d-tape" JobName=Relabeltape . scripts/functions +require_tape_drive + scripts/cleanup-tape scripts/copy-tape-confs diff --git a/regress/tests/restore-by-file-1t1d-tape b/regress/tests/restore-by-file-1t1d-tape index 7dea206fe0..e88f5d87c8 100755 --- a/regress/tests/restore-by-file-1t1d-tape +++ b/regress/tests/restore-by-file-1t1d-tape @@ -9,6 +9,9 @@ TestName="restore-by-file-1t1d-tape" JobName=restorebyfile . scripts/functions + +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/restore-seek-tape b/regress/tests/restore-seek-tape index 7d5b17b0d2..041c278deb 100755 --- a/regress/tests/restore-seek-tape +++ b/regress/tests/restore-seek-tape @@ -10,6 +10,8 @@ TestName="restore-seek-tape" JobName=restore-tape-seek . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/small-file-size-1t1d-tape b/regress/tests/small-file-size-1t1d-tape index 658832339a..a677de6541 100755 --- a/regress/tests/small-file-size-1t1d-tape +++ b/regress/tests/small-file-size-1t1d-tape @@ -7,6 +7,8 @@ TestName="small-file-size-1t1d-tape" JobName=smallfilesize . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/truncate-bug-1t1d-tape b/regress/tests/truncate-bug-1t1d-tape index ac28b281e1..97a58fa96d 100755 --- a/regress/tests/truncate-bug-1t1d-tape +++ b/regress/tests/truncate-bug-1t1d-tape @@ -6,6 +6,8 @@ TestName="truncate-bug-1t1d-tape" JobName=truncatebug . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/two-pool-2t1da-tape b/regress/tests/two-pool-2t1da-tape index b90634f0b7..6559790c2b 100755 --- a/regress/tests/two-pool-2t1da-tape +++ b/regress/tests/two-pool-2t1da-tape @@ -11,7 +11,8 @@ TestName="two-pool-2t1da-tape" JobName=twopooltape . scripts/functions -skip_if_no_autochanger +require_tape_drive +require_autochanger scripts/cleanup scripts/copy-2tape-confs diff --git a/regress/tests/two-volume-tape b/regress/tests/two-volume-tape index e20af2510c..2cb84214d7 100755 --- a/regress/tests/two-volume-tape +++ b/regress/tests/two-volume-tape @@ -9,10 +9,8 @@ TestName="two-volume-tape" JobName=twovoltape . scripts/functions -if test x${AUTOCHANGER} = x/dev/null ; then - echo "${TestName} test skipped. No autochanger." - exit -fi +require_tape_drive +require_autochanger scripts/cleanup scripts/copy-2tape-confs diff --git a/regress/tests/verify-vol-1t1d-tape b/regress/tests/verify-vol-1t1d-tape index 1670ed1879..40065ad2ec 100755 --- a/regress/tests/verify-vol-1t1d-tape +++ b/regress/tests/verify-vol-1t1d-tape @@ -7,6 +7,8 @@ TestName="verify-vol-1t1d-tape" JobName=VerifyVol . scripts/functions +require_tape_drive + scripts/copy-tape-confs scripts/cleanup-tape diff --git a/regress/tests/vol-duration-2t1da-tape b/regress/tests/vol-duration-2t1da-tape index fb2d1cd456..a143846976 100755 --- a/regress/tests/vol-duration-2t1da-tape +++ b/regress/tests/vol-duration-2t1da-tape @@ -13,7 +13,8 @@ TestName="vol-duration-2t1da-tape" JobName=VolDuration . scripts/functions -skip_if_no_autochanger +require_tape_drive +require_autochanger scripts/cleanup scripts/copy-2tape-confs diff --git a/regress/tests/win32-backup-tape b/regress/tests/win32-backup-tape index 299fdd4873..4afd093536 100755 --- a/regress/tests/win32-backup-tape +++ b/regress/tests/win32-backup-tape @@ -8,6 +8,8 @@ TestName="win32-backup-tape" JobName=win32tape . scripts/functions +require_tape_drive + scripts/copy-win32-confs scripts/cleanup-tape diff --git a/regress/tests/win32-to-linux-tape b/regress/tests/win32-to-linux-tape index 05abd85716..366a88e1d6 100755 --- a/regress/tests/win32-to-linux-tape +++ b/regress/tests/win32-to-linux-tape @@ -8,6 +8,8 @@ TestName="win32-to-linux-tape" JobName=AutoLabel . scripts/functions +require_tape_drive + scripts/copy-win32-confs scripts/cleanup-tape