From 92fd3aa38ec7efe33483ad06c9b3e19b534dc874 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Fri, 1 Dec 2006 11:54:09 +0000 Subject: [PATCH] Add Windows port of the regression tests. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3722 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/win32/all-non-root-2tape-tests.cmd | 11 + regress/win32/all-non-root-tape-tests.cmd | 26 ++ regress/win32/all-non-root-tests.cmd | 47 +++ regress/win32/all-root-tests.cmd | 10 + regress/win32/all-tape-and-file-tests.cmd | 5 + regress/win32/all-tests.cmd | 7 + regress/win32/config.cmd | 10 + regress/win32/make.cmd | 111 +++++++ regress/win32/prototype.conf | 31 ++ .../scripts/bacula-dir-migration.conf.in | 229 +++++++++++++ regress/win32/scripts/bacula-dir-tape.conf.in | 226 +++++++++++++ .../scripts/bacula-dir-win32-tape.conf.in | 144 ++++++++ .../scripts/bacula-dir.conf.testrunscript.in | 159 +++++++++ .../scripts/bacula-sd-2disk-drive.conf.in | 75 +++++ regress/win32/scripts/bacula-sd-2disk.conf.in | 62 ++++ .../win32/scripts/bacula-sd-2drive.conf.in | 75 +++++ regress/win32/scripts/bacula-sd-2tape.conf.in | 61 ++++ .../win32/scripts/bacula-sd-migration.conf.in | 72 ++++ regress/win32/scripts/bacula-sd-tape.conf.in | 54 +++ regress/win32/scripts/bacula-sd.conf.in | 74 +++++ regress/win32/scripts/bacula.cmd | 18 + .../win32/scripts/check_for_zombie_jobs.bscr | 8 + .../win32/scripts/check_for_zombie_jobs.cmd | 41 +++ regress/win32/scripts/cleanup-2drive.cmd.in | 43 +++ regress/win32/scripts/cleanup-2tape.cmd.in | 29 ++ regress/win32/scripts/cleanup-tape.cmd.in | 7 + regress/win32/scripts/cleanup.cmd | 23 ++ regress/win32/scripts/copy-2disk-confs.cmd | 9 + .../win32/scripts/copy-2disk-drive-confs.cmd | 6 + regress/win32/scripts/copy-2drive-confs.cmd | 10 + regress/win32/scripts/copy-2tape-confs.cmd | 10 + regress/win32/scripts/copy-confs.cmd | 7 + regress/win32/scripts/copy-crypto-confs.cmd | 5 + .../win32/scripts/copy-migration-confs.cmd | 7 + regress/win32/scripts/copy-tape-confs.cmd | 7 + regress/win32/scripts/copy-test-confs.cmd | 7 + regress/win32/scripts/copy-testa-confs.cmd | 7 + regress/win32/scripts/copy-win32-confs.cmd | 7 + .../win32/scripts/crypto-bacula-fd.conf.in | 36 ++ regress/win32/scripts/cryptokeypair.pem | 53 +++ regress/win32/scripts/disk-changer.cmd | 201 +++++++++++ regress/win32/scripts/do_sed.cmd | 73 ++++ regress/win32/scripts/exclude-dev-test | 5 + regress/win32/scripts/exclude-etc-test | 1 + regress/win32/scripts/exclude-lib-test | 5 + regress/win32/scripts/flist | 23 ++ regress/win32/scripts/functions.cmd | 131 ++++++++ regress/win32/scripts/install_bacula.cmd | 76 +++++ .../win32/scripts/new-test-bacula-dir.conf.in | 311 +++++++++++++++++ regress/win32/scripts/prepare-two-disks.cmd | 5 + .../win32/scripts/prepare-two-tapes.cmd.in | 13 + regress/win32/scripts/setup.cmd | 55 +++ regress/win32/scripts/test-bacula-dir.conf.in | 312 ++++++++++++++++++ regress/win32/scripts/test-bacula-fd.conf.in | 33 ++ regress/win32/scripts/test-bacula-sd.conf.in | 107 ++++++ regress/win32/scripts/test-console.conf.in | 10 + .../win32/scripts/testa-bacula-dir.conf.in | 147 +++++++++ .../scripts/win32-bacula-dir-tape.conf.in | 159 +++++++++ regress/win32/scripts/win32_tape_options | 1 + .../tests/2drive-incremental-2disk.1.bscr | 20 ++ .../tests/2drive-incremental-2disk.2.bscr | 25 ++ .../win32/tests/2drive-incremental-2disk.cmd | 57 ++++ regress/win32/tests/2drive-incremental-2tape | 112 +++++++ regress/win32/tests/auto-label-test.bscr | 35 ++ regress/win32/tests/auto-label-test.cmd | 27 ++ regress/win32/tests/backup-bacula-tape | 117 +++++++ regress/win32/tests/backup-bacula-test.bscr | 36 ++ regress/win32/tests/backup-bacula-test.cmd | 24 ++ regress/win32/tests/backup-win32-tape | 49 +++ regress/win32/tests/bextract-test.bscr | 19 ++ regress/win32/tests/bextract-test.cmd | 29 ++ regress/win32/tests/bscan-fast-tape | 89 +++++ regress/win32/tests/bscan-tape | 142 ++++++++ regress/win32/tests/bscan-test.1.bscr | 24 ++ regress/win32/tests/bscan-test.2.bscr | 13 + regress/win32/tests/bscan-test.cmd | 42 +++ regress/win32/tests/bsr-opt-test.bscr | 24 ++ regress/win32/tests/bsr-opt-test.cmd | 57 ++++ regress/win32/tests/btape-fill-full-tape | 35 ++ regress/win32/tests/btape-fill-tape | 38 +++ regress/win32/tests/compressed-test.bscr | 23 ++ regress/win32/tests/compressed-test.cmd | 24 ++ regress/win32/tests/concurrent-jobs-test.bscr | 23 ++ regress/win32/tests/concurrent-jobs-test.cmd | 35 ++ regress/win32/tests/dev-test-root | 85 +++++ regress/win32/tests/differential-test.1.bscr | 9 + regress/win32/tests/differential-test.2.bscr | 9 + regress/win32/tests/differential-test.3.bscr | 16 + regress/win32/tests/differential-test.cmd | 48 +++ regress/win32/tests/eot-fail-tape | 51 +++ regress/win32/tests/etc-test-root | 70 ++++ regress/win32/tests/filed-crypto-test | 49 +++ regress/win32/tests/fixed-block-size-tape | 62 ++++ regress/win32/tests/four-concurrent-jobs-tape | 56 ++++ .../tests/four-concurrent-jobs-test.bscr | 50 +++ .../win32/tests/four-concurrent-jobs-test.cmd | 23 ++ regress/win32/tests/four-jobs-tape | 153 +++++++++ regress/win32/tests/four-jobs-test.1.bscr | 11 + regress/win32/tests/four-jobs-test.2.bscr | 8 + regress/win32/tests/four-jobs-test.3.bscr | 8 + regress/win32/tests/four-jobs-test.4.bscr | 8 + regress/win32/tests/four-jobs-test.5.bscr | 17 + regress/win32/tests/four-jobs-test.cmd | 74 +++++ regress/win32/tests/hardlink-test | 66 ++++ regress/win32/tests/incremental-2disk.1.bscr | 9 + regress/win32/tests/incremental-2disk.2.bscr | 21 ++ regress/win32/tests/incremental-2disk.cmd | 55 +++ regress/win32/tests/incremental-2tape.1.bscr | 9 + regress/win32/tests/incremental-2tape.2.bscr | 21 ++ regress/win32/tests/incremental-2tape.cmd | 48 +++ regress/win32/tests/incremental-tape | 76 +++++ regress/win32/tests/incremental-test.1.bscr | 9 + regress/win32/tests/incremental-test.2.bscr | 9 + regress/win32/tests/incremental-test.3.bscr | 7 + regress/win32/tests/incremental-test.4.bscr | 7 + regress/win32/tests/incremental-test.5.bscr | 16 + regress/win32/tests/incremental-test.cmd | 91 +++++ regress/win32/tests/lib-tape-root | 67 ++++ regress/win32/tests/lib-test-root | 76 +++++ regress/win32/tests/migration-job-test | 70 ++++ regress/win32/tests/migration-jobspan-test | 80 +++++ regress/win32/tests/migration-occupancy-test | 71 ++++ regress/win32/tests/migration-time-test | 78 +++++ regress/win32/tests/migration-volume-test | 83 +++++ regress/win32/tests/query-test.1.bscr | 9 + regress/win32/tests/query-test.2.bscr | 9 + regress/win32/tests/query-test.3.bscr | 46 +++ regress/win32/tests/query-test.cmd | 48 +++ regress/win32/tests/recycle-test.bscr | 51 +++ regress/win32/tests/recycle-test.cmd | 26 ++ regress/win32/tests/relabel-tape | 94 ++++++ regress/win32/tests/restore-by-file-tape | 101 ++++++ regress/win32/tests/restore-by-file-test.bscr | 20 ++ regress/win32/tests/restore-by-file-test.cmd | 30 ++ .../win32/tests/restore-disk-seek-test.bscr | 23 ++ .../win32/tests/restore-disk-seek-test.cmd | 52 +++ .../win32/tests/restore2-by-file-test.bscr | 17 + regress/win32/tests/restore2-by-file-test.cmd | 31 ++ regress/win32/tests/runscript-test | 90 +++++ regress/win32/tests/scratch-pool-test.bscr | 25 ++ regress/win32/tests/scratch-pool-test.cmd | 45 +++ regress/win32/tests/six-vol-test.bscr | 19 ++ regress/win32/tests/six-vol-test.cmd | 36 ++ regress/win32/tests/small-file-size-tape | 50 +++ regress/win32/tests/span-vol-test.bscr | 27 ++ regress/win32/tests/span-vol-test.cmd | 26 ++ .../win32/tests/sparse-compressed-test.bscr | 17 + .../win32/tests/sparse-compressed-test.cmd | 23 ++ regress/win32/tests/sparse-test.bscr | 20 ++ regress/win32/tests/sparse-test.cmd | 23 ++ regress/win32/tests/test0.cmd | 2 + regress/win32/tests/truncate-bug-tape | 87 +++++ regress/win32/tests/two-jobs-test.1.bscr | 14 + regress/win32/tests/two-jobs-test.2.bscr | 27 ++ regress/win32/tests/two-jobs-test.cmd | 35 ++ regress/win32/tests/two-pool-tape | 82 +++++ regress/win32/tests/two-pool-test.bscr | 36 ++ regress/win32/tests/two-pool-test.cmd | 37 +++ regress/win32/tests/two-vol-test.bscr | 19 ++ regress/win32/tests/two-vol-test.cmd | 24 ++ regress/win32/tests/two-volume-tape.1.bscr | 11 + regress/win32/tests/two-volume-tape.2.bscr | 12 + regress/win32/tests/two-volume-tape.cmd | 48 +++ regress/win32/tests/two-volume-test.bscr | 21 ++ regress/win32/tests/two-volume-test.cmd | 35 ++ regress/win32/tests/usr-tape-root | 62 ++++ regress/win32/tests/verify-vol-tape | 50 +++ regress/win32/tests/verify-vol-test.bscr | 18 + regress/win32/tests/verify-vol-test.cmd | 29 ++ regress/win32/tests/weird-files-test | 69 ++++ regress/win32/tests/weird-files2-test | 80 +++++ regress/win32/tests/win32-backup-tape | 49 +++ regress/win32/tests/win32-to-linux-tape | 49 +++ 173 files changed, 8246 insertions(+) create mode 100644 regress/win32/all-non-root-2tape-tests.cmd create mode 100644 regress/win32/all-non-root-tape-tests.cmd create mode 100644 regress/win32/all-non-root-tests.cmd create mode 100644 regress/win32/all-root-tests.cmd create mode 100644 regress/win32/all-tape-and-file-tests.cmd create mode 100644 regress/win32/all-tests.cmd create mode 100644 regress/win32/config.cmd create mode 100644 regress/win32/make.cmd create mode 100644 regress/win32/prototype.conf create mode 100644 regress/win32/scripts/bacula-dir-migration.conf.in create mode 100644 regress/win32/scripts/bacula-dir-tape.conf.in create mode 100644 regress/win32/scripts/bacula-dir-win32-tape.conf.in create mode 100644 regress/win32/scripts/bacula-dir.conf.testrunscript.in create mode 100644 regress/win32/scripts/bacula-sd-2disk-drive.conf.in create mode 100644 regress/win32/scripts/bacula-sd-2disk.conf.in create mode 100644 regress/win32/scripts/bacula-sd-2drive.conf.in create mode 100644 regress/win32/scripts/bacula-sd-2tape.conf.in create mode 100644 regress/win32/scripts/bacula-sd-migration.conf.in create mode 100644 regress/win32/scripts/bacula-sd-tape.conf.in create mode 100644 regress/win32/scripts/bacula-sd.conf.in create mode 100644 regress/win32/scripts/bacula.cmd create mode 100644 regress/win32/scripts/check_for_zombie_jobs.bscr create mode 100644 regress/win32/scripts/check_for_zombie_jobs.cmd create mode 100644 regress/win32/scripts/cleanup-2drive.cmd.in create mode 100644 regress/win32/scripts/cleanup-2tape.cmd.in create mode 100644 regress/win32/scripts/cleanup-tape.cmd.in create mode 100644 regress/win32/scripts/cleanup.cmd create mode 100644 regress/win32/scripts/copy-2disk-confs.cmd create mode 100644 regress/win32/scripts/copy-2disk-drive-confs.cmd create mode 100644 regress/win32/scripts/copy-2drive-confs.cmd create mode 100644 regress/win32/scripts/copy-2tape-confs.cmd create mode 100644 regress/win32/scripts/copy-confs.cmd create mode 100644 regress/win32/scripts/copy-crypto-confs.cmd create mode 100644 regress/win32/scripts/copy-migration-confs.cmd create mode 100644 regress/win32/scripts/copy-tape-confs.cmd create mode 100644 regress/win32/scripts/copy-test-confs.cmd create mode 100644 regress/win32/scripts/copy-testa-confs.cmd create mode 100644 regress/win32/scripts/copy-win32-confs.cmd create mode 100644 regress/win32/scripts/crypto-bacula-fd.conf.in create mode 100644 regress/win32/scripts/cryptokeypair.pem create mode 100644 regress/win32/scripts/disk-changer.cmd create mode 100644 regress/win32/scripts/do_sed.cmd create mode 100644 regress/win32/scripts/exclude-dev-test create mode 100644 regress/win32/scripts/exclude-etc-test create mode 100644 regress/win32/scripts/exclude-lib-test create mode 100644 regress/win32/scripts/flist create mode 100644 regress/win32/scripts/functions.cmd create mode 100644 regress/win32/scripts/install_bacula.cmd create mode 100644 regress/win32/scripts/new-test-bacula-dir.conf.in create mode 100644 regress/win32/scripts/prepare-two-disks.cmd create mode 100644 regress/win32/scripts/prepare-two-tapes.cmd.in create mode 100644 regress/win32/scripts/setup.cmd create mode 100644 regress/win32/scripts/test-bacula-dir.conf.in create mode 100644 regress/win32/scripts/test-bacula-fd.conf.in create mode 100644 regress/win32/scripts/test-bacula-sd.conf.in create mode 100644 regress/win32/scripts/test-console.conf.in create mode 100644 regress/win32/scripts/testa-bacula-dir.conf.in create mode 100644 regress/win32/scripts/win32-bacula-dir-tape.conf.in create mode 100644 regress/win32/scripts/win32_tape_options create mode 100644 regress/win32/tests/2drive-incremental-2disk.1.bscr create mode 100644 regress/win32/tests/2drive-incremental-2disk.2.bscr create mode 100644 regress/win32/tests/2drive-incremental-2disk.cmd create mode 100644 regress/win32/tests/2drive-incremental-2tape create mode 100644 regress/win32/tests/auto-label-test.bscr create mode 100644 regress/win32/tests/auto-label-test.cmd create mode 100644 regress/win32/tests/backup-bacula-tape create mode 100644 regress/win32/tests/backup-bacula-test.bscr create mode 100644 regress/win32/tests/backup-bacula-test.cmd create mode 100644 regress/win32/tests/backup-win32-tape create mode 100644 regress/win32/tests/bextract-test.bscr create mode 100644 regress/win32/tests/bextract-test.cmd create mode 100644 regress/win32/tests/bscan-fast-tape create mode 100644 regress/win32/tests/bscan-tape create mode 100644 regress/win32/tests/bscan-test.1.bscr create mode 100644 regress/win32/tests/bscan-test.2.bscr create mode 100644 regress/win32/tests/bscan-test.cmd create mode 100644 regress/win32/tests/bsr-opt-test.bscr create mode 100644 regress/win32/tests/bsr-opt-test.cmd create mode 100644 regress/win32/tests/btape-fill-full-tape create mode 100644 regress/win32/tests/btape-fill-tape create mode 100644 regress/win32/tests/compressed-test.bscr create mode 100644 regress/win32/tests/compressed-test.cmd create mode 100644 regress/win32/tests/concurrent-jobs-test.bscr create mode 100644 regress/win32/tests/concurrent-jobs-test.cmd create mode 100644 regress/win32/tests/dev-test-root create mode 100644 regress/win32/tests/differential-test.1.bscr create mode 100644 regress/win32/tests/differential-test.2.bscr create mode 100644 regress/win32/tests/differential-test.3.bscr create mode 100644 regress/win32/tests/differential-test.cmd create mode 100644 regress/win32/tests/eot-fail-tape create mode 100644 regress/win32/tests/etc-test-root create mode 100644 regress/win32/tests/filed-crypto-test create mode 100644 regress/win32/tests/fixed-block-size-tape create mode 100644 regress/win32/tests/four-concurrent-jobs-tape create mode 100644 regress/win32/tests/four-concurrent-jobs-test.bscr create mode 100644 regress/win32/tests/four-concurrent-jobs-test.cmd create mode 100644 regress/win32/tests/four-jobs-tape create mode 100644 regress/win32/tests/four-jobs-test.1.bscr create mode 100644 regress/win32/tests/four-jobs-test.2.bscr create mode 100644 regress/win32/tests/four-jobs-test.3.bscr create mode 100644 regress/win32/tests/four-jobs-test.4.bscr create mode 100644 regress/win32/tests/four-jobs-test.5.bscr create mode 100644 regress/win32/tests/four-jobs-test.cmd create mode 100644 regress/win32/tests/hardlink-test create mode 100644 regress/win32/tests/incremental-2disk.1.bscr create mode 100644 regress/win32/tests/incremental-2disk.2.bscr create mode 100644 regress/win32/tests/incremental-2disk.cmd create mode 100644 regress/win32/tests/incremental-2tape.1.bscr create mode 100644 regress/win32/tests/incremental-2tape.2.bscr create mode 100644 regress/win32/tests/incremental-2tape.cmd create mode 100644 regress/win32/tests/incremental-tape create mode 100644 regress/win32/tests/incremental-test.1.bscr create mode 100644 regress/win32/tests/incremental-test.2.bscr create mode 100644 regress/win32/tests/incremental-test.3.bscr create mode 100644 regress/win32/tests/incremental-test.4.bscr create mode 100644 regress/win32/tests/incremental-test.5.bscr create mode 100644 regress/win32/tests/incremental-test.cmd create mode 100644 regress/win32/tests/lib-tape-root create mode 100644 regress/win32/tests/lib-test-root create mode 100644 regress/win32/tests/migration-job-test create mode 100644 regress/win32/tests/migration-jobspan-test create mode 100644 regress/win32/tests/migration-occupancy-test create mode 100644 regress/win32/tests/migration-time-test create mode 100644 regress/win32/tests/migration-volume-test create mode 100644 regress/win32/tests/query-test.1.bscr create mode 100644 regress/win32/tests/query-test.2.bscr create mode 100644 regress/win32/tests/query-test.3.bscr create mode 100644 regress/win32/tests/query-test.cmd create mode 100644 regress/win32/tests/recycle-test.bscr create mode 100644 regress/win32/tests/recycle-test.cmd create mode 100644 regress/win32/tests/relabel-tape create mode 100644 regress/win32/tests/restore-by-file-tape create mode 100644 regress/win32/tests/restore-by-file-test.bscr create mode 100644 regress/win32/tests/restore-by-file-test.cmd create mode 100644 regress/win32/tests/restore-disk-seek-test.bscr create mode 100644 regress/win32/tests/restore-disk-seek-test.cmd create mode 100644 regress/win32/tests/restore2-by-file-test.bscr create mode 100644 regress/win32/tests/restore2-by-file-test.cmd create mode 100644 regress/win32/tests/runscript-test create mode 100644 regress/win32/tests/scratch-pool-test.bscr create mode 100644 regress/win32/tests/scratch-pool-test.cmd create mode 100644 regress/win32/tests/six-vol-test.bscr create mode 100644 regress/win32/tests/six-vol-test.cmd create mode 100644 regress/win32/tests/small-file-size-tape create mode 100644 regress/win32/tests/span-vol-test.bscr create mode 100644 regress/win32/tests/span-vol-test.cmd create mode 100644 regress/win32/tests/sparse-compressed-test.bscr create mode 100644 regress/win32/tests/sparse-compressed-test.cmd create mode 100644 regress/win32/tests/sparse-test.bscr create mode 100644 regress/win32/tests/sparse-test.cmd create mode 100644 regress/win32/tests/test0.cmd create mode 100644 regress/win32/tests/truncate-bug-tape create mode 100644 regress/win32/tests/two-jobs-test.1.bscr create mode 100644 regress/win32/tests/two-jobs-test.2.bscr create mode 100644 regress/win32/tests/two-jobs-test.cmd create mode 100644 regress/win32/tests/two-pool-tape create mode 100644 regress/win32/tests/two-pool-test.bscr create mode 100644 regress/win32/tests/two-pool-test.cmd create mode 100644 regress/win32/tests/two-vol-test.bscr create mode 100644 regress/win32/tests/two-vol-test.cmd create mode 100644 regress/win32/tests/two-volume-tape.1.bscr create mode 100644 regress/win32/tests/two-volume-tape.2.bscr create mode 100644 regress/win32/tests/two-volume-tape.cmd create mode 100644 regress/win32/tests/two-volume-test.bscr create mode 100644 regress/win32/tests/two-volume-test.cmd create mode 100644 regress/win32/tests/usr-tape-root create mode 100644 regress/win32/tests/verify-vol-tape create mode 100644 regress/win32/tests/verify-vol-test.bscr create mode 100644 regress/win32/tests/verify-vol-test.cmd create mode 100644 regress/win32/tests/weird-files-test create mode 100644 regress/win32/tests/weird-files2-test create mode 100644 regress/win32/tests/win32-backup-tape create mode 100644 regress/win32/tests/win32-to-linux-tape diff --git a/regress/win32/all-non-root-2tape-tests.cmd b/regress/win32/all-non-root-2tape-tests.cmd new file mode 100644 index 0000000000..28ba14eb59 --- /dev/null +++ b/regress/win32/all-non-root-2tape-tests.cmd @@ -0,0 +1,11 @@ +REM +REM Run all tape tests +REM +CALL tests\test0 +CALL tests\two-volume-tape +CALL tests\incremental-2tape +ECHO. +ECHO. +echo 2 Tape Test results +TYPE test.out +CALL scripts\cleanup diff --git a/regress/win32/all-non-root-tape-tests.cmd b/regress/win32/all-non-root-tape-tests.cmd new file mode 100644 index 0000000000..5eec40d7bb --- /dev/null +++ b/regress/win32/all-non-root-tape-tests.cmd @@ -0,0 +1,26 @@ +REM +REM Run all tape tests +REM +CALL config_var +IF NOT "%AUTOCHANGER%" == "nul" mtx -f %AUTOCHANGER% load 1 >nul 2>&1 +COPY test.out test1.out +CALL tests\test0 +CALL tests\backup-bacula-tape +CALL tests\btape-fill-tape +CALL tests\fixed-block-size-tape +CALL tests\four-concurrent-jobs-tape +CALL tests\four-jobs-tape +CALL tests\incremental-tape +CALL tests\relabel-tape +CALL tests\restore-by-file-tape +CALL tests\small-file-size-tape +CALL tests\truncate-bug-tape +CALL tests\two-pool-tape +CALL tests\2drive-incremental-2tape +CALL tests\bscan-tape +CALL tests\verify-vol-tape +ECHO. +ECHO. +ECHO Test results +TYPE test.out +CALL scripts\cleanup diff --git a/regress/win32/all-non-root-tests.cmd b/regress/win32/all-non-root-tests.cmd new file mode 100644 index 0000000000..15689bba1e --- /dev/null +++ b/regress/win32/all-non-root-tests.cmd @@ -0,0 +1,47 @@ +REM +REM Run all tests +REM +DEL test1.out +CALL tests\test0 +ECHO. +CALL tests\auto-label-test +CALL tests\backup-bacula-test +CALL tests\bextract-test +CALL tests\bscan-test +CALL tests\bsr-opt-test +CALL tests\compressed-test +CALL tests\concurrent-jobs-test +CALL tests\differential-test +CALL tests\four-concurrent-jobs-test +CALL tests\four-jobs-test +CALL tests\incremental-test +CALL tests\query-test +CALL tests\recycle-test +CALL tests\restore2-by-file-test +CALL tests\restore-by-file-test +CALL tests\restore-disk-seek-test +CALL tests\six-vol-test +CALL tests\span-vol-test +CALL tests\sparse-compressed-test +CALL tests\sparse-test +CALL tests\two-jobs-test +CALL tests\two-vol-test +CALL tests\verify-vol-test +REM CALL tests\weird-files2-test +REM CALL tests\weird-files-test +REM CALL tests\migration-job-test +REM CALL tests\migration-jobspan-test +REM CALL tests\migration-volume-test +REM CALL tests\migration-time-test +REM CALL tests\hardlink-test +REM +REM The following are Virtual Disk Autochanger tests +CALL tests\two-pool-test +CALL tests\two-volume-test +CALL tests\incremental-2disk +CALL tests\2drive-incremental-2disk +CALL tests\scratch-pool-test +ECHO. +ECHO Test results +TYPE test.out +CALL scripts\cleanup diff --git a/regress/win32/all-root-tests.cmd b/regress/win32/all-root-tests.cmd new file mode 100644 index 0000000000..20061b1768 --- /dev/null +++ b/regress/win32/all-root-tests.cmd @@ -0,0 +1,10 @@ +REM +REM Run all root tests +REM +DEL test.out +CALL tests\dev-test-root +CALL tests\etc-test-root +CALL tests\lib-test-root +CALL tests\usr-tape-root +TYPE test.out +CALL scripts\cleanup diff --git a/regress/win32/all-tape-and-file-tests.cmd b/regress/win32/all-tape-and-file-tests.cmd new file mode 100644 index 0000000000..cbbebf2c2d --- /dev/null +++ b/regress/win32/all-tape-and-file-tests.cmd @@ -0,0 +1,5 @@ +REM +REM Run all tests +REM +CALL all-non-root-tests +CALL all-non-root-tape-tests diff --git a/regress/win32/all-tests.cmd b/regress/win32/all-tests.cmd new file mode 100644 index 0000000000..62ffa6e940 --- /dev/null +++ b/regress/win32/all-tests.cmd @@ -0,0 +1,7 @@ +REM +REM Run all tests +REM +CALL all-non-root-tests +CALL all-root-tests +TYPE test.out +CALL scripts\cleanup diff --git a/regress/win32/config.cmd b/regress/win32/config.cmd new file mode 100644 index 0000000000..95a4113b1d --- /dev/null +++ b/regress/win32/config.cmd @@ -0,0 +1,10 @@ +@ECHO off +REM +REM First argument is expected to be a user's configuration file +REM +IF "%1" == "" ( + ECHO Arg1 must specify a config file ^(e.g. prototype.conf^) + EXIT /b 1 +) + +COPY %1 config_var.cmd diff --git a/regress/win32/make.cmd b/regress/win32/make.cmd new file mode 100644 index 0000000000..eaf74b1a4e --- /dev/null +++ b/regress/win32/make.cmd @@ -0,0 +1,111 @@ +@ECHO off +REM +REM Makefile for Bacula regression testing +REM +REM Note, Makefile is built from Makefile.in, which you should not really +REM need to change, by invoking: +REM +REM config +REM +REM e.g. +REM config kern.conf +REM + +SETLOCAL + +IF EXIST config_var.cmd GOTO :already_configured +ECHO You must run config first and supply the name of your conf file. +ECHO Use prototype.conf as a template. +EXIT /B 1 + +:already_configured + +SET PATH=%PATH%;%CD%\bin;%CD%\tools + +REM suck in user's configuration +CALL config_var.cmd + +IF EXIST "%BACULA_SOURCE%\configure" GOTO :source_ok +ECHO Unable to access the Bacula source in %BACULA_SOURCE%. Update +ECHO BACULA_SOURCE in your configuration file and rerun config. +EXIT /B 1 + +:source_ok +IF "%1" == "setup" GOTO :setup +IF "%1" == "bacula" GOTO :bacula +IF "%1" == "sed" GOTO :sed +IF "%1" == "test" GOTO :test +IF "%1" == "full_test" GOTO :full_test +IF "%1" == "root_test" GOTO :root_test +IF "%1" == "clean" GOTO :clean +IF "%1" == "reset" GOTO :reset +IF "%1" == "distclean" GOTO :distclean + +IF EXIST "%1" ( + %1 +) ELSE IF EXIST "%1.cmd" ( + %1 +) ELSE IF EXIST tests\%1 ( + tests\%1 +) ELSE IF EXIST tests\%1.cmd ( + tests\%1 +) ELSE ( + ECHO Unsupported option: %1 + ECHO Valid options are: + ECHO setup, bacula, sed, test, full_test, root_test, clean, reset, distclean + EXIT /b 1 +) + +:setup +CALL :bacula %2 +CALL :sed +GOTO :EOF + +:bacula +RD /s /q build bin weird-files tmp working 2>nul +MKDIR tmp working +SET BUILD_TYPE=%1 +IF "%BUILD_TYPE%"=="" SET BUILD_TYPE=release +ECHO Doing: scripts\setup "%BACULA_SOURCE%" %BUILD_TYPE% %EMAIL% %SMTP_HOST% %TAPE_DRIVE% %AUTOCHANGER% %AUTOCHANGER_PATH% %TAPE_DRIVE1% +CALL scripts\setup "%BACULA_SOURCE%" %BUILD_TYPE% %EMAIL% %SMTP_HOST% %TAPE_DRIVE% %AUTOCHANGER% %AUTOCHANGER_PATH% %TAPE_DRIVE1% +GOTO :EOF + +:sed +ECHO Doing: scripts\do_sed %EMAIL% %SMTP_HOST% %TAPE_DRIVE% %AUTOCHANGER% %AUTOCHANGER_PATH% %TAPE_DRIVE1% +CALL scripts\do_sed %EMAIL% %SMTP_HOST% %TAPE_DRIVE% %AUTOCHANGER% %AUTOCHANGER_PATH% %TAPE_DRIVE1% +GOTO :EOF + +:test +REM Run all non-root userid tests +CALL all-non-root-tests +GOTO :EOF + +:full_test +REM run all file and tape tests +CALL all-tape-and-file-tests +GOTO :EOF + +:root_test +REM These tests require you to run as root +CALL all-root-tests +GOTO :EOF + +:clean +CALL scripts\cleanup +DEL \tmp\file-list tmp\* working\* test.out diff >nul 2>&1 +DEL 1 2 3 scripts\1 scripts\2 scripts\3 tests\1 tests\2 tests\3 >nul 2>&1 +DEL .#* /s >nul 2>&1 +GOTO :EOF + +:reset +REM Reset our userid after running as root +CALL scripts\cleanup +DEL \tmp\file-list tmp\file-list +DEL tmp\* working\* +GOTO :EOF + +:distclean +RD /s /q bin build weird-files weird-files weird-files2 tmp working 2>nul +DEL scripts\*.conf +CALL :clean +GOTO :EOF diff --git a/regress/win32/prototype.conf b/regress/win32/prototype.conf new file mode 100644 index 0000000000..e6658feeda --- /dev/null +++ b/regress/win32/prototype.conf @@ -0,0 +1,31 @@ +REM +REM Prototype personal configuration file for the regression +REM scripts. Either edit this file directly, or better copy +REM it elsewhere so it won't get overwritten. +REM + +REM +REM Put the full path to the Bacula source code to be tested +REM +SET BACULA_SOURCE= + +REM Where to send email messages +REM +SET EMAIL= +SET SMTP_HOST=localhost + +REM +REM The device name of your tape drive if you have one +REM +SET TAPE_DRIVE=tape0 +SET TAPE_DRIVE1=nul + +REM +REM if you don't have an autochanger set AUTOCHANGER to nul +REM +SET AUTOCHANGER=changer0 + +REM +REM This must be the path to the autochanger including its name +REM +SET AUTOCHANGER_PATH=%CD%\bin\mtx diff --git a/regress/win32/scripts/bacula-dir-migration.conf.in b/regress/win32/scripts/bacula-dir-migration.conf.in new file mode 100644 index 0000000000..312feb5205 --- /dev/null +++ b/regress/win32/scripts/bacula-dir-migration.conf.in @@ -0,0 +1,229 @@ +# +# 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 1.39 +# +# 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@" + Maximum Concurrent Jobs = 4 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" + 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 = 4 + SpoolData = yes +# Prefer Mounted Volumes = no +} + +Job { + Name = "migrate-job" + Type = Migrate + Level = Full + Client=@hostname@-fd + FileSet="Full Set" + Messages = Standard + Storage = DiskChanger + Write Bootstrap = "@working_dir@/migratejob.bsr" + Pool = Default + Maximum Concurrent Jobs = 4 + Selection Type = Job + Selection Pattern = ".*Save" +} + +Job { + Name = "migrate-volume" + Type = Migrate + Level = Full + Client=@hostname@-fd + FileSet="Full Set" + Messages = Standard + Storage = DiskChanger + Write Bootstrap = "@working_dir@/migratevol.bsr" + Pool = Default + Maximum Concurrent Jobs = 4 + Selection Type = Volume + Selection Pattern = "File*" +} + +Job { + Name = "migrate-occupancy" + Type = Migrate + Level = Full + Client=@hostname@-fd + FileSet="Full Set" + Messages = Standard + Storage = DiskChanger + Write Bootstrap = "@working_dir@/migratejob.bsr" + Pool = Default + Maximum Concurrent Jobs = 4 + Selection Type = PoolOccupancy +} + +Job { + Name = "migrate-time" + Type = Migrate + Level = Full + Client=@hostname@-fd + FileSet="Full Set" + Messages = Standard + Storage = DiskChanger + Write Bootstrap = "@working_dir@/migratejob.bsr" + Pool = Default + Maximum Concurrent Jobs = 4 + Selection Type = PoolTime +} + + + + +# 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 = tmp\bconcmds +CALL scripts\functions run_bconsole +grep "No Jobs running." tmp\dir.out >nul 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + ECHO. + ECHO !!!! Zombie Jobs in Director !!!! + ECHO !!!! Zombie Jobs in Director !!!! >>test.out + ECHO. +) +grep "No Jobs running." tmp\fd.out >nul 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + ECHO. + ECHO !!!! Zombie Jobs in File daemon !!!! + ECHO !!!! Zombie Jobs in File daemon !!!! >>test.out + ECHO. +) +grep "No Jobs running." tmp\sd.out >nul 2>&1 +IF %ERRORLEVEL% NEQ 0 ( + ECHO. + ECHO !!!! Zombie Jobs in Storage daemon !!!! + ECHO !!!! Zombie Jobs in Storage daemon !!!! >>test.out + ECHO. +) +grep "ERROR" tmp/log*.out >nul 2>&1 +IF %ERRORLEVEL% EQU 0 ( + ECHO. + ECHO !!!! ERROR in log output !!!! + ECHO !!!! ERROR in log output !!!! >>test.out + ECHO. +) +grep "Fatal Error" tmp\log*.out >nul 2>&1 +IF %ERRORLEVEL% EQU 0 ( + ECHO. + ECHO !!!! Fatal Error in log output !!!! + ECHO !!!! Fatal Error in log output !!!! >>test.out + ECHO. +) diff --git a/regress/win32/scripts/cleanup-2drive.cmd.in b/regress/win32/scripts/cleanup-2drive.cmd.in new file mode 100644 index 0000000000..c49d6dbacc --- /dev/null +++ b/regress/win32/scripts/cleanup-2drive.cmd.in @@ -0,0 +1,43 @@ +REM +REM Cleanup left over files -- both before and after test run +REM +CALL scripts\cleanup + +IF NOT "@autochanger@" == "nul" ( + SET slot=0 + FOR /f %%i in ( 'bin\mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1' ) DO SET slot=%%i + ECHO Slot %slot% in drive 1 + IF !slot! NEQ 0 ( + ECHO unload slot !slot! in drive 1 + bin\mtx-changer @autochanger@ unload !slot! @tape_drive1@ 1 + ) + FOR /f %%i in ( 'bin\mtx-changer @autochanger@ loaded 0 @tape_drive@ 0' ) DO SET slot=%%i + ECHO Slot !slot! in drive 0 + IF !slot! NEQ 0 ( + echo "unload slot !slot! in drive 0" + bin\mtx-changer @autochanger@ unload !slot! @tape_drive@ 0 + ) + + FOR /f %%i in ( 'bin\mtx-changer @autochanger@ loaded 0 @tape_drive1@ 1' ) DO SET slot=%%i + IF !slot! NEQ 2 ( + ECHO load slot 2 in drive 1 + bin\mtx-changer @autochanger@ load 2 @tape_drive1@ 1 + ) + ECHO WEOF drive 1 + mt -f @tape_drive1@ rewind + mt -f @tape_drive1@ weof + ECHO unload slot 2 in drive 1 + bin\mtx-changer @autochanger@ unload 2 @tape_drive1@ 1 + + FOR /f %%i in ( 'bin\mtx-changer @autochanger@ loaded 0 @tape_drive@ 0' ) DO SET slot=%%i + ECHO Slot !slot! in drive 0 + IF !slot! NEQ 1 ( + ECHO load slot 1 in drive 0 + bin\mtx-changer @autochanger@ load 1 @tape_drive@ 0 + ) + ECHO WEOF drive 0 + mt -f @tape_drive@ rewind + mt -f @tape_drive@ weof + ECHO unload slot 1 from drive 0 + bin\mtx-changer @autochanger@ unload 1 @tape_drive@ 0 +) diff --git a/regress/win32/scripts/cleanup-2tape.cmd.in b/regress/win32/scripts/cleanup-2tape.cmd.in new file mode 100644 index 0000000000..a572d7f5a5 --- /dev/null +++ b/regress/win32/scripts/cleanup-2tape.cmd.in @@ -0,0 +1,29 @@ +REM +REM Cleanup left over files -- both before and after test run +REM + +setlocal ENABLEDELAYEDEXPANSION + +CALL scripts\cleanup + +IF NOT "@autochanger@" == "nul" ( + SET slot=0 + FOR /f %%i in ( 'bin\mtx-changer @autochanger@ loaded 0 dummy 0' ) DO SET slot=%%i + IF !slot! NEQ 2 ( + bin\mtx-changer @autochanger@ unload 0 @tape_drive@ 0 + bin\mtx-changer @autochanger@ load 2 @tape_drive@ 0 + ) + mt -f @tape_drive@ rewind + mt -f @tape_drive@ weof + + REM + REM If we have an autochanger always load tape in slot 1 + REM + FOR /f %%i in ( 'bin\mtx-changer @autochanger@ loaded 0 dummy 0' ) DO SET slot=%%i + IF !slot! NEQ 1 ( + bin\mtx-changer @autochanger@ unload 0 @tape_drive@ 0 + bin\mtx-changer @autochanger@ load 1 @tape_drive@ 0 + ) +) +mt -f @tape_drive@ rewind +mt -f @tape_drive@ weof diff --git a/regress/win32/scripts/cleanup-tape.cmd.in b/regress/win32/scripts/cleanup-tape.cmd.in new file mode 100644 index 0000000000..46ce41a6d5 --- /dev/null +++ b/regress/win32/scripts/cleanup-tape.cmd.in @@ -0,0 +1,7 @@ +REM +REM Cleanup left over files -- both before and after test run +REM +CALL scripts\cleanup + +mt -f @tape_drive@ rewind +mt -f @tape_drive@ weof diff --git a/regress/win32/scripts/cleanup.cmd b/regress/win32/scripts/cleanup.cmd new file mode 100644 index 0000000000..0125175548 --- /dev/null +++ b/regress/win32/scripts/cleanup.cmd @@ -0,0 +1,23 @@ +@ECHO off +REM +REM Cleanup left over files -- both before and after test run +REM + +CALL scripts\bacula stop >nul 2>&1 + +DEL /q /f \tmp\FileVolume* tmp\FileVolume* >nul 2>&1 +DEL /q /f \tmp\TestVolume001 \tmp\Small* >nul 2>&1 +RD /s /q \tmp\bacula-restores tmp\bacula-restores >nul 2>&1 +DEL /q /f tmp\original tmp\Small* tmp\TestVolume* >nul 2>&1 +DEL /q /f tmp\restored tmp\largefile tmp\bscan.bsr tmp\log*.out >nul 2>&1 +DEL /q /f \tmp\sed_tmp \tmp\file-list >nul 2>&1 +RD /s /q tmp\build >nul 2>&1 +DEL /q /f tmp\restore-list tmp\restore2-list >nul 2>&1 +DEL /q /f tmp\fd.out tmp\dir.out tmp\sd.out >nul 2>&1 +DEL /q /f working\log tmp\TEST-* >nul 2>&1 +DEL /q /f working\*.bsr >nul 2>&1 +DEL /q /f tmp\disk-changer.cmd \tmp\disk-changer.cmd >nul 2>&1 + +CALL bin\drop_bacula_tables >nul 2>&1 +CALL bin\make_bacula_tables >nul 2>&1 +CALL bin\grant_bacula_privileges >nul 2>&1 diff --git a/regress/win32/scripts/copy-2disk-confs.cmd b/regress/win32/scripts/copy-2disk-confs.cmd new file mode 100644 index 0000000000..e759a41413 --- /dev/null +++ b/regress/win32/scripts/copy-2disk-confs.cmd @@ -0,0 +1,9 @@ +REM +REM Setup for using the Virtual Disk Changer (simulates tape changer) +REM +COPY scripts\bacula-dir-tape.conf bin\bacula-dir.conf +COPY scripts\bacula-sd-2disk.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf +COPY bin\bacula-dir.conf tmp\1 +bin\sed -e "s;# Autochanger = yes; Autochanger = yes;g" tmp\1 >bin\bacula-dir.conf diff --git a/regress/win32/scripts/copy-2disk-drive-confs.cmd b/regress/win32/scripts/copy-2disk-drive-confs.cmd new file mode 100644 index 0000000000..173eec2df0 --- /dev/null +++ b/regress/win32/scripts/copy-2disk-drive-confs.cmd @@ -0,0 +1,6 @@ +COPY scripts\bacula-dir-tape.conf bin\bacula-dir.conf +COPY scripts\bacula-sd-2disk-drive.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf +COPY bin\bacula-dir.conf tmp\1 +bin\sed -e "s;# Autochanger = yes; Autochanger = yes;g" tmp\1 >bin\bacula-dir.conf diff --git a/regress/win32/scripts/copy-2drive-confs.cmd b/regress/win32/scripts/copy-2drive-confs.cmd new file mode 100644 index 0000000000..d20bf19ca9 --- /dev/null +++ b/regress/win32/scripts/copy-2drive-confs.cmd @@ -0,0 +1,10 @@ +COPY scripts\bacula-dir-tape.conf bin\bacula-dir.conf +COPY scripts\bacula-sd-2drive.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf + +COPY bin\bacula-dir.conf tmp\1 +bin\sed -e "s;# Autochanger = yes; Autochanger = yes;g" >bin\bacula-dir.conf + +REM get proper SD tape definitions +COPY scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/copy-2tape-confs.cmd b/regress/win32/scripts/copy-2tape-confs.cmd new file mode 100644 index 0000000000..3e5af7aa12 --- /dev/null +++ b/regress/win32/scripts/copy-2tape-confs.cmd @@ -0,0 +1,10 @@ +COPY scripts\bacula-dir-tape.conf bin\bacula-dir.conf +COPY scripts\bacula-sd-2tape.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf + +COPY bin\bacula-dir.conf tmp\1 +bin\sed -e "s;# Autochanger = yes; Autochanger = yes;g" tmp\1 >bin\bacula-dir.conf + +REM get proper SD tape definitions +COPY scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/copy-confs.cmd b/regress/win32/scripts/copy-confs.cmd new file mode 100644 index 0000000000..359839c6d8 --- /dev/null +++ b/regress/win32/scripts/copy-confs.cmd @@ -0,0 +1,7 @@ +COPY scripts\bacula-dir.conf bin\bacula-dir.conf +COPY scripts\bacula-sd.conf bin\bacula-sd.conf +COPY scripts\bacula-fd.conf bin\bacula-fd.conf +COPY scripts\bconsole.conf bin\bconsole.conf + +REM get proper SD tape definitions +COPY scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/copy-crypto-confs.cmd b/regress/win32/scripts/copy-crypto-confs.cmd new file mode 100644 index 0000000000..7166399d97 --- /dev/null +++ b/regress/win32/scripts/copy-crypto-confs.cmd @@ -0,0 +1,5 @@ +COPY scripts\new-test-bacula-dir.conf bin\bacula-dir.conf +COPY scripts\test-bacula-sd.conf bin\bacula-sd.conf +COPY scripts\crypto-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf +COPY scripts\cryptokeypair.pem bin\cryptokeypair.pem diff --git a/regress/win32/scripts/copy-migration-confs.cmd b/regress/win32/scripts/copy-migration-confs.cmd new file mode 100644 index 0000000000..7bf12ddbd8 --- /dev/null +++ b/regress/win32/scripts/copy-migration-confs.cmd @@ -0,0 +1,7 @@ +REM +REM Setup for migration tests +REM +COPY scripts\bacula-dir-migration.conf bin\bacula-dir.conf +COPY scripts\bacula-sd-migration.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf diff --git a/regress/win32/scripts/copy-tape-confs.cmd b/regress/win32/scripts/copy-tape-confs.cmd new file mode 100644 index 0000000000..0a7a50a811 --- /dev/null +++ b/regress/win32/scripts/copy-tape-confs.cmd @@ -0,0 +1,7 @@ +copy scripts\bacula-dir-tape.conf bin\bacula-dir.conf +copy scripts\bacula-sd-tape.conf bin\bacula-sd.conf +copy scripts\test-bacula-fd.conf bin\bacula-fd.conf +copy scripts\test-console.conf bin\bconsole.conf + +REM get proper SD tape definitions +copy scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/copy-test-confs.cmd b/regress/win32/scripts/copy-test-confs.cmd new file mode 100644 index 0000000000..c07c5d6204 --- /dev/null +++ b/regress/win32/scripts/copy-test-confs.cmd @@ -0,0 +1,7 @@ +COPY scripts\new-test-bacula-dir.conf bin\bacula-dir.conf +COPY scripts\test-bacula-sd.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf + +REM get proper SD tape definitions +COPY scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/copy-testa-confs.cmd b/regress/win32/scripts/copy-testa-confs.cmd new file mode 100644 index 0000000000..4cc89ff02d --- /dev/null +++ b/regress/win32/scripts/copy-testa-confs.cmd @@ -0,0 +1,7 @@ +COPY scripts\testa-bacula-dir.conf bin\bacula-dir.conf +COPY scripts\test-bacula-sd.conf bin\bacula-sd.conf +COPY scripts\test-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf + +REM get proper SD tape definitions +COPY scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/copy-win32-confs.cmd b/regress/win32/scripts/copy-win32-confs.cmd new file mode 100644 index 0000000000..b9f0ab72f6 --- /dev/null +++ b/regress/win32/scripts/copy-win32-confs.cmd @@ -0,0 +1,7 @@ +COPY scripts\win32-bacula-dir-tape.conf bin\bacula-dir.conf +COPY scripts\win32-bacula-sd-tape.conf bin\bacula-sd.conf +COPY scripts\win32-bacula-fd.conf bin\bacula-fd.conf +COPY scripts\test-console.conf bin\bconsole.conf + +REM get proper SD tape definitions +COPY scripts\win32_tape_options bin\tape_options diff --git a/regress/win32/scripts/crypto-bacula-fd.conf.in b/regress/win32/scripts/crypto-bacula-fd.conf.in new file mode 100644 index 0000000000..ec4152d2b8 --- /dev/null +++ b/regress/win32/scripts/crypto-bacula-fd.conf.in @@ -0,0 +1,36 @@ +# +# Default Bacula File Daemon Configuration file +# +# For Bacula release 1.33 +# +# There is not much to change here except perhaps the +# File daemon Name to +# + +# +# List Directors who are permitted to contact this File daemon +# +Director { + Name = @hostname@-dir + Password = "xevrjURYoCHhn26RaJoWbeWXEY/a3VqGKp/37tgWiuHc" +} + +# +# "Global" File daemon configuration specifications +# +FileDaemon { # this is me + Name = @hostname@-fd + FDport = 8102 # where we listen for the director + WorkingDirectory = "@working_dir@" + Pid Directory = "@piddir@" + SubSys Directory = "@subsysdir@" + PKI Signatures = Yes + PKI Encryption = Yes + PKI Keypair = "@scriptdir@/cryptokeypair.pem" +} + +# Send all messages except skipped files back to Director +Messages { + Name = Standard + director = @hostname@-dir = all, !terminate +} diff --git a/regress/win32/scripts/cryptokeypair.pem b/regress/win32/scripts/cryptokeypair.pem new file mode 100644 index 0000000000..a9ee617a1b --- /dev/null +++ b/regress/win32/scripts/cryptokeypair.pem @@ -0,0 +1,53 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA0sNbRqIUnck2ztve3GNRaMZSz95KauSqlMPSQV+i0jZNXm31 +bemJKDbeYr7NBIo5C8FqLlUgk3nh+GzeoQ+wTJ3qphdY+I4rL3q8kweDjSpvnXBw +L722jH+UOSKDeRol7lMCOwooyY0r4cSsE/AIHfKts6D2DV8hUzbuxy1s4wwfJDnF +BQtpXJbLL7JfAKYlgqHBteDLkfKikcqIuPGjvcsKBsun4HXZuQ1y1looRW6N7UM/ +QwBfRYpJVQc4h/mwue2gzhChlOTWyKJKZxuiwftTv7xHXw/yUpeth6OdALj8sbOB +OXMV9Hb3HSO3UftI2LpwuzKW6OgBXWAecuYGxQIDAQABAoIBAQCGchQxtIbOOGL8 +BgneMITn/0soSrbSBVhDWb8v8J/e1MD58c7T9FuICahG+UuzD7FgLFtdfvQu31sk +q95Ag8+EsF/U36Pjul0WBodwiySB0oYsumL2MWDXszKMV9XiVKnJo64Sl2J5X9KU +TG8wsLec0we3RIBw+zQ47xvWdsW09wfdDg38f6mUlcoH5uAlMkGILAm5myo8vZ1r +0GNmV5m60FKm9K0pGVTUk2KhdenMQYyOMPhJB5J+corkJN0FqFosfl6E1zlavqff +olq/oviZEeoGZrOjnKhm/xFXI9N0iO9sdgKV/5sFXAk+XyJSeMU3DQHcpnXU+Dro +Ow/VKoABAoGBAPO5BJQQombCOrPMPUM3IgEOJX7xDvni/Bh6VAnZVvHndiPWwjpS +u6fuq77++hHOzhZsGZKYEc83amSIOnFAXQav7UCRZhHR9bWyHsBNK8hpDI5yYsag +0SUOS8TSvhxpY4UlaWlnIVwH3OYmcAFdEyfXbPyOt3ayH+BiY3/Br7bFAoGBAN1h +TOhKJERbGGkQ4d/QHWjjjnXnBSje6UAZNyJa0/L9Lc9TquePYK5noeTl1fU2LLPo +l41T2BFb/0iuxYuobb8vPc0IRmRMAMLeoRCS7V2Gds3fhqINndnfASOEAuqDfcKQ +mpYjNbYGFNn40YQNaAn7Uxs5vhb4kP5OY62rQhABAoGAGPysAn4eGEjrecmDsmNx +oggQQg52yZnC3MOV4BifOFfRneUDrrUStinbA87iVncMW/IjQQtEMClvR/VLgJbn +sqrQuSDvBP6woTssuexvg7F5bxU9GT4dkx3/GKO+h+0qHdlzEDJZkjTgKdxg+VLQ +hvIoI1CCcLHcYMXVi6CQ4j0CgYEAjHAYYNf/79k2QBi0oc4dihepnUQD8uyOXdph +LoseH+za7cZvCdzcAWe+vT3MoHVQoITx93bz//czmIE+0pzzmjA27WXNefz5EqY2 +2RPMPuN5ZJrjhtRKihc9WrF5RBpMYmxnlM0bWrC685g0GaiDkql8DC5yV5IyMRG7 +jEWzcAECgYAb78NE1FvfBF+z8H2j+Pa0uyuFF1YNW2dr/v0p2atE2AUzxA/Soo2V +8G+c9qQlYequcrQLN19tZAs9DCUFdCw+lMlKBoJiWVOA33L2neT1UpDY+64rFZL6 +S91HXGq2FKjFTovcDsfw5CgHk64zn9BzX4peCGkbDkbxh7wadx4Hkw== +-----END RSA PRIVATE KEY----- +-----BEGIN CERTIFICATE----- +MIIEcTCCA1mgAwIBAgIJAL/Bgtto2kTWMA0GCSqGSIb3DQEBBAUAMIGBMQswCQYD +VQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQg +V2lkZ2l0cyBQdHkgTHRkMRkwFwYDVQQDExB0ZXN0LmV4YW1wbGUuY29tMR8wHQYJ +KoZIhvcNAQkBFhB0ZXN0QGV4YW1wbGUuY29tMB4XDTA1MTEwMjAzMTI1MloXDTA1 +MTIwMjAzMTI1MlowgYExCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRl +MSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxGTAXBgNVBAMTEHRl +c3QuZXhhbXBsZS5jb20xHzAdBgkqhkiG9w0BCQEWEHRlc3RAZXhhbXBsZS5jb20w +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDSw1tGohSdyTbO297cY1Fo +xlLP3kpq5KqUw9JBX6LSNk1ebfVt6YkoNt5ivs0EijkLwWouVSCTeeH4bN6hD7BM +neqmF1j4jisveryTB4ONKm+dcHAvvbaMf5Q5IoN5GiXuUwI7CijJjSvhxKwT8Agd +8q2zoPYNXyFTNu7HLWzjDB8kOcUFC2lclssvsl8ApiWCocG14MuR8qKRyoi48aO9 +ywoGy6fgddm5DXLWWihFbo3tQz9DAF9FiklVBziH+bC57aDOEKGU5NbIokpnG6LB ++1O/vEdfD/JSl62Ho50AuPyxs4E5cxX0dvcdI7dR+0jYunC7Mpbo6AFdYB5y5gbF +AgMBAAGjgekwgeYwHQYDVR0OBBYEFGGSblAAcqocdavoGyiTv88YuHLaMIG2BgNV +HSMEga4wgauAFGGSblAAcqocdavoGyiTv88YuHLaoYGHpIGEMIGBMQswCQYDVQQG +EwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lk +Z2l0cyBQdHkgTHRkMRkwFwYDVQQDExB0ZXN0LmV4YW1wbGUuY29tMR8wHQYJKoZI +hvcNAQkBFhB0ZXN0QGV4YW1wbGUuY29tggkAv8GC22jaRNYwDAYDVR0TBAUwAwEB +/zANBgkqhkiG9w0BAQQFAAOCAQEAO16yp0yQjglmDLXsoBofRTKynP3R3Z5wWy7D +YvLAUcR/AvG+WZRfrTmi8fZ+Km5rbVrujPsWiK27k6Md0380Z3KY+mjnCcElxNbA +7I5CG2NZEkmequyy5p/crexUg/TZdvvF0xmJyUS7ArPv7yzSXtncvSvoBaj1AdK7 +R3OFKhG8KBSfAmrSylBQDONuuvM851XO5KKSyXSJa8R7bs5hHcBCILAEYKklWopp +JuPJqB/zaIymY5KrpKJE4z80Nv0IAE5aP1JX5g80/R/pzPjWkpIYtkUjDOZs3fDR +eJA2cUWE0WoVE4fTGYLHAXrIV1wkn4Onu48nq94HhUpyc2brLw== +-----END CERTIFICATE----- diff --git a/regress/win32/scripts/disk-changer.cmd b/regress/win32/scripts/disk-changer.cmd new file mode 100644 index 0000000000..3efb1933ce --- /dev/null +++ b/regress/win32/scripts/disk-changer.cmd @@ -0,0 +1,201 @@ +@ECHO off +setlocal ENABLEDELAYEDEXPANSION +REM +REM +REM Bacula interface to virtual autoloader using disk storage +REM +REM $Id$ +REM +REM If you set in your Device resource +REM +REM Changer Command = "disk-changer %c %o %S %a %d" +REM you will have the following input to this script: +REM +REM So Bacula will always call with all the following arguments, even though +REM in some cases, not all are used. +REM +REM disk-changer "changer-device" "command" "slot" "archive-device" "drive-index" +REM %1 %2 %3 %4 %5 +REM +REM By default the autochanger has 10 Volumes and 1 Drive. +REM +REM Note: For this script to work, you *must" specify +REM Device Type = File +REM in each of the Devices associated with your AutoChanger resource. +REM +REM changer-device is the name of a file that overrides the default +REM volumes and drives. It may have: +REM maxslot=n where n is one based (default 10) +REM maxdrive=m where m is zero based (default 1 -- i.e. 2 drives) +REM +REM This code can also simulate barcodes. You simply put +REM a list of the slots and barcodes in the "base" directory/barcodes. +REM See below for the base directory definition. Example of a +REM barcodes file: +REM C:\TEMP\bacula\barcodes +REM 1:Vol001 +REM 2:Vol002 +REM ... +REM +REM archive-device is the name of the base directory where you want the +REM Volumes stored appended with \drive0 for the first drive; \drive1 +REM for the second drive, ... For example, you might use +REM C:\Temp\bacula\drive0 Note: you must not have a trailing slash, and +REM the string (e.g. \drive0) must be unique, and it must not match +REM any other part of the directory name. These restrictions could be +REM easily removed by any clever script jockey. +REM +REM Full example: disk-changer C:\Temp\bacula\conf load 1 C:\Temp\bacula\drive0 0 +REM +REM The Volumes will be created with names slot1, slot2, slot3, ... maxslot in the +REM base directory. In the above example the base directory is C:\Temp\bacula. +REM However, as with tapes, their Bacula Volume names will be stored inside the +REM Volume label. In addition to the Volumes (e.g. C:\Temp\bacula\slot1, +REM C:\Temp\bacula\slot3, ...) this script will create a C:\Temp\bacula\loadedn +REM file to keep track of what Slot is loaded. You should not change this file. +REM + +SET dbgfile=%CD%\disk-changer.log + +REM to turn on logging, uncomment the following line +IF NOT EXIST %dbgfile% COPY nul %dbgfile% >nul + +REM +REM check parameter count on commandline +REM +REM Check for special cases where only 2 arguments are needed, +REM all others are a minimum of 5 +REM +IF "%1" EQU "" goto :param_count_invalid +IF "%2" EQU "" goto :param_count_invalid +IF "%2" EQU "list" goto :param_count_valid +IF "%2" EQU "slots" goto :param_count_valid +IF "%3" EQU "" goto :param_count_invalid +IF "%4" EQU "" goto :param_count_invalid +IF "%5" EQU "" goto :param_count_invalid +GOTO :param_count_valid + +:param_count_invalid + echo Insufficient number of arguments given. + IF "%2" EQU "" ( + echo At least two arguments must be specified. + ) else echo Command expected 5 arguments. +:usage + ECHO. + ECHO usage: disk-changer ctl-device command [slot archive-device drive-index] + ECHO Valid commands are: unload, load, list, loaded, and slots. + EXIT /B 1 + +:param_count_valid + +REM Setup arguments +SET ctl=%1 +SET cmd=%2 +SET slot=%3 +SET device=%4 +SET drive=%5 + +REM set defaults +SET maxdrive=1 +SET maxslot=10 + +SET ctl=%ctl:/=\% +SET ctl=%ctl:\\=\% + +SET device=%device:/=\% +SET device=%device:\\=\% + +REM Pull in conf file +IF EXIST %ctl% CALL %ctl% + +FOR %%i IN ( %ctl% ) DO SET dirname=%%~dpi +IF NOT EXIST %dirname%nul ( + ECHO ERROR: Autochanger directory "%dirname%" does not exist. + ECHO You must create it. + EXIT /b 1 +) + +CALL :debug "Parms: %ctl% %cmd% %slot% %device% %drive%" +IF "%cmd%" EQU "unload" GOTO :cmdUnload +IF "%cmd%" EQU "load" GOTO :cmdLoad +IF "%cmd%" EQU "list" GOTO :cmdList +IF "%cmd%" EQU "loaded" GOTO :cmdLoaded +IF "%cmd%" EQU "slots" GOTO :cmdSlots +GOTO :cmdUnknown + +:cmdUnload + CALL :debug "Doing disk -f %ctl% unload %slot% %device% %drive%" + IF NOT EXIST %dirname%loaded%drive% ECHO 0 >%dirname%loaded%drive% + FOR /f %%i IN ( %dirname%loaded%drive% ) DO SET ld=%%i + + IF "%slot%" EQU "%ld%" ( + CALL :debug "Unloaded slot %ld% from drive %drive%" + ECHO 0 >%dirname%loaded%drive% + DEL %dirname%%device% >nul 2>nul + SET rtn=0 + ) ELSE ( + ECHO Storage Element %slot% is Already Full + CALL :debug "Storage Element %slot% is Already Full" + SET rtn=1 + ) + GOTO :cmdExit + +:cmdLoad + CALL :debug "Doing disk -f %ctl% load %slot% %device% %drive%" + SET ld=0 + IF NOT EXIST %dirname%loaded%drive% ECHO 0 >%dirname%loaded%drive% + FOR /f %%i IN ( %dirname%loaded%drive% ) DO SET ld=%%i + IF %ld% EQU 0 ( + IF NOT EXIST %dirname%slot%slot% COPY nul %dirname%slot%slot% >nul + DEL %device% + fsutil hardlink create %device% %dirname%slot%slot% >nul 2>&1 + SET rtn=%ERRORLEVEL% + IF !rtn! EQU 0 ( + ECHO %slot% >%dirname%loaded%drive% + CALL :debug "Loaded slot %slot% into drive %drive%" + ) ELSE ( + CALL :debug "Create hardlink failed, return = !rtn!" + ) + ) ELSE ( + ECHO Drive %drive% Full - Storage element %ld% loaded + CALL :debug "Drive %drive% Full - Storage element %ld% loaded" + ) + GOTO :cmdExit + +:cmdList + CALL :debug "Doing disk -f %ctl% -- to list volumes" + IF EXIST %dirname%barcodes ( + TYPE %dirname%barcodes + ) ELSE ( + FOR /l %%i IN ( 1, 1, %maxslot% ) DO ECHO %%i: + ) + SET rtn=0 + GOTO :cmdExit + +:cmdLoaded + CALL :debug "Doing disk -f %ctl% %drive% -- to find what is loaded" + IF EXIST %dirname%loaded%drive% ( TYPE %dirname%loaded%drive% ) ELSE ECHO 0 + SET rtn=0 + GOTO :cmdExit + +:cmdSlots + CALL :debug "Doing disk -f %ctl% -- to get count of slots" + ECHO %maxslot% + SET rtn=0 + GOTO :cmdExit + +:cmdExit + EXIT /b %rtn% + +:cmdUnknown + ECHO '%cmd%' is an invalid command. + GOTO :usage + +REM +REM log whats done +REM +:debug + IF NOT EXIST %dbgfile% GOTO :EOF + FOR /f "usebackq tokens=2-4,5-7 delims=/:. " %%i IN ( '%DATE% %TIME%' ) do SET TIMESTAMP=%%k%%i%%j-%%l:%%m:%%n + ECHO %TIMESTAMP% %* >> %dbgfile% + GOTO :EOF diff --git a/regress/win32/scripts/do_sed.cmd b/regress/win32/scripts/do_sed.cmd new file mode 100644 index 0000000000..a533a303f8 --- /dev/null +++ b/regress/win32/scripts/do_sed.cmd @@ -0,0 +1,73 @@ +IF "%1" == "" GOTO :usage +IF "%2" == "" GOTO :usage +IF "%3" == "" GOTO :usage +IF "%4" == "" GOTO :usage +IF "%5" == "" GOTO :usage +IF "%6" == "" GOTO :usage +GOTO :args_ok + +:usage +ECHO First arg must be email name +ECHO and the second must be the smtp or email host +ECHO and the third must be a tape drive +ECHO and the fourth must be a tape control name or nul +ECHO and the fifth must be the full path to the mtx program +ECHO and the sixth must be tape drive 1 or nul +EXIT /b 1 + +:args_ok +SET out=tmp\sed_tmp + +REM Create sed command script + +ECHO s;@sbindir@;%CD:\=/%/bin;g >%out% +ECHO s;@scriptdir@;%CD:\=/%/scripts;g >>%out% +ECHO s;@working_dir@;%CD:\=/%/working;g >>%out% +ECHO s;@piddir@;%CD:\=/%/working;g >>%out% +ECHO s;@subsysdir@;%CD:\=/%/working;g >>%out% +ECHO s;@job_email@;%1;g >>%out% +ECHO s;@smtp_host@;%2;g >>%out% +ECHO s;@tape_drive@;%3;g >>%out% +ECHO s;@autochanger@;%4;g >>%out% +ECHO s;@tmpdir@;%CD:\=/%/tmp;g >>%out% +ECHO s;@hostname@;localhost;g >>%out% +ECHO s;@changer_path@;%5;g >>%out% +ECHO s;@tape_drive1@;%6;g >>%out% +ECHO s;@disk_drive@;%CD:\=/%/tmp/disk-changer;g >>%out% +ECHO s;@smtp_program@;%CD:\=/%/bin/bsmtp;g >>%out% + +ECHO SET AUTOCHANGER=%4 >config_out.cmd +ECHO SET AUTOCHANGER_PATH=%5 >>config_out.cmd +ECHO SET TAPE_DRIVE1=%6 >>config_out.cmd + +REM process .in files with sed script +sed -f %out% %CD%\scripts\test-bacula-dir.conf.in >%CD%\scripts\test-bacula-dir.conf +sed -f %out% %CD%\scripts\new-test-bacula-dir.conf.in >%CD%\scripts\new-test-bacula-dir.conf +sed -f %out% %CD%\scripts\testa-bacula-dir.conf.in >%CD%\scripts\testa-bacula-dir.conf +sed -f %out% %CD%\scripts\test-bacula-fd.conf.in >%CD%\scripts\test-bacula-fd.conf +sed -f %out% %CD%\scripts\test-bacula-sd.conf.in >%CD%\scripts\test-bacula-sd.conf +sed -f %out% %CD%\scripts\test-console.conf.in >%CD%\scripts\test-console.conf +sed -f %out% %CD%\scripts\crypto-bacula-fd.conf.in >%CD%\scripts\crypto-bacula-fd.conf +sed -f %out% %CD%\scripts\bacula-dir-tape.conf.in >%CD%\scripts\bacula-dir-tape.conf +sed -f %out% %CD%\scripts\bacula-dir-migration.conf.in >%CD%\scripts\bacula-dir-migration.conf +sed -f %out% %CD%\scripts\win32-bacula-dir-tape.conf.in >%CD%\scripts\win32-bacula-dir-tape.conf +sed -f %out% %CD%\scripts\bacula-sd-tape.conf.in >%CD%\scripts\bacula-sd-tape.conf +sed -f %out% %CD%\scripts\bacula-sd-2tape.conf.in >%CD%\scripts\bacula-sd-2tape.conf +sed -f %out% %CD%\scripts\bacula-sd-migration.conf.in >%CD%\scripts\bacula-sd-migration.conf +sed -f %out% %CD%\scripts\bacula-sd-2disk.conf.in >%CD%\scripts\bacula-sd-2disk.conf +sed -f %out% %CD%\scripts\bacula-sd-2drive.conf.in >%CD%\scripts\bacula-sd-2drive.conf +sed -f %out% %CD%\scripts\bacula-sd-2disk-drive.conf.in >%CD%\scripts\bacula-sd-2disk-drive.conf +sed -f %out% %CD%\scripts\cleanup-tape.cmd.in >%CD%\scripts\cleanup-tape.cmd +sed -f %out% %CD%\scripts\cleanup-2tape.cmd.in >%CD%\scripts\cleanup-2tape.cmd +sed -f %out% %CD%\scripts\cleanup-2drive.cmd.in >%CD%\scripts\cleanup-2drive.cmd +sed -f %out% %CD%\scripts\prepare-two-tapes.cmd.in >%CD%\scripts\prepare-two-tapes.cmd +sed -f %out% %CD%\scripts\bacula-dir.conf.testrunscript.in >%CD%\scripts\bacula-dir.conf.testrunscript + +COPY %CD%\bin\bacula-sd.conf tmp\bacula-sd.tmp >nul +sed -e "s;C:\\Temp;%CD:\=/%/tmp;g" tmp\bacula-sd.tmp >%CD%\bin\bacula-sd.conf + +REM get proper SD tape definitions +COPY %CD%\scripts\win32_tape_options %CD%\bin\tape_options >nul + +DEL %out% +DEL tmp\*.tmp diff --git a/regress/win32/scripts/exclude-dev-test b/regress/win32/scripts/exclude-dev-test new file mode 100644 index 0000000000..4165ea1ae7 --- /dev/null +++ b/regress/win32/scripts/exclude-dev-test @@ -0,0 +1,5 @@ +dev/ptmx +dev/pts +dev/rd/c5d2 +dev/rd +dev/shm diff --git a/regress/win32/scripts/exclude-etc-test b/regress/win32/scripts/exclude-etc-test new file mode 100644 index 0000000000..f59ca8df2a --- /dev/null +++ b/regress/win32/scripts/exclude-etc-test @@ -0,0 +1 @@ +etc/mail/statistics diff --git a/regress/win32/scripts/exclude-lib-test b/regress/win32/scripts/exclude-lib-test new file mode 100644 index 0000000000..5be32f443b --- /dev/null +++ b/regress/win32/scripts/exclude-lib-test @@ -0,0 +1,5 @@ +lib/ld-2.2.5.so +lib/libtermcap.so.2.0.8 +lib/libc-2.2.5.so +lib/libnsl-2.2.5.so +lib/libnss_files-2.2.5.so diff --git a/regress/win32/scripts/flist b/regress/win32/scripts/flist new file mode 100644 index 0000000000..87f103defe --- /dev/null +++ b/regress/win32/scripts/flist @@ -0,0 +1,23 @@ +/build/configure +/build/src/stored/bextract +/build/src/tools/testfind +/build/Makefile.in +/build/src/dird/bacula-dir +/build/src/console/bconsole +/build/src/filed/bacula-fd +/build/src/findlib/find_one.c +/build/src/jcr.h +/build/platforms/Makefile.in +/build/platforms/redhat/Makefile.in +/build/scripts/Makefile.in +/build/src/win32/filed/winservice.cpp +/build/src/filed/restore.c +/build/autoconf/configure.in +/build/examples/afs-bacula +/build/src/win32/Makefile.inc.in +/build/src/win32/installer/winbacula.nsi +/build/autoconf/configure.in +/build/src/version.h +/build/src/lib/message.c +/build/src/lib/bnet_server.c +/build/src/lib/libbac.a diff --git a/regress/win32/scripts/functions.cmd b/regress/win32/scripts/functions.cmd new file mode 100644 index 0000000000..1a03141c14 --- /dev/null +++ b/regress/win32/scripts/functions.cmd @@ -0,0 +1,131 @@ +REM +REM A set of useful functions to be sourced in each test +REM + +SET routine=%1 +SHIFT + +GOTO %routine% + +:start_test + ECHO. + ECHO. + ECHO === Starting %TestName% at %TIME% === + ECHO === Starting %TestName% at %TIME% === >>working\log + ECHO. + GOTO :EOF + +:set_debug + SET debug=%1 + IF "%debug%" EQU 1 ( + SET out=tee + ) ELSE ( + SET out=output + ) + GOTO :EOF + +:run_bacula + IF %debug% EQU 1 ( + CALL scripts\bacula start + bin\bconsole -c bin\bconsole.conf nul 2>&1 + bin\bconsole -c bin\bconsole.conf nul 2>&1 + ) + GOTO :EOF + +:run_bconsole + IF %debug% EQU 1 ( + bin\bconsole -c bin\bconsole.conf nul 2>&1 + ) + GOTO :EOF + +:run_btape + IF %debug% EQU 1 ( + bin\btape -c bin\bacula-sd.conf DDS-4 tmp\log1.out 2>&1 + ) + GOTO :EOF + +:run_bscan + IF %debug% EQU 1 ( + bin\bscan %1 %2 %3 %4 %5 %6 %7 %8 %9 | tools\tee tmp\log.out + ) ELSE ( + bin\bscan %1 %2 %3 %4 %5 %6 %7 %8 %9 >nul 2>&1 + ) + GOTO :EOF + +:stop_bacula + CALL scripts\bacula stop >nul 2>&1 + GOTO :EOF + +:check_for_zombie_jobs + CALL scripts\check_for_zombie_jobs %1 %2 + GOTO :EOF + +:change_jobname + IF "%2" == "" ( + SET oldname=NightlySave + SET newname=%1 + ) ELSE ( + SET oldname=%1 + SET newname=%2 + ) + IF EXIST bin\1 DEL /f bin\1 + REN bin\bacula-dir.conf 1 + bin\sed -e "s;%oldname%;%newname%;g" bin\1 >bin\bacula-dir.conf +REM ECHO Job %oldname% changed to %newname% + GOTO :EOF + +:check_two_logs + tools\grep "^ Termination: *Backup OK" tmp\log1.out >nul 2>&1 + SET bstat=%ERRORLEVEL% + tools\grep "^ Termination: *Restore OK" tmp\log2.out >nul 2>&1 + SET rstat=%ERRORLEVEL% + GOTO :EOF + +:check_restore_diff + tools\diff -r build tmp\bacula-restores\%CD::=%\build >nul 2>&1 + SET dstat=%ERRORLEVEL% + GOTO :EOF + +:check_restore_tmp_build_diff + tools\diff -r tmp\build tmp\bacula-restores\%CD::=%\tmp\build >nul 2>&1 + SET dstat=%ERRORLEVEL% + GOTO :EOF + +:end_test + SET /a errcount=%bstat% + %rstat% + %dstat% + IF %errcount% NEQ 0 ( + ECHO. + ECHO. + ECHO !!!!! %TestName% Bacula source failed!!! !!!!! + ECHO !!!!! %TestName% failed!!! !!!!! >>test.out + IF %dstat% NEQ 0 ( + ECHO !!!!! Restored files differ !!!!! + ECHO !!!!! Restored files differ !!!!! >>test.out + ) ELSE ( + ECHO !!!!! Bad Job termination status !!!!! + ECHO !!!!! Bad Job termination status !!!!! >>test.out + ) + ECHO. + ) ELSE ( + ECHO ===== %TestName% Bacula source OK %TIME% ===== + ECHO ===== %TestName% OK %TIME% ===== >>test.out + IF %debug% EQU 0 scripts\cleanup + ) + SET errcount= + GOTO :EOF + +:copy_tape_confs + CALL scripts\copy-tape-confs >nul 2>&1 + CALL scripts\cleanup-tape + GOTO :EOF + +:copy_test_confs + CALL scripts\copy-test-confs >nul 2>&1 + CALL scripts\cleanup + GOTO :EOF diff --git a/regress/win32/scripts/install_bacula.cmd b/regress/win32/scripts/install_bacula.cmd new file mode 100644 index 0000000000..fa7dad4af7 --- /dev/null +++ b/regress/win32/scripts/install_bacula.cmd @@ -0,0 +1,76 @@ +REM Arguments: +REM 1 = Debug or Release +REM 2 = email address +REM 3 = mail server +REM 4 = tape device +REM 5 = changer device or nul +REM 6 = tape1 device or nul + +SETLOCAL ENABLEDELAYEDEXPANSION + +SET CATS=create_sqlite3_database.cmd drop_sqlite3_database.cmd drop_sqlite3_tables.cmd grant_sqlite3_privileges.cmd make_sqlite3_catalog_backup.cmd make_sqlite3_tables.cmd + +SET CONFS=bacula-dir.conf.in bacula-fd.conf.in bacula-sd.conf.in bconsole.conf.in + +CALL scripts\bacula stop + +IF NOT EXIST bin MKDIR bin + +COPY build\src\win32\installer\%1\*.exe bin >nul +COPY build\src\win32\installer\%1\*.dll bin >nul +COPY build\src\win32\installer\%1\*.manifest bin >nul +COPY build\src\win32\%1\*.pdb bin >nul +COPY build\src\win32\installer\%1\query.sql bin >nul + +COPY bin\cats_sqlite.dll bin\bacula_cats.dll >nul + +FOR /f %%i IN ( 'cmd /c openssl.exe rand -base64 33 2^>nul' ) DO SET CLIENT_PASSWORD=%%i +FOR /f %%i IN ( 'cmd /c openssl.exe rand -base64 33 2^>nul' ) DO SET STORAGE_PASSWORD=%%i +FOR /f %%i IN ( 'cmd /c openssl.exe rand -base64 33 2^>nul' ) DO SET DIRECTOR_PASSWORD=%%i +FOR /f %%i IN ( 'cmd /c openssl.exe rand -base64 33 2^>nul' ) DO SET MONITOR_PASSWORD=%%i + +ECHO s;@director_name@;localhost-dir;g >install.sed +ECHO s;@director_port@;8101;g >>install.sed +ECHO s;@storage_name@;localhost-sd;g >>install.sed +ECHO s;@storage_port@;8103;g >>install.sed +ECHO s;@client_name@;localhost-fd;g >>install.sed +ECHO s;@client_port@;8102;g >>install.sed + +REM ECHO s;@DISTVER@;$R2; + +ECHO s;@working_dir@;%CD:\=\\\\%\\\\working;g >>install.sed +ECHO s;@working_dir_cmd@;%CD:\=\\%\\working;g >>install.sed +ECHO s;@bin_dir@;%CD:\=\\\\%\\\\bin;g >>install.sed; +ECHO s;@bin_dir_cmd@;%CD:\=\\%\\bin;g >>install.sed +ECHO s;@BUILD_DIR@;%CD:\=/%/build;g >>install.sed +ECHO s;@director_address@;localhost;g >>install.sed +ECHO s;@client_address@;localhost;g >>install.sed +ECHO s;@storage_address@;localhost;g >>install.sed +ECHO s;@client_maxjobs@;2;g >>install.sed +ECHO s;@client_password@;%CLIENT_PASSWORD%;g >>install.sed +ECHO s;@storage_maxjobs@;10;g >>install.sed +ECHO s;@storage_password@;%STORAGE_PASSWORD%;g >>install.sed +ECHO s;@director_maxjobs@;1;g >>install.sed +ECHO s;@director_password@;%DIRECTOR_PASSWORD%;g >>install.sed +ECHO s;@job_email@;%2;g >>install.sed +ECHO s;@smtp_host@;%3;g >>install.sed +ECHO s;@monitor_name@;localhost-mon;g >>install.sed +ECHO s;@monitor_password@;%MONITOR_PASSWORD%;g >>install.sed +ECHO s;@tape_drive@;%4;g >>install.sed +ECHO s;@autochanger@;%5;g >>install.sed +ECHO s;@changer_path@;%6;g >>install.sed +ECHO s;@tape_drive1@;%7;g >>install.sed + +FOR %%i in ( %CATS% ) DO ( + SET NAME=%%i + SET TARGET=bin\!NAME:sqlite3=bacula! + tools\sed -f install.sed build\src\win32\installer\%1\!NAME! > !TARGET! +) + +FOR %%i in ( %CONFS% ) DO tools\sed -f install.sed build\src\win32\installer\%%i > bin\%%~ni + +tools\sed -f install.sed build\src\win32\installer\%1\make_sqlite3_tables.sql > bin\make_sqlite3_tables.sql +tools\sed -f install.sed build\src\win32\installer\%1\mtx-changer.cmd > bin\mtx-changer.cmd + +CALL scripts\bacula uninstall +CALL scripts\bacula install %CD%\bin diff --git a/regress/win32/scripts/new-test-bacula-dir.conf.in b/regress/win32/scripts/new-test-bacula-dir.conf.in new file mode 100644 index 0000000000..bdb2da5665 --- /dev/null +++ b/regress/win32/scripts/new-test-bacula-dir.conf.in @@ -0,0 +1,311 @@ +# +# 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 1.33 +# +# 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 = 4 + Password = "pNvX1WiXnwv2C/F7E52LGvw6rKjbbPvu2kyuPa9pVaL3" # Console password + Messages = Standard +} + +# +# 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 = 4 + SpoolData=yes +} + +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 = 4 + Write Bootstrap = "@working_dir@/NightlySave.bsr" +} + +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 bacula" + # 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 = nul 2>&1 +MKDIR tmp\disk-changer diff --git a/regress/win32/scripts/prepare-two-tapes.cmd.in b/regress/win32/scripts/prepare-two-tapes.cmd.in new file mode 100644 index 0000000000..1bcd81898b --- /dev/null +++ b/regress/win32/scripts/prepare-two-tapes.cmd.in @@ -0,0 +1,13 @@ +REM +REM Create two blank tapes +REM +REM mt -f @tape_drive@ offline +@changer_path@ -f @autochanger@ unload +@changer_path@ -f @autochanger@ load 1 +mt -f @tape_drive@ rewind +mt -f @tape_drive@ weof +@changer_path@ -f @autochanger@ unload +@changer_path@ -f @autochanger@ load 2 +mt -f @tape_drive@ rewind +mt -f @tape_drive@ weof +REM @changer_path@ -f @autochanger@ unload diff --git a/regress/win32/scripts/setup.cmd b/regress/win32/scripts/setup.cmd new file mode 100644 index 0000000000..53df74dcfd --- /dev/null +++ b/regress/win32/scripts/setup.cmd @@ -0,0 +1,55 @@ +REM +REM Script to setup running Bacula regression tests +REM + +IF "%1" == "" GOTO :usage +IF "%2" == "" GOTO :usage +IF "%3" == "" GOTO :usage +IF "%4" == "" GOTO :usage +IF "%5" == "" GOTO :usage +IF "%6" == "" GOTO :usage +IF "%7" == "" GOTO :usage +GOTO :param_count_ok + +:usage +ECHO Incorrect number of arguments. +ECHO setup bacula-src build-type email-address smtp-host tape-device changer-device tape1-device +ECHO. +EXIT /b 1 + +:param_count_ok +RD /s /q build bin tmp working >nul 2>&1 +MKDIR tmp + +REM Copy new source +ECHO Copying source from %1 +SET SRC=%1 +FOR /r %1 %%i in ( debug release ) do IF EXIST %%i ECHO %%i | sed -e "s;%SRC:\=\\%\\;;" -e "/installer\\%2/d" -e "/win32\\%2/d" >>tmp\exclude_list +ECHO .bsc >>tmp\exclude_list +ECHO .ncb >>tmp\exclude_list + +XCOPY %1 build\ /EXCLUDE:tmp\exclude_list /e /q + +DEL build\src\win32\%2\winbacula*.exe + +CALL scripts\install_bacula %2 %3 %4 %5 %6 %7 + +CALL scripts\bacula stop >nul 2>&1 + +IF NOT EXIST working MKDIR working +ECHO Running database creation scripts +CALL bin\create_bacula_database +CALL bin\drop_bacula_tables +CALL bin\make_bacula_tables +CALL bin\grant_bacula_privileges + +REM Start and stop Bacula to ensure conf files are OK + +CALL scripts\bacula start +CALL scripts\bacula stop >nul 2>&1 + +REM +REM Save Bacula default conf files for later use +REM +COPY bin\*.conf scripts >nul +GOTO :EOF diff --git a/regress/win32/scripts/test-bacula-dir.conf.in b/regress/win32/scripts/test-bacula-dir.conf.in new file mode 100644 index 0000000000..93008cca82 --- /dev/null +++ b/regress/win32/scripts/test-bacula-dir.conf.in @@ -0,0 +1,312 @@ +# +# 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 1.33 +# +# 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 = 4 + 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 = 4 + SpoolData=yes +} + +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 = 4 + 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 bacula" + # 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 = nul 2>&1 +CALL scripts\prepare-two-disks + +CALL scripts\functions change_jobname localhost-fd %JobName% +CALL scripts\functions start_test + +ECHO %CD:\=/%/tmp/build >\tmp\file-list +IF NOT EXIST tmp\build MKDIR tmp\build +COPY build\src\dird\*.c tmp\build >nul 2>&1 + +ECHO %CD:\=/%/tmp/build/ficheriro1.txt>tmp\restore-list +ECHO %CD:\=/%/tmp/build/ficheriro2.txt>>tmp\restore-list + +REM Turn off Prefer Mounted Volumes so we use2 drives +COPY bin\bacula-dir.conf tmp\1 >nul 2>&1 +REM Comment the next line out to write everything to one drive +REM otherwise, it writes the two jobs to different drives +sed -e "s;# Prefer Mounted Volumes; Prefer Mounted Volumes;g" tmp\1 >bin\bacula-dir.conf + +REM Write out bconsole commands +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\2drive-incremental-2disk.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +ECHO ficheriro1.txt >tmp\build\ficheriro1.txt +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\2drive-incremental-2disk.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=DDS-4 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +REM The restore should read from TestVolume002, which was on drive 1 +grep TestVolume002 tmp\log2.out >nul 2>&1 +IF %ERRORLEVEL% NEQ 0 SET rstat=%ERRORLEVEL% + +REM +REM Delete .c files because we will only restored the txt files +REM +DEL tmp\build\*.c +CALL scripts\functions check_restore_tmp_build_diff + +CALL scripts\functions end_test diff --git a/regress/win32/tests/2drive-incremental-2tape b/regress/win32/tests/2drive-incremental-2tape new file mode 100644 index 0000000000..a301c1ca55 --- /dev/null +++ b/regress/win32/tests/2drive-incremental-2tape @@ -0,0 +1,112 @@ +#!/bin/sh +# +# 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 +# +. config.out +if test x${TAPE_DRIVE1} = x/dev/null ; then + echo "Skipping 2drive-incremenatal-2tape test. No second drive." + exit +fi +TestName="2drive-incremental-2tape" +JobName="2drive2tape" +. scripts/functions +set_debug 0 + +cwd=`pwd` + +scripts/copy-2drive-confs +scripts/cleanup-2drive + +change_jobname localhost-fd $JobName + +echo "${cwd}/tmp/build" >/tmp/file-list +if test ! -d ${cwd}/tmp/build ; then + mkdir ${cwd}/tmp/build +fi +cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build +cd ${cwd}/tmp +echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list +echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list +cd ${cwd} + +# Turn off Prefer Mounted Volumes so we use 2 drives +outf="tmp/sed_tmp" +echo "s%# Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf} +cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1 +# Comment the next line out to write everything to one drive +# otherwise, it writes the two jobs to different drives +sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf + +start_test + +# Write out bconsole commands +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=1 +@#setdebug level=100 storage=DDS-4 +run job=NightlySave yes +run job=NightlySave yes +run job=NightlySave yes +run job=NightlySave yes +run job=NightlySave yes +@sleep 3 +status storage=DDS-4 +wait +list volumes +list jobs +status storage=DDS-4 +messages +quit +END_OF_DATA + +run_bacula + +echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt +echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +@# Force Incremental on the second Volume +update volume=TestVolume001 VolStatus=Used +status storage=DDS-4 +@#setdebug level=400 storage=DDS-4 +run level=Incremental job=NightlySave yes +wait +list volumes +status storage=DDS-4 +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores +7 +<${cwd}/tmp/restore-list + +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +# +# Delete .c files because we will only restored the txt files +# +rm -f tmp/build/*.c +check_restore_tmp_build_diff + +end_test diff --git a/regress/win32/tests/auto-label-test.bscr b/regress/win32/tests/auto-label-test.bscr new file mode 100644 index 0000000000..c33c0a6a42 --- /dev/null +++ b/regress/win32/tests/auto-label-test.bscr @@ -0,0 +1,35 @@ +@output nul +messages +@@out@ tmp/log1.out +status all +status all +list pools +messages +@#setdebug level=110 storage=File +run job=@JobName@ storage=File yes +list pools +list volumes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +count +ls * +dir * +find Makefile +pwd +lsmark +estimate +? +help +done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/auto-label-test.cmd b/regress/win32/tests/auto-label-test.cmd new file mode 100644 index 0000000000..218ded6d07 --- /dev/null +++ b/regress/win32/tests/auto-label-test.cmd @@ -0,0 +1,27 @@ +REM +REM Test if Bacula can automatically create a Volume label. +REM + +SET TestName=auto-label-test +SET JobName=AutoLabel + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +COPY bin\bacula-dir.conf tmp\1 +sed -e "s;# Label Format; Label Format;" tmp\1 >bin\bacula-dir.conf + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\auto-label-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/backup-bacula-tape b/regress/win32/tests/backup-bacula-tape new file mode 100644 index 0000000000..21d521d563 --- /dev/null +++ b/regress/win32/tests/backup-bacula-tape @@ -0,0 +1,117 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape then restore it, we do that twice to ensure that +# we can correctly append to a tape. +# We also use the purge and the relabel commands as +# well as a pile of status storage commands. +# +TestName="backup-bacula-tape" +JobName=backuptape +. scripts/functions +set_debug 0 + +scripts/copy-tape-confs +scripts/cleanup-tape + +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + + +# Write out bconsole commands +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +@#setdebug level=200 storage=DDS-4 +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +purge volume=TestVolume001 +relabel pool=Default storage=DDS-4 oldVolume=TestVolume001 volume=TestVolume002 slot=0 +purge volume=TestVolume002 +relabel pool=Default storage=DDS-4 oldVolume=TestVolume002 volume=TestVolume001 slot=0 +run job=$JobName yes +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +@sleep 1 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +@sleep 1 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +@sleep 1 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +@sleep 1 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +status storage=DDS-4 +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +list volumes +messages +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +# +# Now do a second backup after making a few changes +# +touch ${cwd}/build/src/dird/*.c +echo "test test" > ${cwd}/build/src/dird/xxx + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +list volumes +run job=$JobName yes +wait +list volumes +messages +@# +@# now do a second restore +@# +@$out tmp/log2.out +list volumes +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +list volumes +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/backup-bacula-test.bscr b/regress/win32/tests/backup-bacula-test.bscr new file mode 100644 index 0000000000..c6c22e9dae --- /dev/null +++ b/regress/win32/tests/backup-bacula-test.bscr @@ -0,0 +1,36 @@ +@output nul +messages +@@out@ tmp/log1.out +label volume=TestVolume001 +@#setdebug level=100 storage=File +run job=@JobName@ yes +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +@sleep 1 +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +@sleep 1 +status storage=File +status storage=File +status storage=File +status storage=File +status storage=File +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/backup-bacula-test.cmd b/regress/win32/tests/backup-bacula-test.cmd new file mode 100644 index 0000000000..dafec1d622 --- /dev/null +++ b/regress/win32/tests/backup-bacula-test.cmd @@ -0,0 +1,24 @@ +REM +REM Run a simple backup of the Bacula build directory +REM then restore it. +REM + +SET TestName=backup-bacula-test +SET JobName=backup +CALL scripts\functions set_debug 0 + +CALL scripts\cleanup +CALL scripts\copy-confs >nul 2>&1 + +CALL scripts\functions change_jobname Client1 %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\backup-bacula-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/backup-win32-tape b/regress/win32/tests/backup-win32-tape new file mode 100644 index 0000000000..f6f6c3b0c0 --- /dev/null +++ b/regress/win32/tests/backup-win32-tape @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape then restore it, we do that twice to ensure that +# we can correctly append to a tape. +# +TestName="backup-win32-tape" +JobName=backupwintape +. scripts/functions +set_debug 0 + +scripts/cleanup-tape +scripts/copy-win32-confs + +echo "${cwd}/build" >/tmp/file-list + +change_jobname $JobName +start_test + + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=NightlySave yes +@sleep 10 +status storage=DDS-4 +@sleep 30 +messages +wait +messages +@# +@# now do a restore +@# +@$outt tmp/log2.out +@#restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +@#yes +@#wait +@#messages +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/bextract-test.bscr b/regress/win32/tests/bextract-test.bscr new file mode 100644 index 0000000000..fc050c7416 --- /dev/null +++ b/regress/win32/tests/bextract-test.bscr @@ -0,0 +1,19 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File1 volume=TestVolume001 +label storage=File1 volume=TestVolume002 +update Volume=TestVolume001 MaxVolBytes=3000000 +run job=@JobName@ storage=File1 yes +wait +messages +@# +@# now build the bsr file +@# +@@out@ tmp/log2.out +restore bootstrap=@topdir@/tmp/restore.bsr where=@topdir@/tmp/bacula-restores select all storage=File1 done +no +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/bextract-test.cmd b/regress/win32/tests/bextract-test.cmd new file mode 100644 index 0000000000..7c0f6380c0 --- /dev/null +++ b/regress/win32/tests/bextract-test.cmd @@ -0,0 +1,29 @@ +REM +REM Run a simple backup of the Bacula build directory but +REM split the archive into two volumes, then build a BSR with +REM the restore command and use bextract to restore the files. +REM +SET TestName=bextract-test +SET JobName=bextract + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\bextract-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +MKDIR %CD%\tmp\bacula-restores +bin\bextract -b tmp/restore.bsr -c bin/bacula-sd.conf %CD:\=/%/tmp %CD:\=/%/tmp/bacula-restores 2>&1 >nul +SET rstat=%ERRORLEVEL% +grep "^ Termination: *Backup OK" tmp\log1.out 2>&1 >nul +SET bstat=%ERRORLEVEL% +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/bscan-fast-tape b/regress/win32/tests/bscan-fast-tape new file mode 100644 index 0000000000..fcb7e921ba --- /dev/null +++ b/regress/win32/tests/bscan-fast-tape @@ -0,0 +1,89 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then backup four times, each with incremental then +# do a bscan and restore. +# It should require at least 4 different bsrs. +# +TestName="bscan-tape" +JobName=bscantape +. scripts/functions +set_debug 1 + +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list + +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +# sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +setdebug level=2 storage=DDS-4 +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName yes +wait +messages +quit +END_OF_DATA + +echo "Starting Bacula tape writing" +#bin/btape -c bin/bacula-sd.conf /dev/nst0 </dev/null 2>&1 +./make_bacula_tables >/dev/null 2>&1 +./grant_bacula_privileges 2>&1 >/dev/null +cd .. + +echo "Begin attempt to read tape that crashes the system" +echo "volume=TestVolume001" >tmp/bscan.bsr +strace -o strace.new bin/bscan -d200 -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 +exit +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log2.out +@# +@# now do a restore +@# +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula +rm -f ${cwd}/build/src/lib/dummy + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/bscan-tape b/regress/win32/tests/bscan-tape new file mode 100644 index 0000000000..7f7e708c1e --- /dev/null +++ b/regress/win32/tests/bscan-tape @@ -0,0 +1,142 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then backup four times, each with incremental then +# do a bscan and restore. +# It should require at least 4 different bsrs. +# +TestName="bscan-tape" +JobName=bscantape +. scripts/functions +set_debug 0 + +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list + +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +estimate job=$JobName listing +estimate job=$JobName listing +estimate job=$JobName listing +messages +@$out tmp/log1.out +setdebug level=2 storage=DDS-4 +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName yes +wait +run job=$JobName level=Full yes +wait +run job=$JobName level=Full yes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 + +echo "Backup 1 done" +# make some files for the incremental to pick up +touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o + +# +# run a second job +# +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Incremental yes +wait +messages +quit +END_OF_DATA + +run_bacula +scripts/check_for_zombie_jobs storage=DDS-4 + +echo "Backup 2 done" +touch ${cwd}/build/src/dird/*.c +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o +# +# run a third job +# +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Incremental yes +wait +messages +quit +END_OF_DATA + +run_bacula +scripts/check_for_zombie_jobs storage=DDS-4 + +echo "Backup 3 done" +# make some files for the incremental to pick up +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o +#echo "abc" > ${cwd}/build/src/lib/dummy +# +# run a fourth job +# +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Incremental yes +wait +messages +quit +END_OF_DATA + +run_bacula + +scripts/check_for_zombie_jobs storage=DDS-4 +stop_bacula + +echo "Backup 4 done" +# +# now drop and recreate the database +# +cd bin +./drop_bacula_tables >/dev/null 2>&1 +./make_bacula_tables >/dev/null 2>&1 +./grant_bacula_privileges 2>&1 >/dev/null +cd .. + +echo "volume=TestVolume001" >tmp/bscan.bsr +bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf DDS-4 2>&1 >/dev/null + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log2.out +@# +@# now do a restore +@# +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula +rm -f ${cwd}/build/src/lib/dummy + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/bscan-test.1.bscr b/regress/win32/tests/bscan-test.1.bscr new file mode 100644 index 0000000000..2ed6803e27 --- /dev/null +++ b/regress/win32/tests/bscan-test.1.bscr @@ -0,0 +1,24 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=File1 +TestVolume001 +label storage=File1 +TestVolume002 +update Volume=TestVolume001 MaxVolBytes=3000000 +run job=@JobName@ storage=File1 +yes +wait +messages +@@out@ nul +@# +@# now purge the Volume +@# +purge volume=TestVolume001 +purge volume=TestVolume002 +delete volume=TestVolume001 +yes +delete volume=TestVolume002 +yes +messages +quit diff --git a/regress/win32/tests/bscan-test.2.bscr b/regress/win32/tests/bscan-test.2.bscr new file mode 100644 index 0000000000..9e80679312 --- /dev/null +++ b/regress/win32/tests/bscan-test.2.bscr @@ -0,0 +1,13 @@ +@@out@ nul +messages +@@out@ tmp/log2.out +@# +@# now do a restore +@# +@#setdebug level=400 storage=File1 +restore bootstrap=@topdir@/tmp/bscan.bsr where=@topdir@/tmp/bacula-restores select all storage=File1 done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/bscan-test.cmd b/regress/win32/tests/bscan-test.cmd new file mode 100644 index 0000000000..754305fdcc --- /dev/null +++ b/regress/win32/tests/bscan-test.cmd @@ -0,0 +1,42 @@ +REM +REM Run a simple backup of the Bacula build directory but +REM split the archive into two volumes then bscan it +REM into the catalog after the backup. It also to a limited +REM extent tests the purge volume and delete volume commands. +REM + +SET TestName=bscan-test +SET JobName=bscan + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +echo %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\bscan-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +echo volume=TestVolume001^|TestVolume002 >tmp\bscan.bsr + +IF %debug% EQU 1 ( + bin\bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf %CD:\=/%/tmp | tools\tee tmp\log.out +) ELSE ( + bin\bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf %CD:\=/%/tmp >nul 2>&1 +) + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\bscan-test.2.bscr >tmp\bconcmds + +REM now run restore +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/bsr-opt-test.bscr b/regress/win32/tests/bsr-opt-test.bscr new file mode 100644 index 0000000000..1f0576b930 --- /dev/null +++ b/regress/win32/tests/bsr-opt-test.bscr @@ -0,0 +1,24 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=File1 volume=TestVolume001 +label storage=File1 volume=TestVolume002 +update Volume=TestVolume001 MaxVolBytes=3000000 +run job=@JobName@ storage=File1 yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore bootstrap=@topdir@/working/restore.bsr where=@topdir@/tmp/bacula-restores select storage=File1 +unmark * +cd @topdir@/build/src/cats +mark * +ls +done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/bsr-opt-test.cmd b/regress/win32/tests/bsr-opt-test.cmd new file mode 100644 index 0000000000..9f816ab084 --- /dev/null +++ b/regress/win32/tests/bsr-opt-test.cmd @@ -0,0 +1,57 @@ +REM +REM Run a simple backup of the Bacula build directory but +REM split the archive into two volumes, then restore +REM files on only one of the volumes and ensure that +REM the other volume is not used. I.e. bsr optimization +REM works. +REM +SET TestName=bsr-opt-test +SET JobName=bsr-opt + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\bsr-opt-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula +REM +REM This test is not really reliable. What we want to do is +REM to select files on only one Volume, then insure here +REM that only one Volume is chosen. +REM +grep TestVolume002 working\restore.bsr >nul 2>&1 +SET bsrstat=%ERRORLEVEL% +CALL scripts\functions check_two_logs + +diff -r build\src\cats tmp\bacula-restores\%CD::=%\build\src\cats >nul 2>&1 +SET /A errcount = %bsrstat% + %bstat% + %rstat% +IF %errcount% NEQ 0 ( + ECHO. + ECHO. + ECHO !!!!! bsr-opt-test Bacula source failed!!! !!!!! + ECHO !!!!! bsr-opt-test failed!!! !!!!! >>test.out + + SET /A errcount = %bstat% + %rstat% + IF %errcount% NEQ 0 ( + ECHO !!!!! Bad Job termination status !!!!! + ECHO !!!!! Bad Job termination status !!!!! >>test.out + ) ELSE IF %bsrstat% NEQ 0 ( + ECHO !!!!! Volume selection error !!!!! + ECHO !!!!! Volume selection error !!!!! >>test.out + ) ELSE ( + ECHO !!!!! Restored files differ !!!!! + ECHO !!!!! Restored files differ !!!!! >>test.out + ) + ECHO. +) ELSE ( + ECHO ===== bsr-opt-test Bacula source OK %TIME% ===== + ECHO ===== bsr-opt-test OK %TIME% ===== >>test.out + CALL scripts\cleanup +) diff --git a/regress/win32/tests/btape-fill-full-tape b/regress/win32/tests/btape-fill-full-tape new file mode 100644 index 0000000000..f4ba59fb5b --- /dev/null +++ b/regress/win32/tests/btape-fill-full-tape @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Test the fill command in btape +# +TestName="btape-fill-full-tape" +JobName=AutoLabel +. scripts/functions +set_debug 0 + +scripts/copy-tape-confs +scripts/cleanup-tape + +change_jobname $JobName +start_test + +bin/btape -c bin/bacula-sd.conf DDS-4 <&1 >tmp/log1.out +fill +s + +quit +END_OF_DATA + + +grep "^The last block on the tape matches\. Test succeeded\." tmp/log1.out 2>&1 >/dev/null +if [ $? != 0 ] ; then + echo " " + echo " " + echo " !!!!! btape fill test failed!!! !!!!! " + echo " !!!!! btape fill test failed!!! !!!!! " >>test.out + echo " " +else + echo " ===== btape fill test OK ===== " + echo " ===== btape fill test OK ===== " >>test.out +# scripts/cleanup +fi diff --git a/regress/win32/tests/btape-fill-tape b/regress/win32/tests/btape-fill-tape new file mode 100644 index 0000000000..b3fb4e5afd --- /dev/null +++ b/regress/win32/tests/btape-fill-tape @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Test the fill command in btape +# +TestName="btape-fill-tape" +JobName=filltape +. scripts/functions +set_debug 0 + +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list + +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed "s%# MaximumVolumeSize% MaximumVolumeSize%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +start_test + +cat <tmp/bconcmds +fill +s +quit +END_OF_DATA + +run_btape DDS-4 + +grep "^The last block on the tape matches\. Test succeeded\." tmp/log1.out 2>&1 >/dev/null +if [ $? != 0 ] ; then + echo " " + echo " " + echo " !!!!! btape fill test failed!!! !!!!! " + echo " !!!!! btape fill test failed!!! !!!!! " >>test.out + echo " " +else + echo " ===== btape fill test OK ===== " + echo " ===== btape fill test OK ===== " >>test.out +# scripts/cleanup +fi diff --git a/regress/win32/tests/compressed-test.bscr b/regress/win32/tests/compressed-test.bscr new file mode 100644 index 0000000000..d46459f878 --- /dev/null +++ b/regress/win32/tests/compressed-test.bscr @@ -0,0 +1,23 @@ +@output +messages +@@out@ tmp/log1.out +status all +status all +messages +label storage=File volume=TestVolume001 +run job=@JobName@ storage=File yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/compressed-test.cmd b/regress/win32/tests/compressed-test.cmd new file mode 100644 index 0000000000..bff606925a --- /dev/null +++ b/regress/win32/tests/compressed-test.cmd @@ -0,0 +1,24 @@ +REM +REM Run a simple backup of the Bacula build directory using the compressed option +REM then restore it. +REM +SET TestName=compressed-test +SET JobName=compressed + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +echo %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\compressed-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/concurrent-jobs-test.bscr b/regress/win32/tests/concurrent-jobs-test.bscr new file mode 100644 index 0000000000..1799fd6e0b --- /dev/null +++ b/regress/win32/tests/concurrent-jobs-test.bscr @@ -0,0 +1,23 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ level=Full yes +run job=@JobName@ level=Full yes +run job=@JobName@ level=Full yes +run job=@JobName@ level=Full yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/concurrent-jobs-test.cmd b/regress/win32/tests/concurrent-jobs-test.cmd new file mode 100644 index 0000000000..9c36b48c7e --- /dev/null +++ b/regress/win32/tests/concurrent-jobs-test.cmd @@ -0,0 +1,35 @@ +REM +REM Run two jobs at the same time +REM + +SET TestName=concurrent-jobs-test +SET JobName=concurrent-jobs + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/tmp/largefile >\tmp\file-list +ECHO Creating a 50MB file with bacula-dir data ... +tools\dd if=bin/bacula-dir.exe of=%CD:\=/%/tmp/1 bs=1024 count=512 >nul 2>&1 +COPY /b %CD%\tmp\1+%CD%\tmp\1+%CD%\tmp\1+%CD%\tmp\1 %CD%\tmp\2 >nul 2>&1 +DEL %CD%\tmp\1 +COPY /b %CD%\tmp\2+%CD%\tmp\2+%CD%\tmp\2+%CD%\tmp\2+%CD%\tmp\2 %CD%\tmp\3 >nul 2>&1 +DEL %CD%\tmp\2 +COPY /b %CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3 %CD%\tmp\largefile >nul 2>&1 +DEL %CD%\tmp\3 + +ECHO largefile created + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\concurrent-jobs-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +diff tmp\largefile tmp\bacula-restores\%CD::=%\tmp\largefile >nul 2>&1 +SET dstat=%ERRORLEVEL% +CALL scripts\functions end_test diff --git a/regress/win32/tests/dev-test-root b/regress/win32/tests/dev-test-root new file mode 100644 index 0000000000..26ae6fee84 --- /dev/null +++ b/regress/win32/tests/dev-test-root @@ -0,0 +1,85 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +MUID=`/usr/bin/id -u` +if [ $MUID != 0 ] ; then + echo " " + echo "You must be root to run this test." + echo " ===== !!!! dev-test-root not run !!!! ===== " + echo " ===== !!!! dev-test-root not run !!!! ===== " >>test.out + echo " " + exit 1 +fi +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +echo "/dev" >/tmp/file-list + +echo " " +echo " " +echo " === Starting dev-test-root test ===" +echo " " +echo " === Note, this test can fail for trivial ===" +echo " === reasons on non-Linux systems. ===" +echo " " +echo " " + +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cd / +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original +cd ${cwd}/tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored +cd ${cwd}/tmp +# +# Use sed to cut out parts that *always* change +# +cat >sed.scr <1 +sed -f sed.scr 1 | sort >original +# +mv -f restored 1 +sed -f sed.scr 1 | sort >restored +rm -f sed.scr +# +cd ${cwd} +diff tmp/original tmp/restored 2>&1 1>/dev/null +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== !!!! dev-test-root failed !!!! ===== " + echo " ===== !!!! dev-test-root failed !!!! ===== " >>test.out + echo " " +else + echo " ===== dev-test-root OK ===== " + echo " ===== dev-test-root OK ===== " >>test.out + scripts/cleanup +fi diff --git a/regress/win32/tests/differential-test.1.bscr b/regress/win32/tests/differential-test.1.bscr new file mode 100644 index 0000000000..5b23122bdc --- /dev/null +++ b/regress/win32/tests/differential-test.1.bscr @@ -0,0 +1,9 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume002 +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/differential-test.2.bscr b/regress/win32/tests/differential-test.2.bscr new file mode 100644 index 0000000000..c8ddb49849 --- /dev/null +++ b/regress/win32/tests/differential-test.2.bscr @@ -0,0 +1,9 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +@# Force differential on the second Volume +update volume=TestVolume002 VolStatus=Used +run level=differential job=@JobName@ yes +wait +messages +@@out@ diff --git a/regress/win32/tests/differential-test.3.bscr b/regress/win32/tests/differential-test.3.bscr new file mode 100644 index 0000000000..3d2b98e26b --- /dev/null +++ b/regress/win32/tests/differential-test.3.bscr @@ -0,0 +1,16 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +run level=incremental job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores storage=File file=<@topdir@/tmp/restore-list +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/differential-test.cmd b/regress/win32/tests/differential-test.cmd new file mode 100644 index 0000000000..6ffdff055c --- /dev/null +++ b/regress/win32/tests/differential-test.cmd @@ -0,0 +1,48 @@ +REM +REM Run a simple backup of the Bacula build directory then create some +REM new files, do a differential and restore those two files. +REM +SET TestName=differential-test +SET JobName=differential + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/tmp/build >\tmp\file-list +MKDIR tmp\build +COPY build\src\dird\*.c tmp\build >nul 2>&1 + +ECHO %CD:\=/%/tmp/build/ficheriro1.txt>tmp\restore-list +ECHO %CD:\=/%/tmp/build/ficheriro2.txt>>tmp\restore-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\differential-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO ficheriro1.txt >tmp\build\ficheriro1.txt +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\differential-test.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +CALL scripts\functions check_for_zombie_jobs storage=File +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\differential-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +REM +REM Delete .c files because we will only restore the txt files +REM +DEL tmp\build\*.c +CALL scripts\functions check_restore_tmp_build_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/eot-fail-tape b/regress/win32/tests/eot-fail-tape new file mode 100644 index 0000000000..4907e8dca6 --- /dev/null +++ b/regress/win32/tests/eot-fail-tape @@ -0,0 +1,51 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to two tapes where the maximum tape file size is set to 1M +# +TestName="eot-fail-tape" +JobName=eotfailtape +. scripts/functions +set_debug 0 + +scripts/cleanup-tape +scripts/copy-tape-confs + +echo "${cwd}/build" >/tmp/file-list + +out="tmp/sed_tmp" +echo "s%# Maximum File Size% Maximum File Size%g" >${out} +cp -f ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed -f ${out} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +update Volume=TestVolume001 MaxVolBytes=3000000 +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@tee +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/etc-test-root b/regress/win32/tests/etc-test-root new file mode 100644 index 0000000000..e3a4495b88 --- /dev/null +++ b/regress/win32/tests/etc-test-root @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +MUID=`/usr/bin/id -u` +if [ $MUID != 0 ] ; then + echo " " + echo "You must be root to run this test." + echo " ===== !!!! etc-test-root not run !!!! ===== " + echo " ===== !!!! etc-test-root not run !!!! ===== " >>test.out + echo " " + exit 1 +fi +echo " " +echo " " +echo " === Starting /etc save/restore test ===" +echo " " +echo " " +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +echo "/etc" >/tmp/file-list + +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cd / +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/1 +cd ${cwd}/tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/2 +sort <${cwd}/tmp/1 >${cwd}/tmp/original +sort <${cwd}/tmp/2 >${cwd}/tmp/restored +rm -f ${cwd}/tmp/1 ${cwd}/tmp/2 +cd ${cwd} +diff tmp/original tmp/restored 2>&1 1>/dev/null +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== !!!! etc-test-root failed !!!! ===== " + echo " ===== !!!! etc-test-root failed !!!! ===== " >>test.out + echo " " +else + echo " ===== etc-test-root OK ===== " + echo " ===== etc-test-root OK ===== " >>test.out + scripts/cleanup +fi diff --git a/regress/win32/tests/filed-crypto-test b/regress/win32/tests/filed-crypto-test new file mode 100644 index 0000000000..0189624767 --- /dev/null +++ b/regress/win32/tests/filed-crypto-test @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Run a simple backup (with encryption) of the Bacula build directory +# then verify the signatures. +# +TestName="filed-crypto-test" +JobName=Crypto +. scripts/functions +set_debug 0 + +scripts/cleanup +scripts/copy-crypto-confs +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +setdebug level=1 storage=File sd +label storage=File volume=TestVolume001 +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores storage=File +5 +mark * +done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +sleep 2 +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/fixed-block-size-tape b/regress/win32/tests/fixed-block-size-tape new file mode 100644 index 0000000000..10de2c45e5 --- /dev/null +++ b/regress/win32/tests/fixed-block-size-tape @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape where we set the minimum and maximum block +# sizes. +# +TestName="fixed-block-size-tape" +JobName=fixedblocksize +. scripts/functions +set_debug 0 + +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list + +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +echo "s%# Maximum Block Size% Maximum Block Size%" >${cwd}/tmp/2 +echo "s%# Minimum Block Size% Minimum Block Size%" >>${cwd}/tmp/2 +sed -f ${cwd}/tmp/2 ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf +if [ $? != 0 ] ; then + echo " " + echo " " + echo "!!!! sed problem in Fixed Block Size test !!!!!" + echo " " + exit 1 +fi +rm -f ${cwd}/tmp/1 ${cwd}/tmp/2 + +change_jobname NightlySave $JobName +start_test + + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DDS-4 +unmark * +mark * +done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/four-concurrent-jobs-tape b/regress/win32/tests/four-concurrent-jobs-tape new file mode 100644 index 0000000000..0d0918f62b --- /dev/null +++ b/regress/win32/tests/four-concurrent-jobs-tape @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Run four jobs at the same time +# +TestName="four-concurrent-jobs-tape" +JobName=FourConcurrentJobs +. scripts/functions +set_debug 0 + +scripts/cleanup-tape +scripts/copy-tape-confs + +echo "${cwd}/build" >/tmp/file-list + +change_jobname $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName level=Full Storage=DDS-4 yes +run job=$JobName level=Full Storage=DDS-4 yes +run job=$JobName level=Full Storage=DDS-4 yes +run job=$JobName level=Full Storage=DDS-4 yes +@sleep 2 +status dir +@sleep 5 +status dir +status storage=DDS-4 +messages +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DDS-4 +unmark * +mark * +done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/four-concurrent-jobs-test.bscr b/regress/win32/tests/four-concurrent-jobs-test.bscr new file mode 100644 index 0000000000..cdae631049 --- /dev/null +++ b/regress/win32/tests/four-concurrent-jobs-test.bscr @@ -0,0 +1,50 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File1 +TestVolume001 +label storage=File1 +TestVolume002 +update Volume=TestVolume001 MaxVolBytes=100000000 +@#50000000 +@#12 +run job=@JobName@ level=Full Storage=File1 +yes +reload +run job=@JobName@ level=Full Storage=File1 +yes +reload +run job=@JobName@ level=Full Storage=File1 +yes +reload +run job=@JobName@ level=Full Storage=File1 +yes +reload +reload +reload +reload +@sleep 2 +status dir +reload +@sleep 5 +messages +reload +reload +wait +reload +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File1 +unmark * +mark * +done +yes +wait +reload +reload +messages +@output +quit diff --git a/regress/win32/tests/four-concurrent-jobs-test.cmd b/regress/win32/tests/four-concurrent-jobs-test.cmd new file mode 100644 index 0000000000..0530baa8f0 --- /dev/null +++ b/regress/win32/tests/four-concurrent-jobs-test.cmd @@ -0,0 +1,23 @@ +REM +REM Run two jobs at the same time +REM +SET TestName=four-concurrent-jobs-test +SET JobName=Four-concurrent-jobs + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\four-concurrent-jobs-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/four-jobs-tape b/regress/win32/tests/four-jobs-tape new file mode 100644 index 0000000000..4252ba2d7e --- /dev/null +++ b/regress/win32/tests/four-jobs-tape @@ -0,0 +1,153 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then backup four times, each with incremental then finally restore. +# It should require at least 4 different bsrs. +# +TestName="four-jobs-tape" +JobName=fourjobstape +. scripts/functions +set_debug 0 + +scripts/cleanup-tape +scripts/copy-tape-confs +echo "${cwd}/build" >/tmp/file-list + +change_jobname $JobName +start_test + +cat <tmp/bconcmds +@$out /dev/null +estimate job=$JobName listing +estimate job=$JobName listing +estimate job=$JobName listing +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName yes +wait +messages +quit +END_OF_DATA +if test "$debug" -eq 1 ; then + bin/bacula start + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf +else + bin/bacula start 2>&1 >/dev/null + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null +fi + +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 1 done" +# make some files for the incremental to pick up +touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o + +# +# run a second job +# +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Incremental yes +wait +messages +quit +END_OF_DATA +if test "$debug" -eq 1 ; then + bin/bacula start + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf +else + bin/bacula start 2>&1 >/dev/null + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null +fi + +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 2 done" +touch ${cwd}/build/src/dird/*.c +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o +# +# run a third job +# +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Incremental yes +wait +messages +quit +END_OF_DATA +if test "$debug" -eq 1 ; then + bin/bacula start + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf +else + bin/bacula start 2>&1 >/dev/null + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null +fi + +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 3 done" +# make some files for the incremental to pick up +touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o +# +# run a fourth job +# +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Incremental yes +wait +messages +quit +END_OF_DATA +if test "$debug" -eq 1 ; then + bin/bacula start + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf +else + bin/bacula start 2>&1 >/dev/null + cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null +fi + +scripts/check_for_zombie_jobs storage=DDS-4 +echo "Backup 4 done" +# +# now do several restores to ensure we cleanup between jobs +# +cat <tmp/bconcmds +@$out /dev/null +restore where=${cwd}/tmp/bacula-restores select all done +yes +wait +restore where=${cwd}/tmp/bacula-restores select all done +yes +wait +@$out tmp/log2.out +@# +@# now unmount the tape and start two restores +@# at the same time +@# +unmount storage=DDS-4 +restore where=${cwd}/tmp/bacula-restores select all done +yes +restore where=${cwd}/tmp/bacula-restores select +unmark * +mark * +done +yes +mount storage=DDS-4 +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/four-jobs-test.1.bscr b/regress/win32/tests/four-jobs-test.1.bscr new file mode 100644 index 0000000000..462c2545f8 --- /dev/null +++ b/regress/win32/tests/four-jobs-test.1.bscr @@ -0,0 +1,11 @@ +@output nul +estimate job=@JobName@ listing +estimate job=@JobName@ listing +estimate job=@JobName@ listing +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/four-jobs-test.2.bscr b/regress/win32/tests/four-jobs-test.2.bscr new file mode 100644 index 0000000000..02fdc49786 --- /dev/null +++ b/regress/win32/tests/four-jobs-test.2.bscr @@ -0,0 +1,8 @@ +@output nul +messages +@@out@ tmp/log1.out +run job=@JobName@ +yes +wait +messages +quit diff --git a/regress/win32/tests/four-jobs-test.3.bscr b/regress/win32/tests/four-jobs-test.3.bscr new file mode 100644 index 0000000000..6da93295f1 --- /dev/null +++ b/regress/win32/tests/four-jobs-test.3.bscr @@ -0,0 +1,8 @@ +@output nul +messages +@output tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/four-jobs-test.4.bscr b/regress/win32/tests/four-jobs-test.4.bscr new file mode 100644 index 0000000000..6da93295f1 --- /dev/null +++ b/regress/win32/tests/four-jobs-test.4.bscr @@ -0,0 +1,8 @@ +@output nul +messages +@output tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/four-jobs-test.5.bscr b/regress/win32/tests/four-jobs-test.5.bscr new file mode 100644 index 0000000000..30bf4a7053 --- /dev/null +++ b/regress/win32/tests/four-jobs-test.5.bscr @@ -0,0 +1,17 @@ +@output nul +restore where=@topdir@/tmp/bacula-restores select all storage=File done +yes +wait +restore where=@topdir@/tmp/bacula-restores select all storage=File done +yes +wait +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/four-jobs-test.cmd b/regress/win32/tests/four-jobs-test.cmd new file mode 100644 index 0000000000..7978a7e2ed --- /dev/null +++ b/regress/win32/tests/four-jobs-test.cmd @@ -0,0 +1,74 @@ +REM +REM Run a simple backup of the Bacula build directory using the compressed option +REM then backup four times, each with incremental then finally restore. +REM It should require at least 4 different bsrs. +REM +SET TestName=four-jobs-test +SET JobName=SpanVol + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >/tmp/file-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\four-jobs-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO Backup 1 done + +REM make some files for the incremental to pick up +tools\touch %CD:\=/%/build/src/dird/*.c +tools\touch %CD:\=/%/build/src/lib/*.c + +REM +REM run a second job +REM +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\four-jobs-test.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO Backup 2 done + +tools\touch %CD:\=/%/build/src/dird/*.c +tools\touch %CD:\=/%/build/src/lib/*.c + +REM +REM run a third job +REM +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\four-jobs-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO Backup 3 done + +REM make some files for the incremental to pick up +tools\touch %CD:\=/%/build/src/lib/*.c + +REM +REM run a fourth job +REM +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\four-jobs-test.4.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO Backup 4 done +REM +REM now do several restores to ensure we cleanup between jobs +REM +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\four-jobs-test.5.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/hardlink-test b/regress/win32/tests/hardlink-test new file mode 100644 index 0000000000..42e38bcdde --- /dev/null +++ b/regress/win32/tests/hardlink-test @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +TestName="hardlink-test" +JobName=hardlink +. scripts/functions +set_debug 0 + +if test ! -d weird-files ; then + echo " " + echo "Weird files not configured. Test not run." + exit 0 +fi + +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +change_jobname NightlySave $JobName +# +# Note, we save the weird-files directory twice on purpose +# because this causes problems with hard linked files +# that are only saved once. In 1.33, Bacula now deals +# with this situation. +# +echo "${cwd}/weird-files" >/tmp/file-list +echo "${cwd}/weird-files" >>/tmp/file-list + +start_test + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +label storage=File +TestVolume001 +run job=$JobName +yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores storage=File +5 +cd ${cwd}/weird-files/subdir +mark another-hardlink +done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +diff ${cwd}/weird-files/subdir/another-hardlink \ + ${cwd}/tmp/bacula-restores/${cwd}/weird-files/subdir/another-hardlink 2>&1 >/dev/null +dstat=$? +end_test diff --git a/regress/win32/tests/incremental-2disk.1.bscr b/regress/win32/tests/incremental-2disk.1.bscr new file mode 100644 index 0000000000..fdbc4a7615 --- /dev/null +++ b/regress/win32/tests/incremental-2disk.1.bscr @@ -0,0 +1,9 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=0 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/incremental-2disk.2.bscr b/regress/win32/tests/incremental-2disk.2.bscr new file mode 100644 index 0000000000..76032d1a1d --- /dev/null +++ b/regress/win32/tests/incremental-2disk.2.bscr @@ -0,0 +1,21 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +@# Force Incremental on the second Volume +update volume=TestVolume001 VolStatus=Used +run level=Incremental job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores +7 +<@topdir@/tmp/restore-list + +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/incremental-2disk.cmd b/regress/win32/tests/incremental-2disk.cmd new file mode 100644 index 0000000000..a51fc8ad05 --- /dev/null +++ b/regress/win32/tests/incremental-2disk.cmd @@ -0,0 +1,55 @@ +REM +REM Run a simple backup of the Bacula build directory then create some +REM new files, do an Incremental and restore those two files. +REM +REM This script uses the virtual disk autochanger +REM +SET TestName=incremental-2disk +SET JobName=Inc2disk + +CALL scripts\functions set_debug 0 + +CALL config_out + +CALL scripts\functions stop_bacula + +CALL bin\drop_bacula_tables >nul 2>&1 +CALL bin\make_bacula_tables >nul 2>&1 +CALL bin\grant_bacula_privileges >nul 2>&1 + +CALL scripts\copy-2disk-confs >nul 2>&1 +CALL scripts\prepare-two-disks + +ECHO %CD:\=/%/tmp/build >\tmp\file-list +IF NOT EXIST tmp\build MKDIR tmp\build + +COPY build\src\dird\*.c tmp\build >nul 2>&1 +ECHO %CD:\=/%/tmp/build/ficheriro1.txt>tmp\restore-list +ECHO %CD:\=/%/tmp/build/ficheriro2.txt>>tmp\restore-list + +CALL scripts\functions change_jobname %JobName% +CALL scripts\functions start_test + +REM Write out bconsole commands +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-2disk.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula + +ECHO ficheriro1.txt >tmp\build\ficheriro1.txt +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt + + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-2disk.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula +REM +REM Delete .c files because we will only restored the txt files +REM +DEL tmp\build\*.c + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_tmp_build_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/incremental-2tape.1.bscr b/regress/win32/tests/incremental-2tape.1.bscr new file mode 100644 index 0000000000..b5fa189e47 --- /dev/null +++ b/regress/win32/tests/incremental-2tape.1.bscr @@ -0,0 +1,9 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Default drive=0 +run job=NightlySave yes +wait +messages +quit diff --git a/regress/win32/tests/incremental-2tape.2.bscr b/regress/win32/tests/incremental-2tape.2.bscr new file mode 100644 index 0000000000..f57357f747 --- /dev/null +++ b/regress/win32/tests/incremental-2tape.2.bscr @@ -0,0 +1,21 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +@# Force Incremental on the second Volume +update volume=TestVolume001 VolStatus=Used +run level=Incremental job=NightlySave yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores +7 +<@topdir@/tmp/restore-list + +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/incremental-2tape.cmd b/regress/win32/tests/incremental-2tape.cmd new file mode 100644 index 0000000000..2a646a0edd --- /dev/null +++ b/regress/win32/tests/incremental-2tape.cmd @@ -0,0 +1,48 @@ +REM +REM Run a simple backup of the Bacula build directory then create some +REM new files, do an Incremental and restore those two files. +REM +REM This script uses the autochanger and two tapes +REM +SET TestName=incremental-2tape +SET JobName=inctwotape +CALL scripts\functions set_debug 0 + +CALL config_out +IF "%AUTOCHANGER%" == "nul" ( + ECHO incremental-2tape test skipped. No autochanger. + EXIT +) + +CALL scripts\functions stop_bacula +CALL drop_bacula_tables >nul 2>&1 +CALL make_bacula_tables >nul 2>&1 +CALL grant_bacula_privileges >nul 2>&1 + +CALL scripts\copy-2tape-confs +CALL scripts\cleanup-2tape +ECHO %CD:\=/%/tmp/build >\tmp\file-list +IF NOT EXIST tmp\build MKDIR tmp\build +COPY build\src\dird\*.c tmp\build +ECHO %CD:\=/%/tmp/build/ficheriro1.txt>tmp\restore-list +ECHO %CD:\=/%/tmp/build/ficheriro2.txt>>tmp\restore-list + +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-2tape.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula + +ECHO ficheriro1.txt >tmp\build\ficheriro1.txt +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-2tape.2.bscr >tmp\bconcmds +CALL scripts\functions run_bconsole +CALL scripts\bacula stop_bacula +CALL scripts\bacula check_two_logs +REM +REM Delete .c files because we will only restore the txt files +REM +DEL tmp\build\*.c +CALL scripts\bacula check_restore_tmp_build_diff +CALL scripts\bacula end_test diff --git a/regress/win32/tests/incremental-tape b/regress/win32/tests/incremental-tape new file mode 100644 index 0000000000..3b7264da77 --- /dev/null +++ b/regress/win32/tests/incremental-tape @@ -0,0 +1,76 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then create some +# new files, do an Incremental and restore those two files. +# +TestName="incremental-tape" +JobName=IncTape +. scripts/functions +set_debug 0 + +copy_tape_confs + +echo "${cwd}/tmp/build" >/tmp/file-list +if test ! -d ${cwd}/tmp/build ; then + mkdir ${cwd}/tmp/build +fi +cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build +cd ${cwd}/tmp +echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list +echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list +cd ${cwd} + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName yes +wait +messages +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 + +echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt +echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +run level=Incremental job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores storage=DDS-4 +7 +<${cwd}/tmp/restore-list + +yes +wait +messages +@output +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +# +# Delete .c files because we will only restored the txt files +# +rm -f tmp/build/*.c + +check_two_logs +check_restore_tmp_build_diff +end_test diff --git a/regress/win32/tests/incremental-test.1.bscr b/regress/win32/tests/incremental-test.1.bscr new file mode 100644 index 0000000000..9ab38bffe0 --- /dev/null +++ b/regress/win32/tests/incremental-test.1.bscr @@ -0,0 +1,9 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +label storage=File volume=TestVolume002 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/incremental-test.2.bscr b/regress/win32/tests/incremental-test.2.bscr new file mode 100644 index 0000000000..f716a022c8 --- /dev/null +++ b/regress/win32/tests/incremental-test.2.bscr @@ -0,0 +1,9 @@ +@output nul +messages +@@out@ tmp/log1.out +@# Force Incremental on the second Volume +update volume=TestVolume001 VolStatus=Used +run level=Differential job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/incremental-test.3.bscr b/regress/win32/tests/incremental-test.3.bscr new file mode 100644 index 0000000000..c4239dd0a3 --- /dev/null +++ b/regress/win32/tests/incremental-test.3.bscr @@ -0,0 +1,7 @@ +@output nul +messages +@@out@ tmp/log1.out +run level=Incremental job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/incremental-test.4.bscr b/regress/win32/tests/incremental-test.4.bscr new file mode 100644 index 0000000000..700afcb8d4 --- /dev/null +++ b/regress/win32/tests/incremental-test.4.bscr @@ -0,0 +1,7 @@ +@output nul +messages +@@out@ tmp/log1.out +run level=Differential job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/incremental-test.5.bscr b/regress/win32/tests/incremental-test.5.bscr new file mode 100644 index 0000000000..1f093f18ef --- /dev/null +++ b/regress/win32/tests/incremental-test.5.bscr @@ -0,0 +1,16 @@ +@output nul +messages +@@out@ tmp/log1.out +run level=Incremental job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@output tmp/log2.out +restore where=@topdir@/tmp/bacula-restores storage=File file=<@topdir@/tmp/restore-list +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/incremental-test.cmd b/regress/win32/tests/incremental-test.cmd new file mode 100644 index 0000000000..3bc0ac92f9 --- /dev/null +++ b/regress/win32/tests/incremental-test.cmd @@ -0,0 +1,91 @@ +REM +REM Run a simple backup of the Bacula build directory then create some +REM new files, do an Incremental and restore those two files. +REM +SET TestName=incremental-test +SET JobName=Incremental + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/tmp/build>/tmp/file-list + +MKDIR tmp\build +COPY build\src\dird\*.c tmp\build >nul 2>&1 + +ECHO %CD:\=/%/tmp/build/ficheriro1.txt>tmp\restore-list +ECHO %CD:\=/%/tmp/build/ficheriro2.txt>>tmp\restore-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +REM +REM Now create two new files to be restored later +REM +bin\bsleep 1 +ECHO ficheriro1.txt >tmp\build\ficheriro1.txt +COPY tmp\build\dird.c tmp\build\ficheriro2.txt >nul 2>&1 + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +bin\bsleep 1 +touch tmp\build\ficheriro1.txt +touch tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +bin\bsleep 1 + +COPY tmp\build\ficheriro2.txt tmp\build\1 >nul 2>&1 +sed -e "s;a;b;g" tmp\build\1 >tmp\build\ficheriro2.txt +DEL tmp\build\1 + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.4.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +bin\bsleep 1 +touch tmp\build\ficheriro1.txt +touch tmp\build\ficheriro2.txt +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +bin\bsleep 1 +touch tmp\build\ficheriro1.txt +touch tmp\build\ficheriro2.txt +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole + +bin\bsleep 1 +touch tmp\build\ficheriro1.txt +touch tmp\build\ficheriro2.txt +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +bin\bsleep 1 +touch tmp\build\ficheriro1.txt +touch tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\incremental-test.5.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +REM +REM Delete .c files because we will only restored the txt files +REM +DEL tmp\build\*.c +CALL scripts\functions check_restore_tmp_build_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/lib-tape-root b/regress/win32/tests/lib-tape-root new file mode 100644 index 0000000000..06289cd1d4 --- /dev/null +++ b/regress/win32/tests/lib-tape-root @@ -0,0 +1,67 @@ +#!/bin/sh +# +# Run a simple backup of the /lib directory +# then restore it. +# +cwd=`pwd` +bin/bacula stop 2>&1 >/dev/null +cd bin +./drop_bacula_tables >/dev/null 2>&1 +./make_bacula_tables >/dev/null 2>&1 +./grant_bacula_privileges 2>&1 >/dev/null +cd .. + +scripts/cleanup-tape +scripts/copy-tape-confs +echo "/lib" >/tmp/file-list +echo " " +echo " " +echo " === Starting lib-tape-root test ===" +echo " " +echo " " +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cd / +${cwd}/bin/testls -e ${cwd}/scripts/exclude-usr-test lib >${cwd}/tmp/original +cd ${cwd}/tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-usr-test lib >${cwd}/tmp/restored +cd ${cwd}/tmp +sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1 +sort <1 >original +# +sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1 +sort <1 >restored +rm -f 1 +# +cd ${cwd} +diff tmp/original tmp/restored 2>&1 1>/dev/nul +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== lib-tape-root failed!!! ===== " + echo " ===== lib-tape-root failed!!! ===== " >>test.out + echo " " +else + echo " ===== lib-tape-root OK ===== " + echo " ===== lib-tape-root OK ===== " >>test.out + scripts/cleanup +fi diff --git a/regress/win32/tests/lib-test-root b/regress/win32/tests/lib-test-root new file mode 100644 index 0000000000..4f41954a29 --- /dev/null +++ b/regress/win32/tests/lib-test-root @@ -0,0 +1,76 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +MUID=`/usr/bin/id -u` +if [ $MUID != 0 ] ; then + echo " " + echo "You must be root to run this test." + echo " ===== !!!! lib-test-root not run !!!! ===== " + echo " ===== !!!! lib-test-root not run !!!! ===== " >>test.out + echo " " + exit 1 +fi +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +echo "/lib" >/tmp/file-list + +echo " " +echo " " +echo " === Starting /lib save/restore test ===" +echo " " +echo " " + +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cd / +${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/original +cd ${cwd}/tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored +cd ${cwd}/tmp +sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1 +sort <1 >original +# +sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1 +sort <1 >restored +rm -f 1 +# +cd ${cwd} +diff tmp/original tmp/restored 2>&1 1>/dev/nul +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== !!!! lib-test-root failed !!!! ===== " + echo " ===== !!!! lib-test-root failed !!!! ===== " >>test.out + echo " " +else + echo " ===== lib-test-root OK ===== " + echo " ===== lib-test-root OK ===== " >>test.out + scripts/cleanup +fi diff --git a/regress/win32/tests/migration-job-test b/regress/win32/tests/migration-job-test new file mode 100644 index 0000000000..d243c99712 --- /dev/null +++ b/regress/win32/tests/migration-job-test @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then migrate it +# to another device. +# +# This script uses the virtual disk autochanger +# +TestName="migration-job-test" +JobName=MigrationJobSave +. scripts/functions +set_debug 0 + +. config.out + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-two-disks +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +# +# Note, we first backup into Pool Default, +# then Migrate into Pool Full. +# Pool Default uses Storage=File +# Pool Full uses Storage=DiskChanger + +# Write out bconsole commands +cat <tmp/bconcmds +@output +messages +@$out tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 +label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 +list volumes +@# run two jobs (both will be migrated) +run job=$JobName yes +run job=$JobName yes +wait +list volumes +@# should migrate two jobs +run job=migrate-job yes +list volumes +wait +messages +wait +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/migration-jobspan-test b/regress/win32/tests/migration-jobspan-test new file mode 100644 index 0000000000..838cb00b28 --- /dev/null +++ b/regress/win32/tests/migration-jobspan-test @@ -0,0 +1,80 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then migrate it +# to another device. +# +# Test migrating a job that spans two Volumes +# +# This script uses the virtual disk autochanger +# +TestName="migration-jobspan-test" +JobName=MigrationJobSpanSave +. scripts/functions +set_debug 0 + +. config.out + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-two-disks +echo "${cwd}/build" >/tmp/file-list +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + + +change_jobname NightlySave $JobName +start_test + +# +# Note, we first backup into Pool Default, +# then Migrate into Pool Full. +# Pool Default uses Storage=File +# Pool Full uses Storage=DiskChanger + +# Write out bconsole commands +cat <tmp/bconcmds +@output +messages +@$out tmp/log1.out +@#setdebug level=100 dir +@#setdebug level=100 storage=File +label storage=File volume=FileVolume001 Pool=Default +label storage=File volume=FileVolume002 Pool=Default +update Volume=FileVolume001 MaxVolBytes=3000000 pool=Default +label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 +label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 +list volumes +@# +run job=$JobName yes +@#run job=$JobName yes +wait +list volumes +@# should migrate both Volumes +run job=migrate-job yes +wait +list volumes +list jobs +messages +wait +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/migration-occupancy-test b/regress/win32/tests/migration-occupancy-test new file mode 100644 index 0000000000..e5c9e35f78 --- /dev/null +++ b/regress/win32/tests/migration-occupancy-test @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then migrate it +# to another device. +# +# This script uses the virtual disk autochanger +# +TestName="migration-occupancy-test" +JobName=MigrationJobSave +. scripts/functions +set_debug 0 + +. config.out + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-two-disks +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +# +# Note, we first backup into Pool Default, +# then Migrate into Pool Full. +# Pool Default uses Storage=File +# Pool Full uses Storage=DiskChanger + +# Write out bconsole commands +cat <tmp/bconcmds +@output +messages +@$out tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 +label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 +list volumes +@# run two jobs (both will be migrated) +run job=$JobName yes +run job=$JobName yes +wait +update volume=FileVolume001 VolStatus=Used +list volumes +@# should migrate two jobs +run job=migrate-occupancy yes +list volumes +wait +messages +wait +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/migration-time-test b/regress/win32/tests/migration-time-test new file mode 100644 index 0000000000..0b574264c1 --- /dev/null +++ b/regress/win32/tests/migration-time-test @@ -0,0 +1,78 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory then migrate it +# to another device. +# +# This script uses the virtual disk autochanger +# +TestName="migration-time-test" +JobName=MigrationJobSave +. scripts/functions +set_debug 0 + +. config.out + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-two-disks +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +# +# Note, we first backup into Pool Default, +# then Migrate into Pool Full. +# Pool Default uses Storage=File +# Pool Full uses Storage=DiskChanger + +# Write out bconsole commands +cat <tmp/bconcmds +@output +messages +@$out tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 +label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 +list volumes +@# run three jobs +run job=$JobName level=Full yes +run job=$JobName level=Full yes +run job=$JobName level=Full yes +wait +update volume=FileVolume001 VolStatus=Used +sql +update Job SET RealEndTime='2004-01-01 12:01:01' WHERE JobId IN (2,3); + +llist jobid=2,3 +list jobs +list volumes +@# should migrate only jobid=2 and 3 +run job=migrate-time yes +wait +messages +wait +list jobs +list volumes +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/migration-volume-test b/regress/win32/tests/migration-volume-test new file mode 100644 index 0000000000..e2d66b60da --- /dev/null +++ b/regress/win32/tests/migration-volume-test @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Run a backup of the Bacula build directory on two Volumes +# then migrate it to another device. +# +# This script uses the virtual disk autochanger +# +TestName="migration-volume-test" +JobName=MigVolBackup +. scripts/functions +set_debug 0 + +. config.out + +scripts/cleanup +scripts/copy-migration-confs +scripts/prepare-two-disks +echo "${cwd}/build" >/tmp/file-list +#cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +#sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname NightlySave $JobName +start_test + +# +# Note, we first backup into Pool Default, +# then Migrate into Pool Full. +# Pool Default uses Storage=File +# Pool Full uses Storage=DiskChanger + +# Write out bconsole commands +cat <tmp/bconcmds +@output +messages +@$out tmp/log1.out +label storage=File volume=FileVolume001 Pool=Default +label storage=File volume=FileVolume002 Pool=Default +update Volume=FileVolume001 MaxVolBytes=3000000 pool=Default +label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0 +label storage=DiskChanger volume=ChangerVolume002 slot=2 Pool=Full drive=0 +list volumes +@# +run job=$JobName yes +wait +run job=$JobName yes +wait +update volume=FileVolume001 VolStatus=Used +update volume=FileVolume002 VolStatus=Used +list volumes +@# should migrate two jobs +@# setdebug level=11 dir +run job=migrate-volume yes +list volumes +@sleep 3 +status storage=DiskChanger +@sleep 1 +status storage=DiskChanger +@sleep 1 +status storage=DiskChanger +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/query-test.1.bscr b/regress/win32/tests/query-test.1.bscr new file mode 100644 index 0000000000..9ab38bffe0 --- /dev/null +++ b/regress/win32/tests/query-test.1.bscr @@ -0,0 +1,9 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +label storage=File volume=TestVolume002 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/query-test.2.bscr b/regress/win32/tests/query-test.2.bscr new file mode 100644 index 0000000000..9e1afb7dfb --- /dev/null +++ b/regress/win32/tests/query-test.2.bscr @@ -0,0 +1,9 @@ +@output nul +messages +@@out@ tmp/log1.out +@# Force differental on the second Volume +update volume=TestVolume001 VolStatus=Used +run level=differental job=@JobName@ yes +wait +messages +@output diff --git a/regress/win32/tests/query-test.3.bscr b/regress/win32/tests/query-test.3.bscr new file mode 100644 index 0000000000..266f6a4ff7 --- /dev/null +++ b/regress/win32/tests/query-test.3.bscr @@ -0,0 +1,46 @@ +@output nul +messages +@@out@ tmp/log1.out +run level=incremental job=@JobName@ yes +wait +messages +@# +@# Now do the queries +@# +query +1 +ficheriro1.txt +query +2 +@topdir@/tmp/build/ +ficheriro1.txt +localhost-fd +query +6 +TestVolume001 +query +7 +1 +query +8 +localhost-fd +query +9 +Default +query +10 +query +11 +query +12 +1 +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores storage=File file=<@topdir@/tmp/restore-list +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/query-test.cmd b/regress/win32/tests/query-test.cmd new file mode 100644 index 0000000000..d919bbea87 --- /dev/null +++ b/regress/win32/tests/query-test.cmd @@ -0,0 +1,48 @@ +REM +REM Run a simple backup of the Bacula build directory then create some +REM new files, do a Differental then a bunch of query commands +REM and finally restore the two files. +REM +SET TestName=query-test +SET JobName=query + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/tmp/build >\tmp\file-list +MKDIR tmp\build +COPY build\src\dird\*.c tmp\build >nul 2>&1 +ECHO %CD:\=/%/tmp/build/ficheriro1.txt>tmp\restore-list +ECHO %CD:\=/%/tmp/build/ficheriro2.txt>>tmp\restore-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\query-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO ficheriro1.txt >tmp\build\ficheriro1.txt +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\query-test.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO ficheriro2.txt >tmp\build\ficheriro2.txt +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\query-test.3.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +REM +REM Delete .c files because we will only restored the txt files +REM +DEL tmp\build\*.c + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_tmp_build_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/recycle-test.bscr b/regress/win32/tests/recycle-test.bscr new file mode 100644 index 0000000000..734cc7e9d3 --- /dev/null +++ b/regress/win32/tests/recycle-test.bscr @@ -0,0 +1,51 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File1 volume=TestVolume001 +label storage=File1 volume=TestVolume002 +label storage=File1 volume=TestVolume003 +update Volume=TestVolume001 volretention=10s +update Volume=TestVolume001 maxvoljobs=1 +update Volume=TestVolume002 volretention=10s +update Volume=TestVolume002 maxvoljobs=1 +update Volume=TestVolume003 volretention=10s +update Volume=TestVolume003 maxvoljobs=1 +list volumes +run job=@JobName@ storage=File1 level=full yes +wait +messages +list volumes +run job=@JobName@ storage=File1 level=full yes +wait +messages +list volumes +run job=@JobName@ storage=File1 level=full yes +wait +messages +list volumes +@sleep 10 +run job=@JobName@ storage=File1 level=full yes +wait +messages +list volumes +run job=@JobName@ storage=File1 level=full yes +wait +messages +list volumes +run job=@JobName@ storage=File1 level=full yes +wait +messages +list volumes +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File1 +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/recycle-test.cmd b/regress/win32/tests/recycle-test.cmd new file mode 100644 index 0000000000..b006fe482f --- /dev/null +++ b/regress/win32/tests/recycle-test.cmd @@ -0,0 +1,26 @@ +REM +REM Run a simple backup of the Bacula build directory but +REM create three volumes and do six backups causing the +REM volumes to be recycled, and cycling through the volumes +REM twice. Tests maxvoljobs and volretention. +REM +SET TestName=recycle-test +SET JobName=Recycle + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\recycle-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/relabel-tape b/regress/win32/tests/relabel-tape new file mode 100644 index 0000000000..2a1ce858c7 --- /dev/null +++ b/regress/win32/tests/relabel-tape @@ -0,0 +1,94 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory using the compressed option +# then backup four times, each with incremental then finally restore. +# It should require at least 4 different bsrs. +# +TestName="relabel-tape" +JobName=Relabeltape +. scripts/functions +set_debug 0 + +scripts/cleanup-tape +scripts/copy-tape-confs +echo "${cwd}/build" >/tmp/file-list + +change_jobname $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName level=Full yes +wait +messages +add pool=Default +0 +TestVolume002 +@# set status to append +update volume=TestVolume001 +1 +. +run job=NightlySave level=Full yes +@sleep 20 +unmount +unmount +purge volume=TestVolume001 +relabel oldvolume=TestVolume001 volume=TestVolume003 slot=0 pool=Default +list volumes +mount +messages +wait +run job=$JobName level=Full yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 + + +echo "Backup done" +# +# now do several restores to ensure we cleanup between jobs +# +cat <tmp/bconcmds +@$out /dev/null +restore where=${cwd}/tmp/bacula-restores select all done +yes +wait +restore where=${cwd}/tmp/bacula-restores select all done +yes +wait +@$out tmp/log2.out +@# +@# now unmount the tape and start two restores +@# at the same time +@# +unmount storage=DDS-4 +restore where=${cwd}/tmp/bacula-restores select all done +yes +restore where=${cwd}/tmp/bacula-restores select +unmark * +mark * +done +yes +mount storage=DDS-4 +wait +messages +@$out +quit +END_OF_DATA + +run_bconsole + +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/restore-by-file-tape b/regress/win32/tests/restore-by-file-tape new file mode 100644 index 0000000000..98827959f5 --- /dev/null +++ b/regress/win32/tests/restore-by-file-tape @@ -0,0 +1,101 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape where the maximum tape file size is set to 1M +# then restore a few files from it. Note, by setting the maximum +# file size to 1M, it runs very slow. There are about 64 files that +# are created during each of the two backups. +# +TestName="restore-by-file-tape" +JobName=restorebyfile +. scripts/functions +set_debug 0 +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list +sed s%\^%${cwd}% ${cwd}/scripts/flist >${cwd}/tmp/restore2-list + +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +run job=$JobName level=Full yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores storage=DDS-4 file=<${cwd}/tmp/restore2-list +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +dstat=0 +# +# We need to stop and start Bacula to +# test appending to a previously written tape +# +for i in `cat ${cwd}/tmp/restore2-list`; do + diff $i ${cwd}/tmp/bacula-restores$i + if [ $? != 0 ] ; then + dstat=1 + fi +done + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +run job=$JobName level=Full yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores +7 +<${cwd}/tmp/restore2-list + +yes +wait +messages +@output +quit +END_OF_DATA + +# +# Bacula was stopped, but we must restart it to +# test appending to a previously written tape +# +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs + +scripts/check_for_zombie_jobs storage=DDS-4 +bin/bacula stop 2>&1 >/dev/null +for i in `cat ${cwd}/tmp/restore2-list`; do + diff $i ${cwd}/tmp/bacula-restores$i + if [ $? != 0 ] ; then + dstat=1 + fi +done + +end_test diff --git a/regress/win32/tests/restore-by-file-test.bscr b/regress/win32/tests/restore-by-file-test.bscr new file mode 100644 index 0000000000..ad4053aed4 --- /dev/null +++ b/regress/win32/tests/restore-by-file-test.bscr @@ -0,0 +1,20 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores storage=File +7 +<@topdir@/tmp/restore-list + +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/restore-by-file-test.cmd b/regress/win32/tests/restore-by-file-test.cmd new file mode 100644 index 0000000000..669196648a --- /dev/null +++ b/regress/win32/tests/restore-by-file-test.cmd @@ -0,0 +1,30 @@ +REM +REM Run a simple backup of the Bacula build directory using the compressed option +REM then restore it. +REM + +SET TestName=restore-by-file-test +SET JobName=restorebyfile + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/tmp/build >\tmp\file-list +MKDIR tmp\build +COPY build\src\dird\*.c tmp\build >nul 2>&1 +DIR /b tmp\build >tmp\1 +sed -e "s;^;%CD:\=/%/tmp/build/;" tmp\1 >tmp\restore-list +DEL tmp\1 + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\restore-by-file-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_tmp_build_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/restore-disk-seek-test.bscr b/regress/win32/tests/restore-disk-seek-test.bscr new file mode 100644 index 0000000000..a6f4ef68a6 --- /dev/null +++ b/regress/win32/tests/restore-disk-seek-test.bscr @@ -0,0 +1,23 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +sql +select * from JobMedia; + +restore bootstrap=@topdir@/tmp/rbn.bsr where=@topdir@/tmp/bacula-restores storage=File +7 +<@topdir@/tmp/restore-list + +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/restore-disk-seek-test.cmd b/regress/win32/tests/restore-disk-seek-test.cmd new file mode 100644 index 0000000000..9bdb24ff45 --- /dev/null +++ b/regress/win32/tests/restore-disk-seek-test.cmd @@ -0,0 +1,52 @@ +REM +REM Run a backup of the full bacula build directory, but with the +REM Maximum File Size set. Then do a restore of a few files to kick in +REM disk seeking (not yet enabled), and ensure that the restored files +REM match. Even though disk seeking is not yet enabled, this is a good test, +REM and once it is enabled, this will test it. +REM +SET TestName=restore-disk-seek-test +SET JobName=restore-disk-seek + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/tmp/build >\tmp\file-list + +IF EXIST tmp\build RD /s /q tmp\build +MKDIR tmp\build + +REM Copy only the .c files (to be restored) +COPY build\src\dird\*.c tmp\build >nul 2>&1 +DIR /b tmp\build >tmp\1 +sed -e "s;^;%CD:\=/%/tmp/build/;" tmp\1 >tmp\restore-list + +REM At this point restore-list contains the list +REM of files we will restore +DEL tmp\1 + +REM Now backup *everything* +IF EXIST tmp\build RD /s /q tmp\build +MKDIR tmp\build +COPY build\src\dird\* tmp\build >nul 2>&1 +REM Enable MaximumFileSize +COPY bin\bacula-sd.conf tmp\1 >nul 2>&1 +sed "s;# Maximum File Size; Maximum File Size;" tmp\1 >bin\bacula-sd.conf + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\restore-disk-seek-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +REM Now setup a control directory of only what we *should* restore +RD /s /q tmp\build +MKDIR tmp\build +COPY build\src\dird\*.c tmp\build >nul 2>&1 + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_tmp_build_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/restore2-by-file-test.bscr b/regress/win32/tests/restore2-by-file-test.bscr new file mode 100644 index 0000000000..12d2d8fd4b --- /dev/null +++ b/regress/win32/tests/restore2-by-file-test.bscr @@ -0,0 +1,17 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores storage=File file=<@topdir@/tmp/restore2-list +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/restore2-by-file-test.cmd b/regress/win32/tests/restore2-by-file-test.cmd new file mode 100644 index 0000000000..cba7ea35b1 --- /dev/null +++ b/regress/win32/tests/restore2-by-file-test.cmd @@ -0,0 +1,31 @@ +REM +REM Run a simple backup of the Bacula build directory using the compressed option +REM then restore a few selected files. +REM +SETLOCAL ENABLEDELAYEDEXPANSION +SET TestName=restore2-by-file-test +SET JobName=restore2byfile + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list +sed -e "s;^;%CD:\=/%;" scripts/flist >tmp\restore2-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\restore2-by-file-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +SET dstat=0 +FOR /f %%i IN ( tmp\restore2-list ) DO ( + SET SUBDIR=%%i + diff %%i tmp/bacula-restores/!SUBDIR::=! + IF %ERRORLEVEL% NEQ 0 SET dstat=1 +) +CALL scripts\functions end_test diff --git a/regress/win32/tests/runscript-test b/regress/win32/tests/runscript-test new file mode 100644 index 0000000000..77212621fc --- /dev/null +++ b/regress/win32/tests/runscript-test @@ -0,0 +1,90 @@ +#!/bin/sh +# +# Test if Bacula can automatically create a Volume label. +# + +TestName="runscript-test" + +. scripts/functions +set_debug 0 +copy_test_confs + +rm -f bin/bacula-dir.conf +/bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf + +echo "${cwd}/build" >/tmp/file-list + +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +label volume=TestVolume001 +@#setdebug level=100 storage=File +@output tmp/log.RUN2.out +run job=RUN_FD_WARNING yes +wait +@sleep 5 +messages +run job=RUN_ALL_OK yes +wait +@sleep 5 +messages +run job=RUN_FD_FAILED yes +wait +@sleep 5 +messages +run job=RUN_DIR_FAILED yes +wait +@sleep 5 +messages +st dir +quit +END_OF_DATA + + +bin/bacula start +cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> tmp/log.RUN1.out + +stop_bacula + +if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/log.RUN1.out && + grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/log.RUN1.out && + grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/log.RUN1.out && + grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/log.RUN1.out +then + [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok +else + echo "RUN_ALL_OK in error" + rstat=1 +fi + +if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/log.RUN1.out && + grep -q 'dir: BeforeJob: RunAfterFailedJob' tmp/log.RUN1.out && + true # grep -q 'Backup OK -- with warnings' tmp/log.RUN1.out +then + [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok +else + echo "RUN_DIR_FAILED in error" + rstat=1 +fi + +if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/log.RUN1.out && + grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/log.RUN1.out && + grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/log.RUN1.out +then + [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok +else + echo "RUN_FD_FAILED in error" + rstat=1 +fi + +if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/log.RUN1.out && + grep -q 'Backup OK -- with warnings' tmp/log.RUN1.out +then + [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok +else + echo "RUN_FD_WARNING in error" + rstat=1 +fi + diff --git a/regress/win32/tests/scratch-pool-test.bscr b/regress/win32/tests/scratch-pool-test.bscr new file mode 100644 index 0000000000..9170fb7c60 --- /dev/null +++ b/regress/win32/tests/scratch-pool-test.bscr @@ -0,0 +1,25 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 pool=Scratch drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 pool=Scratch drive=0 +update Volume=TestVolume001 MaxVolBytes=2000000 pool=Scratch drive=0 +update Volume=TestVolume001 inchanger=no pool=Scratch drive=0 +@#setdebug level=200 storage=DDS-4 +llist volume=TestVolume001 +llist volume=TestVolume002 +run job=@JobName@ yes +wait +messages +list volumes +llist volume=TestVolume001 +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/scratch-pool-test.cmd b/regress/win32/tests/scratch-pool-test.cmd new file mode 100644 index 0000000000..d8e88f400c --- /dev/null +++ b/regress/win32/tests/scratch-pool-test.cmd @@ -0,0 +1,45 @@ +REM +REM Run a simple backup of the Bacula build directory +REM to two tapes where the maximum tape file size is set to 1M +REM Note, this test simulates the tape filling and writing to +REM the next tape. One minor wrinkle: we create the two tapes +REM in the Scratch pool, so they should be switched to the Default +REM Pool automatically. +REM We set TestVolume001 to not in the changer, so the algorithm +REM should find TestVolume002 and use it rather than blocking. +REM +REM Note we use the viritual disk autochanger +REM +SET TestName=scratch-pool-test +SET JobName=scratch-pool + +CALL scripts\functions set_debug 0 + +CALL config_out +IF "%AUTOCHANGER%" == "nul" ( + ECHO two-volume-test skipped. No autochanger. + EXIT /b 1 +) + +CALL scripts\cleanup +CALL scripts\copy-2disk-confs >nul 2>&1 +CALL scripts\prepare-two-disks + +ECHO %CD:\=/%/build >\tmp\file-list + +COPY bin\bacula-sd.conf tmp\1 >nul 2>&1 +sed -e "s;# Maximum File Size; Maximum File Size;g" tmp\1 >bin\bacula-sd.conf + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +REM Write out bconsole commands +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\scratch-pool-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=DDS-4 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/six-vol-test.bscr b/regress/win32/tests/six-vol-test.bscr new file mode 100644 index 0000000000..e6698df335 --- /dev/null +++ b/regress/win32/tests/six-vol-test.bscr @@ -0,0 +1,19 @@ +@output nul +messages +@@out@ tmp/log1.out +run job=@JobName@ storage=File yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/six-vol-test.cmd b/regress/win32/tests/six-vol-test.cmd new file mode 100644 index 0000000000..ab3ca0559b --- /dev/null +++ b/regress/win32/tests/six-vol-test.cmd @@ -0,0 +1,36 @@ +REM +REM Create a 60MB file with random bytes. Back it up to 6 Volumes +REM each constrained to 10MB using the automatic labeling feature. +REM +SET TestName=six-vol-test +SET JobName=SixVol + +CALL scripts\functions set_debug 0 + +CALL scripts\cleanup +CALL scripts\copy-testa-confs >nul 2>&1 +ECHO %CD:\=/%/tmp/largefile >\tmp\file-list + +ECHO Creating a 60MB file with bacula-dir data ... +tools\dd if=bin/bacula-dir.exe of=%CD:\=/%/tmp/1 bs=1024 count=500 >nul 2>&1 +COPY /b %CD%\tmp\1+%CD%\tmp\1+%CD%\tmp\1+%CD%\tmp\1+%CD%\tmp\1 %CD%\tmp\2 >nul 2>&1 +DEL %CD%\tmp\1 +COPY /b %CD%\tmp\2+%CD%\tmp\2 %CD%\tmp\3 >nul 2>&1 +DEL %CD%\tmp\2 +COPY /b %CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3 %CD%\tmp\4 >nul 2>&1 +COPY /b %CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\3+%CD%\tmp\4 %CD%\tmp\largefile >nul 2>&1 +DEL %CD%\tmp\3 %CD%\tmp\4 + +CALL scripts\functions change_jobname MultiVol %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\six-vol-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +diff tmp\largefile tmp\bacula-restores\%CD::=%\tmp\largefile >nul 2>&1 +SET dstat=%ERRORLEVEL% +CALL scripts\functions end_test diff --git a/regress/win32/tests/small-file-size-tape b/regress/win32/tests/small-file-size-tape new file mode 100644 index 0000000000..9c68cad1eb --- /dev/null +++ b/regress/win32/tests/small-file-size-tape @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape where the maximum tape file size is set to 1M +# +TestName="small-file-size-tape" +JobName=smallfilesize +. scripts/functions +set_debug 0 + +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list +cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1 +sed "s%# Maximum File Size% Maximum File Size%" ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +setdebug level=2 storage=DDS-4 +run job=$JobName yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=DDS-4 +unmark * +mark * +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/span-vol-test.bscr b/regress/win32/tests/span-vol-test.bscr new file mode 100644 index 0000000000..6ec7c37eae --- /dev/null +++ b/regress/win32/tests/span-vol-test.bscr @@ -0,0 +1,27 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File1 volume=TestVolume004 +label storage=File1 volume=TestVolume003 +label storage=File1 volume=TestVolume002 +label storage=File1 volume=TestVolume001 +update Volume=TestVolume004 MaxVolBytes=3000000 +update Volume=TestVolume003 MaxVolBytes=3000000 +update Volume=TestVolume002 MaxVolBytes=3000000 +run job=@JobName@ storage=File1 yes +wait +list volumes +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File1 +unmark * +mark * +done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/span-vol-test.cmd b/regress/win32/tests/span-vol-test.cmd new file mode 100644 index 0000000000..cdc63aca85 --- /dev/null +++ b/regress/win32/tests/span-vol-test.cmd @@ -0,0 +1,26 @@ +REM +REM Run a simple backup of the Bacula build directory but +REM split the archive into four volumes, two of which are +REM totally full. I.e. make sure that bsr selects all tapes +REM including those fully spanned. +REM +SET TestName=span-vol-test +SET JobName=SpanVol + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +echo %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\span-vol-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/sparse-compressed-test.bscr b/regress/win32/tests/sparse-compressed-test.bscr new file mode 100644 index 0000000000..e4d1040296 --- /dev/null +++ b/regress/win32/tests/sparse-compressed-test.bscr @@ -0,0 +1,17 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=SparseCompressedTest yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all storage=File done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/sparse-compressed-test.cmd b/regress/win32/tests/sparse-compressed-test.cmd new file mode 100644 index 0000000000..f01e19aaed --- /dev/null +++ b/regress/win32/tests/sparse-compressed-test.cmd @@ -0,0 +1,23 @@ +REM +REM Run a simple backup of the Bacula build directory using the Sparse option +REM then restore it. +REM +SET TestName=sparse-compressed-test +SET JobName=Sparse-conpressed + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +echo %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\sparse-compressed-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/sparse-test.bscr b/regress/win32/tests/sparse-test.bscr new file mode 100644 index 0000000000..b7438e9dfb --- /dev/null +++ b/regress/win32/tests/sparse-test.bscr @@ -0,0 +1,20 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/sparse-test.cmd b/regress/win32/tests/sparse-test.cmd new file mode 100644 index 0000000000..a8ba5d1680 --- /dev/null +++ b/regress/win32/tests/sparse-test.cmd @@ -0,0 +1,23 @@ +REM +REM Run a simple backup of the Bacula build directory using the Sparse option +REM then restore it. +REM +SET TestName=sparse-test +SET JobName=SparseTest + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\sparse-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/test0.cmd b/regress/win32/tests/test0.cmd new file mode 100644 index 0000000000..e1824b12b7 --- /dev/null +++ b/regress/win32/tests/test0.cmd @@ -0,0 +1,2 @@ +COPY nul test.out >nul 2>&1 +DEL bin\working\* 2>&1 diff --git a/regress/win32/tests/truncate-bug-tape b/regress/win32/tests/truncate-bug-tape new file mode 100644 index 0000000000..acfda15f3e --- /dev/null +++ b/regress/win32/tests/truncate-bug-tape @@ -0,0 +1,87 @@ +#!/bin/sh +# +# Test for a tape truncation bug. +# +TestName="truncate-bug-tape" +JobName=truncatebug +. scripts/functions + +set_debug 0 +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default +@# do a bunch of saves so we have 12 files on the tape +run job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +run level=Full job=$JobName yes +@#setdebug level=100 storage=DDS-4 +wait +messages +quit +END_OF_DATA + +run_bacula +scripts/check_for_zombie_jobs storage=DDS-4 + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log2.out +@# +@# now do a restore +@# +restore where=${cwd}/tmp/bacula-restores storage=DDS-4 +3 +@# select JobId=4 (i.e. file five on the tape) +4 +cd ${cwd}/build +@# mark a single file +mark configure +done +yes +wait +messages +@output +quit +END_OF_DATA + +run_bconsole +scripts/check_for_zombie_jobs storage=DDS-4 + +# Now write to tape one more time +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log3.out +run level=Full job=$JobName yes +wait +messages +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +grep "^ Termination: *Backup OK" tmp/log3.out 2>&1 >/dev/null +dstat=$? +end_test diff --git a/regress/win32/tests/two-jobs-test.1.bscr b/regress/win32/tests/two-jobs-test.1.bscr new file mode 100644 index 0000000000..745a2e1011 --- /dev/null +++ b/regress/win32/tests/two-jobs-test.1.bscr @@ -0,0 +1,14 @@ +setdebug level=15 storage=File +@output nul +messages +@output nul +estimate job=@JobName@ listing +estimate job=@JobName@ listing +estimate job=@JobName@ listing +messages +@@out@ tmp/log1.out +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/two-jobs-test.2.bscr b/regress/win32/tests/two-jobs-test.2.bscr new file mode 100644 index 0000000000..144ac5f997 --- /dev/null +++ b/regress/win32/tests/two-jobs-test.2.bscr @@ -0,0 +1,27 @@ +@output nul +messages +@@out@ tmp/log1.out +run job=@JobName@ +yes +wait +messages +@# +@# now do several restores to ensure we cleanup between jobs +@# +@output nul +restore where=@topdir@/tmp/bacula-restores select all storage=File done +yes +wait +restore where=@topdir@/tmp/bacula-restores select all storage=File done +yes +wait +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/two-jobs-test.cmd b/regress/win32/tests/two-jobs-test.cmd new file mode 100644 index 0000000000..3964e90d16 --- /dev/null +++ b/regress/win32/tests/two-jobs-test.cmd @@ -0,0 +1,35 @@ +REM +REM Run a simple backup of the Bacula build directory using the compressed option +REM then backup a second time and finally restore it +REM +SET TestName=two-jobs-test +SET JobName=Two-Jobs + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname CompressedTest %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-jobs-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File + +ECHO Backup 1 done +tools\touch build\src\dird\*.c + +REM +REM run a second job +REM +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-jobs-test.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bconsole +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/two-pool-tape b/regress/win32/tests/two-pool-tape new file mode 100644 index 0000000000..9da395ae69 --- /dev/null +++ b/regress/win32/tests/two-pool-tape @@ -0,0 +1,82 @@ +#!/bin/sh +# +# This is Arno's test. It uses two pools, two tapes, and +# an autochanger. Note, the Director has three Pools in its +# conf: Default, Full, and Inc. Default is used in the +# NightlySave job by default. What is backed up is what +# is in /tmp/file-list, which is by default the Bacula +# source code (i.e. the build directory). +# +TestName="two-pool-tape" +JobName=twopooltape +. scripts/functions +set_debug 0 + +. config.out +if test x${AUTOCHANGER} = x/dev/null ; then + echo "two-pool-tape test skipped. No autochanger." + exit +fi + +scripts/cleanup +scripts/copy-2tape-confs +echo "Prepare two tapes" +scripts/prepare-two-tapes +echo "Done prepare two tapes" + +# Make a relatively large backup set 5 x source code directory +echo "${cwd}/build" >/tmp/file-list +echo "${cwd}/build" >>/tmp/file-list +echo "${cwd}/build" >>/tmp/file-list +echo "${cwd}/build" >>/tmp/file-list +echo "${cwd}/build" >>/tmp/file-list + +start_test + +# Write out bconsole commands to a file +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 pool=Full drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0 +list volumes +@# Start job with Client run before and sleep +run job=NightlySave1 level=Full pool=Default yes +run job=NightlySave1 level=Full pool=Default yes +run job=NightlySave1 level=Full pool=Default yes +@# wait between starting jobs +@sleep 60 +@#setdebug level=100 storage=DDS-4 +run job=NightlySave2 level=Full pool=Full yes +run job=NightlySave2 level=Full pool=Full yes +run job=NightlySave2 level=Full pool=Full yes +@sleep 10 +messages +@sleep 10 +messages +@sleep 10 +status storage=DDS-4 +messages +wait +list volumes +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +check_restore_diff +end_test diff --git a/regress/win32/tests/two-pool-test.bscr b/regress/win32/tests/two-pool-test.bscr new file mode 100644 index 0000000000..57b3903e6a --- /dev/null +++ b/regress/win32/tests/two-pool-test.bscr @@ -0,0 +1,36 @@ +@output nul +messages +@@out@ tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 pool=Full drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0 +list volumes +@# Start job with Client run before and sleep +run job=NightlySave1 level=Full pool=Default yes +run job=NightlySave1 level=Full pool=Default yes +run job=NightlySave1 level=Full pool=Default yes +@# wait between starting jobs +@sleep 60 +@#setdebug level=100 storage=DDS-4 +run job=NightlySave2 level=Full pool=Full yes +run job=NightlySave2 level=Full pool=Full yes +run job=NightlySave2 level=Full pool=Full yes +@sleep 10 +messages +@sleep 10 +messages +@sleep 10 +status storage=DDS-4 +messages +wait +list volumes +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/two-pool-test.cmd b/regress/win32/tests/two-pool-test.cmd new file mode 100644 index 0000000000..54784e4f05 --- /dev/null +++ b/regress/win32/tests/two-pool-test.cmd @@ -0,0 +1,37 @@ +REM +REM This is Arno's test. It uses two pools, two tapes, and +REM an autochanger. Note, the Director has three Pools in its +REM conf: Default, Full, and Inc. Default is used in the +REM NightlySave job by default. What is backed up is what +REM is in /tmp/file-list, which is by default the Bacula +REM source code (i.e. the build directory). +REM +REM Note, we use the virtual disk autochanger. +REM +SET TestName=two-pool-test +SET JobName=Two-pool + +CALL scripts\functions set_debug 0 + +CALL config_out + +CALL scripts\cleanup +CALL scripts\copy-2disk-confs >nul 2>&1 +CALL scripts\prepare-two-disks + +REM Make a relatively large backup set 5 x source code directory +REM Reduced to 1 for portable +echo %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions start_test + +REM Write out bconsole commands to a file +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-pool-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=DDS-4 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/two-vol-test.bscr b/regress/win32/tests/two-vol-test.bscr new file mode 100644 index 0000000000..8de06c5d64 --- /dev/null +++ b/regress/win32/tests/two-vol-test.bscr @@ -0,0 +1,19 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=File1 volume=TestVolume002 +label storage=File1 volume=TestVolume001 +update Volume=TestVolume002 MaxVolBytes=3000000 +run job=@JobName@ storage=File1 yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all storage=File1 done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/two-vol-test.cmd b/regress/win32/tests/two-vol-test.cmd new file mode 100644 index 0000000000..a363fcccf8 --- /dev/null +++ b/regress/win32/tests/two-vol-test.cmd @@ -0,0 +1,24 @@ +REM +REM Run a simple backup of the Bacula build directory but +REM split the archive into two volumes +REM +SET TestName=two-vol-test +SET JobName=TwoVol + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +echo %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-vol-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File1 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/two-volume-tape.1.bscr b/regress/win32/tests/two-volume-tape.1.bscr new file mode 100644 index 0000000000..30ebdf96bf --- /dev/null +++ b/regress/win32/tests/two-volume-tape.1.bscr @@ -0,0 +1,11 @@ +@@out@ nul +messages +@@out@ @topdir@/tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 pool=Default drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0 +update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0 +@#setdebug level=1000 client +run job=@JobName@ yes +wait +messages +quit diff --git a/regress/win32/tests/two-volume-tape.2.bscr b/regress/win32/tests/two-volume-tape.2.bscr new file mode 100644 index 0000000000..6af471c6b7 --- /dev/null +++ b/regress/win32/tests/two-volume-tape.2.bscr @@ -0,0 +1,12 @@ +@@out@ nul +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/two-volume-tape.cmd b/regress/win32/tests/two-volume-tape.cmd new file mode 100644 index 0000000000..1528c5f26f --- /dev/null +++ b/regress/win32/tests/two-volume-tape.cmd @@ -0,0 +1,48 @@ +REM +REM Run a simple backup of the Bacula build directory +REM to two tapes where the maximum tape file size is set to 1M +REM Note, this test simulates the tape filling and writing to +REM the next tape. +REM +SET TestName=two-volume-tape +SET JobName=twovoltape +CALL scripts\functions set_debug 0 + +CALL config_out +IF "%AUTOCHANGER%" == "nul" ( + ECHO two-volume-tape test skipped. No autochanger. + EXIT /b 1 +) + +CALL scripts\cleanup +CALL scripts\copy-2tape-confs +CALL scripts\prepare-two-tapes + +ECHO "%CD:\=/%/build" >\tmp\file-list + +COPY bin\bacula-sd.conf tmp\1 +sed -e "s%# Maximum File Size% Maximum File Size%g" >bin\bacula-sd.conf + +CALL scripts\functions change_jobname %JobName% +CALL scripts\functions start_test + +REM Write out bconsole commands +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-volume-tape.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=DDS-4 +CALL scripts\functions stop_bacula + +mt -f %TAPE_DRIVE% rewind +mtx -f %AUTOCHANGER% unload +bin\bsleep 15 + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-volume-tape.2.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=DDS-4 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/two-volume-test.bscr b/regress/win32/tests/two-volume-test.bscr new file mode 100644 index 0000000000..bd08ef35e1 --- /dev/null +++ b/regress/win32/tests/two-volume-test.bscr @@ -0,0 +1,21 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=1 pool=Default drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0 +update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0 +@#setdebug level=1000 client +run job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +@@out@ +quit + diff --git a/regress/win32/tests/two-volume-test.cmd b/regress/win32/tests/two-volume-test.cmd new file mode 100644 index 0000000000..cef3887c0d --- /dev/null +++ b/regress/win32/tests/two-volume-test.cmd @@ -0,0 +1,35 @@ +REM +REM Run a simple backup of the Bacula build directory +REM to two tapes where the maximum tape file size is set to 1M +REM Note, this test simulates the tape filling and writing to +REM the next tape. +REM +REM Note we use the viritual disk autochanger +REM +SET TestName=two-volume-test +SET JobName=TwoVolume +CALL scripts\functions set_debug 0 +CALL config_out + +CALL scripts\cleanup +CALL scripts\copy-2disk-confs >nul 2>&1 +CALL scripts\prepare-two-disks + +ECHO %CD:\=/%/build >\tmp\file-list + +COPY bin\bacula-sd.conf tmp\1 +sed -e "s;# Maximum File Size; Maximum File Size;g" tmp\1 >bin\bacula-sd.conf + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +REM Write out bconsole commands +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\two-volume-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=DDS-4 +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +CALL scripts\functions check_restore_diff +CALL scripts\functions end_test diff --git a/regress/win32/tests/usr-tape-root b/regress/win32/tests/usr-tape-root new file mode 100644 index 0000000000..0f5002d928 --- /dev/null +++ b/regress/win32/tests/usr-tape-root @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Run a simple backup of the /usr directory +# then restore it. +# +cwd=`pwd` +scripts/copy-tape-confs +scripts/cleanup-tape +echo "/usr" >/tmp/file-list + +echo " " +echo " " +echo " === Starting usr-tape-root test ===" +echo " " +echo " " + +bin/bacula start 2>&1 >/dev/null +bin/bconsole -c bin/bconsole.conf <&1 >/dev/null +cd / +${cwd}/bin/testls -e ${cwd}/scripts/exclude-usr-test lib >${cwd}/tmp/original +cd ${cwd}/tmp/bacula-restores +${cwd}/bin/testls -e ${cwd}/scripts/exclude-usr-test lib >${cwd}/tmp/restored +cd ${cwd}/tmp +sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1 +sort <1 >original +# +sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1 +sort <1 >restored +rm -f 1 +# +cd ${cwd} +diff tmp/original tmp/restored 2>&1 1>/dev/nul +if [ $? != 0 ] ; then + echo " " + echo " " + echo " ===== !!!! usr-tape-root failed !!!! ===== " + echo " ===== !!!! usr-tape-root failed !!!! ===== " >>test.out + echo " " +else + echo " ===== usr-tape-root OK ===== " + echo " ===== usr-tape-root OK ===== " >>test.out + scripts/cleanup +fi diff --git a/regress/win32/tests/verify-vol-tape b/regress/win32/tests/verify-vol-tape new file mode 100644 index 0000000000..c544bc6603 --- /dev/null +++ b/regress/win32/tests/verify-vol-tape @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then verify the catalog. +# +TestName="verify-vol-tape" +JobName=VerifyVol +. scripts/functions +set_debug 0 + +copy_tape_confs + +echo "${cwd}/build" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +setdebug level=1 storage=DDS-4 sd +label storage=DDS-4 volume=TestVolume001 pool=Default +run job=$JobName yes +wait +messages +@# +@# now do a verify volume +@# +@$out ${cwd}/tmp/original +run job=VerifyTape pool=Default +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula + +sleep 2 +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null +bstat=$? +grep "^ Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null +rstat=$? +dstat=0 +end_test diff --git a/regress/win32/tests/verify-vol-test.bscr b/regress/win32/tests/verify-vol-test.bscr new file mode 100644 index 0000000000..8c73bbc59f --- /dev/null +++ b/regress/win32/tests/verify-vol-test.bscr @@ -0,0 +1,18 @@ +@@out@ nul +messages +@@out@ tmp/log1.out +setdebug level=1 storage=File sd +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +@# +@# now do a verify volume +@# +@@out@ @topdir@/tmp/original +run job=VerifyVolume +yes +wait +messages +@@out@ +quit diff --git a/regress/win32/tests/verify-vol-test.cmd b/regress/win32/tests/verify-vol-test.cmd new file mode 100644 index 0000000000..377fb3428f --- /dev/null +++ b/regress/win32/tests/verify-vol-test.cmd @@ -0,0 +1,29 @@ +REM +REM Run a simple backup of the Bacula build directory +REM then verify the catalog. +REM +SET TestName=verify-vol-test +SET JobName=VerifyVol + +CALL scripts\functions set_debug 0 +CALL scripts\functions copy_test_confs + +ECHO %CD:\=/%/build >\tmp\file-list + +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\verify-vol-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula + +bin\bsleep 2 +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +grep "^ Termination: *Backup OK" tmp\log1.out 2>&1 >nul +SET bstat=%ERRORLEVEL% +grep "^ Termination: *Verify OK" tmp\original 2>&1 >nul +SET rstat=%ERRORLEVEL% +SET dstat=0 +CALL scripts\functions end_test diff --git a/regress/win32/tests/weird-files-test b/regress/win32/tests/weird-files-test new file mode 100644 index 0000000000..96fed89322 --- /dev/null +++ b/regress/win32/tests/weird-files-test @@ -0,0 +1,69 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +TestName="weird-files-test" +JobName=wierd-files +. scripts/functions +set_debug 0 + +if test ! -d weird-files ; then + echo " " + echo "Weird files not configured. Test not run." + exit 0 +fi + +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +change_jobname NightlySave $JobName +# +# Note, we save the weird-files directory twice on purpose +# because this causes problems with hard linked files +# that are only saved once. In 1.33, Bacula now deals +# with this situation. +# +echo "${cwd}/weird-files" >/tmp/file-list +echo "${cwd}/weird-files" >>/tmp/file-list + +start_test + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +label storage=File +TestVolume001 +run job=$JobName +yes +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=${cwd}/tmp/bacula-restores select storage=File +unmark * +mark * +done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +stop_bacula + +${cwd}/bin/testls weird-files | sort >${cwd}/tmp/original +cd tmp/bacula-restores${cwd} +${cwd}/bin/testls weird-files | sort >${cwd}/tmp/restored +cd ${cwd} + +check_two_logs +diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null +dstat=$? +end_test diff --git a/regress/win32/tests/weird-files2-test b/regress/win32/tests/weird-files2-test new file mode 100644 index 0000000000..ec328155dd --- /dev/null +++ b/regress/win32/tests/weird-files2-test @@ -0,0 +1,80 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# then restore it. +# +TestName="weird-files2-test" +JobName=weird-files2 +. scripts/functions +set_debug 0 + +if test ! -d weird-files ; then + echo " " + echo "weird files not configured. Test not run." + exit 0 +fi +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +rm -rf weird-files2 +cp -Rp weird-files weird-files2 +echo "${cwd}/weird-files2" >/tmp/file-list + +change_jobname NightlySave $JobName +start_test + +bin/testls weird-files2 >${cwd}/tmp/original + +cat <tmp/bconcmds +@$out /dev/null +messages +@$out tmp/log1.out +label storage=File volume=TestVolume001 +run job=$JobName yes +wait +messages +@$out +quit +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=File +# +# Now mess up the a hard link, and a soft link +# +cd weird-files2 +rm -f hard-file2 +ln hard-file3 hard-file2 +rm -f soft-file2 +ln -s soft-file3 soft-file2 +cd ${cwd} +cat <tmp/bconcmds +@$out /dev/null +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where= storage=File +5 +unmark * +mark * +done +yes +wait +messages +@$out +quit +END_OF_DATA + +run_bconsole +check_for_zombie_jobs storage=File +stop_bacula + +bin/testls weird-files2 >${cwd}/tmp/restored + +check_two_logs +diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null +dstat=$? + +end_test diff --git a/regress/win32/tests/win32-backup-tape b/regress/win32/tests/win32-backup-tape new file mode 100644 index 0000000000..3322da8d49 --- /dev/null +++ b/regress/win32/tests/win32-backup-tape @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape then restore it, we do that twice to ensure that +# we can correctly append to a tape. +# +TestName="win32-backup-tape" +JobName=win32tape +. scripts/functions +set_debug 0 + +scripts/copy-win32-confs +scripts/cleanup-tape + +echo "${cwd}/build" >/tmp/file-list + +change_jobname $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0 +run job=$JobName yes +@sleep 10 +status storage=DDS-4 +@sleep 30 +messages +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=c:/tmp/bacula-restores select all storage=DDS-4 done +yes +wait +messages +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +# no diff for now +dstat=0 +end_test diff --git a/regress/win32/tests/win32-to-linux-tape b/regress/win32/tests/win32-to-linux-tape new file mode 100644 index 0000000000..780c7dfb8c --- /dev/null +++ b/regress/win32/tests/win32-to-linux-tape @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Run a simple backup of the Bacula build directory +# to a tape then restore it, we do that twice to ensure that +# we can correctly append to a tape. +# +TestName="win32-to-linux-tape" +JobName=AutoLabel +. scripts/functions +set_debug 1 + +scripts/copy-win32-confs +scripts/cleanup-tape + +echo "${cwd}/build" >/tmp/file-list + +change_job $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default drive=0 +run job=NightlySave yes +@sleep 10 +status storage=DDS-4 +@sleep 30 +messages +wait +messages +@# +@# now do a restore +@# +@$out tmp/log2.out +restore where=/tmp/bacula-restores client=Tibs select all storage=DDS-4 done +yes +wait +messages +END_OF_DATA + +run_bacula +check_for_zombie_jobs storage=DDS-4 +stop_bacula + +check_two_logs +# No diff for the moment +dstat=0 +end_test -- 2.39.5