From a9afc45226734c5ccecb18a0f8644eeebf9a6518 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 18 Oct 2007 21:27:51 +0000 Subject: [PATCH] Add new Win32 files git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5765 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/win32/README.txt | 15 +++++ regress/win32/tests/2drive-3pool-test.1.bscr | 24 +++++++ regress/win32/tests/2drive-3pool-test.2.bscr | 13 ++++ regress/win32/tests/2drive-3pool-test.cmd | 43 ++++++++++++ .../win32/tests/2drive-concurrent-test.bscr | 65 +++++++++++++++++++ .../win32/tests/2drive-concurrent-test.cmd | 26 ++++++++ regress/win32/tests/big-vol-test.1.bscr | 25 +++++++ regress/win32/tests/big-vol-test.2.bscr | 10 +++ regress/win32/tests/big-vol-test.cmd | 44 +++++++++++++ regress/win32/tests/encrypt-bug-test.bscr | 23 +++++++ regress/win32/tests/encrypt-bug-test.cmd | 33 ++++++++++ regress/win32/tests/migration-job-test.bscr | 47 ++++++++++++++ .../win32/tests/migration-jobspan-test.bscr | 40 ++++++++++++ .../win32/tests/migration-occupancy-test.bscr | 34 ++++++++++ regress/win32/tests/migration-time-test.bscr | 41 ++++++++++++ .../win32/tests/migration-volume-test.bscr | 64 ++++++++++++++++++ 16 files changed, 547 insertions(+) create mode 100644 regress/win32/README.txt create mode 100644 regress/win32/tests/2drive-3pool-test.1.bscr create mode 100644 regress/win32/tests/2drive-3pool-test.2.bscr create mode 100644 regress/win32/tests/2drive-3pool-test.cmd create mode 100644 regress/win32/tests/2drive-concurrent-test.bscr create mode 100644 regress/win32/tests/2drive-concurrent-test.cmd create mode 100644 regress/win32/tests/big-vol-test.1.bscr create mode 100644 regress/win32/tests/big-vol-test.2.bscr create mode 100644 regress/win32/tests/big-vol-test.cmd create mode 100644 regress/win32/tests/encrypt-bug-test.bscr create mode 100644 regress/win32/tests/encrypt-bug-test.cmd create mode 100644 regress/win32/tests/migration-job-test.bscr create mode 100644 regress/win32/tests/migration-jobspan-test.bscr create mode 100644 regress/win32/tests/migration-occupancy-test.bscr create mode 100644 regress/win32/tests/migration-time-test.bscr create mode 100644 regress/win32/tests/migration-volume-test.bscr diff --git a/regress/win32/README.txt b/regress/win32/README.txt new file mode 100644 index 0000000000..6e444a06f4 --- /dev/null +++ b/regress/win32/README.txt @@ -0,0 +1,15 @@ +In order to use the win32 bacula regression scripts, it is important to have +some unix tools (such as sed, grep, and diff). To make things simple, download +UnxUtils from http://sourceforge.net/projects/unxutils + +Extract UnxUtils somewhere and add the the files in usr\local\wbin to $PATH. + +Copy regress/win32 to a local directory on your system. + +Set your sources directory in prototype.conf to a mapped drive or a local copy +of the bacula sources including windows binaries. + +Run "config.cmd prototype.conf" from a command prompt in your regress/win32 +directory followed by "make setup". + +Tests are executed with "make test". diff --git a/regress/win32/tests/2drive-3pool-test.1.bscr b/regress/win32/tests/2drive-3pool-test.1.bscr new file mode 100644 index 0000000000..0ac36091fb --- /dev/null +++ b/regress/win32/tests/2drive-3pool-test.1.bscr @@ -0,0 +1,24 @@ +@output nul +messages +@@out@ @topdir@/tmp/log1.out +setdebug level=51 storage=DDS-4 +label storage=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0 +label storage=DDS-4 volume=TestVolume002 slot=2 Pool=Full drive=1 +@#label storage=DDS-4 volume=TestVolume003 slot=3 Pool=Inc drive=2 +status storage=DDS-4 +@#run job=@JobName@ level=Full Pool=Inc yes +run job=@JobName@ level=Full Pool=Full yes +run job=@JobName@ level=Full Pool=Default yes +setdebug level=200 storage=DDS-4 +run job=@JobName@ level=Full Pool=Default yes +run job=@JobName@ level=Full Pool=Default yes +@sleep 10 +status storage=DDS-4 +list volumes +wait +list volumes +list jobs +status storage=DDS-4 +messages +quit + diff --git a/regress/win32/tests/2drive-3pool-test.2.bscr b/regress/win32/tests/2drive-3pool-test.2.bscr new file mode 100644 index 0000000000..a2cf77dfe5 --- /dev/null +++ b/regress/win32/tests/2drive-3pool-test.2.bscr @@ -0,0 +1,13 @@ +@@out@ @topdir@/tmp/log1.out +messages +@# +@# now do a restore +@# +@@out@ @topdir@/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/2drive-3pool-test.cmd b/regress/win32/tests/2drive-3pool-test.cmd new file mode 100644 index 0000000000..0f09663352 --- /dev/null +++ b/regress/win32/tests/2drive-3pool-test.cmd @@ -0,0 +1,43 @@ +REM Run a simple backup of the Bacula build directory. Create three +REM tapes, each in a different pool, then run some jobs asking for the +REM volume on drive three. It should find it without moving the +REM volume. +REM +REM This script uses the virtual disk autochanger and two drives +REM +SET TestName="2drive-3pool-disk" +SET JobName="2dr3pooldisk" + +CALL scripts\functions set_debug 0 + +CALL scripts\cleanup +CALL scripts\copy-2disk-drive-confs +CALL scripts\prepare-two-disks + +ECHO %CD:\=/%/build >tmp\file-list +CALL scripts\functions change_jobname NightlySave %JobName% +CALL scripts\functions start_test + +REM Turn off Prefer Mounted Volumes so we use 2 drives +REM outf="tmp/sed_tmp" +REM ECHO "s%REM Prefer Mounted Volumes% Prefer Mounted Volumes%g" >${outf} +REM cp bin/bacula-dir.conf tmp/1 +REM Comment the next line out to write everything to one drive +REM otherwise, it writes the two jobs to different drives +REM sed -f ${outf} 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-3pool-test.1.bscr >tmp\bconcmds +CALL scripts\functions run_bacula + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" tests\2drive-3pool-test.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 +CALL scripts\functions check_restore_diff + +CALL scripts\functions end_test + diff --git a/regress/win32/tests/2drive-concurrent-test.bscr b/regress/win32/tests/2drive-concurrent-test.bscr new file mode 100644 index 0000000000..7fef867920 --- /dev/null +++ b/regress/win32/tests/2drive-concurrent-test.bscr @@ -0,0 +1,65 @@ +@output nul +messages +@@out@ @topdir@/tmp/log1.out +label pool=Default storage=DDS-4 volume=TestVolume001 slot=1 drive=0 +label pool=Default storage=DDS-4 volume=TestVolume002 slot=2 drive=1 +update Volume=TestVolume001 MaxVolBytes=100000000 +@#50000000 +@#12 +setdebug level=001 Storage=DDS-4 +status storage=DDS-4 +llist volume=TestVolume001 +llist volume=TestVolume002 +run job=@JobName@ level=Full Storage=DDS-4 +yes +reload +llist volume=TestVolume001 +llist volume=TestVolume002 +run job=@JobName@ level=Full Storage=DDS-4 +yes +reload +llist volume=TestVolume001 +llist volume=TestVolume002 +run job=@JobName@ level=Full Storage=DDS-4 +yes +reload +llist volume=TestVolume001 +llist volume=TestVolume002 +status storage=DDS-4 +run job=@JobName@ level=Full Storage=DDS-4 +yes +status storage=DDS-4 +reload +reload +reload +reload +@sleep 2 +status dir +status storage=DDS-4 +llist volume=TestVolume001 +llist volume=TestVolume002 +reload +@sleep 5 +messages +reload +reload +wait +status storage=DDS-4 +reload +messages +@# +@# now do a restore +@# +@@out@ @topdir@/tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=DDS-4 +unmark * +mark * +done +yes +wait +reload +reload +messages +@output +quit + diff --git a/regress/win32/tests/2drive-concurrent-test.cmd b/regress/win32/tests/2drive-concurrent-test.cmd new file mode 100644 index 0000000000..16946cd547 --- /dev/null +++ b/regress/win32/tests/2drive-concurrent-test.cmd @@ -0,0 +1,26 @@ +REM Run four jobs at the same time, with two Volumes. +REM Set max Vol bytes of first volume +REM to less than total backup to force Bacula to use the second +REM Volume. +REM +SET TestName="2drive-concurrent-test" +SET JobName=Four-concurrent-jobs +CALL CALL scripts\functions set_debug 0 + +CALL scripts\cleanup +CALL scripts\copy-2disk-drive-confs +CALL scripts\prepare-two-disks +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\2drive-concurrent-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/big-vol-test.1.bscr b/regress/win32/tests/big-vol-test.1.bscr new file mode 100644 index 0000000000..f2455aba2e --- /dev/null +++ b/regress/win32/tests/big-vol-test.1.bscr @@ -0,0 +1,25 @@ +@output nul +messages +@@out@ @topdir@/tmp/log1.out +sql +UPDATE Media SET Volbytes=@size@ WHERE VolumeName='TestVolume001'; + +llist volume=TestVolume001 +@# Now do another full save with big Volume +run level=Full job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +sql +SELECT * FROM JobMedia; + +@output @topdir@/tmp/log2.out +restore where=@topdir@/tmp/bacula-restores storage=File select all done +yes +wait +messages +@@out@ +quit + diff --git a/regress/win32/tests/big-vol-test.2.bscr b/regress/win32/tests/big-vol-test.2.bscr new file mode 100644 index 0000000000..5d59645e0b --- /dev/null +++ b/regress/win32/tests/big-vol-test.2.bscr @@ -0,0 +1,10 @@ +@output nul +messages +@@out@ @topdir@/tmp/log1.out +@#setdebug level=100 storage=File +label storage=File volume=TestVolume001 +run job=@JobName@ yes +wait +messages +quit + diff --git a/regress/win32/tests/big-vol-test.cmd b/regress/win32/tests/big-vol-test.cmd new file mode 100644 index 0000000000..9cf4b83a94 --- /dev/null +++ b/regress/win32/tests/big-vol-test.cmd @@ -0,0 +1,44 @@ +REM Create a big Volume > 5 GB and backup to it to test disk +REM seeking on big volumes. We cheat and artifically grow +REM the volume. +SET TestName="big-vol-test" +SET JobName=bigvol + +CALL scripts\functions set_debug 0 + +CALL scripts\cleanup +CALL scripts\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\big-vol-test.1.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +CALL scripts\functions check_for_zombie_jobs storage=File + +REM +REM Now increase the size of the Volume using gigaslam +REM +CD %CD%\tmp +REM make big file +SET size=5200000000 +%CD%/build/src/tools/grow TestVolume001 %size% +IF NOT ERRORLEVEL 0 GOTO ERROR +CD %CD% + +sed -e "s;@JobName@;%JobName%;g" -e "s;@out@;%out%;g" -e "s;@topdir@;%CD:\=/%;g" -e "s;@size@;%size%;g" tests\big-vol-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 +REM Get rid of big files +DEL /F %CD%\tmp\TestVolume001 + +:ERROR +ECHO Execute of %CD%\build\src\tools\grow failed. diff --git a/regress/win32/tests/encrypt-bug-test.bscr b/regress/win32/tests/encrypt-bug-test.bscr new file mode 100644 index 0000000000..6f19901e7d --- /dev/null +++ b/regress/win32/tests/encrypt-bug-test.bscr @@ -0,0 +1,23 @@ +@@out@ nul +messages +@@out@ @topdir@/tmp/log1.out +label storage=File volume=TestVolume001 +setdebug level=100 fd +run job=@JobName@ yes +wait +messages +@# +@# now do a restore +@# +@@out@ @topdir@/tmp/log2.out +setdebug level=100 fd +restore where=@topdir@/tmp/bacula-restores storage=File +5 +mark * +done +yes +wait +messages +@@out@ +quit + diff --git a/regress/win32/tests/encrypt-bug-test.cmd b/regress/win32/tests/encrypt-bug-test.cmd new file mode 100644 index 0000000000..08c72522e2 --- /dev/null +++ b/regress/win32/tests/encrypt-bug-test.cmd @@ -0,0 +1,33 @@ +REM Run a simple backup of untitled15.jpg that fails to +REM restore properly in bug REM763 +REM +SET TestName="encrypt-bug-test" +SET JobName=Crypto-bug +CALL scripts\functions set_debug 0 + +CALL scripts\cleanup +CALL scripts\copy-crypto-confs +ECHO %CD%/encrypt-bug.jpg >tmp/file-list +ECHO %CD%/encrypt-bug.jpg >tmp/restore-list +ECHO %CD%/encrypt-bug.txt >>tmp/file-list +ECHO %CD%/encrypt-bug.txt >>tmp/restore-list +ECHO %CD%/encrypt-bug2.txt >>tmp/file-list +ECHO %CD%/encrypt-bug2.txt >>tmp/restore-list +SET files="encrypt-bug.jpg encrypt-bug.txt encrypt-bug2.txt" +mkdir -p %CD%\tmp\build +for i in %files% do XCOPY /k %CD%\encrypt-bug*.* %CD%\tmp\build + +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\encrypt-bug-test.bscr >tmp\bconcmds + +CALL scripts\functions run_bacula +sleep 2 +CALL scripts\functions check_for_zombie_jobs storage=File +CALL scripts\functions stop_bacula + +CALL scripts\functions check_two_logs +diff %CD%\tmp\build %CD%\tmp\bacula-restores\%CD% +SET dstat=%ERRORLEVEL% +CALL scripts\functions end_test diff --git a/regress/win32/tests/migration-job-test.bscr b/regress/win32/tests/migration-job-test.bscr new file mode 100644 index 0000000000..a3305f61a3 --- /dev/null +++ b/regress/win32/tests/migration-job-test.bscr @@ -0,0 +1,47 @@ +@output +messages +@@out@ tmp/log1.out +@#setdebug level=100 storage=File +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 +@# run two jobs (both will be migrated) +run job=@JobName@ yes +run job=@JobName@ yes +wait +list jobs +list volumes +@#setdebug level=100 dir +@# should migrate two jobs +@#setdebug level=51 storage=DiskChanger +run job=migrate-job yes +wait +messages +@# purge volume=FileVolume001 +list jobs +list volumes +wait +@# +@# Now do another backup, but level Incremental +@# +run job=@JobName@ level=Incremental yes +wait +messages +@# +@# This final job that runs should be Incremental and +@# not upgraded to full. +list jobs +@# +@# now do a restore +@# +@@out@ tmp/log2.out +list volumes +restore where=tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit diff --git a/regress/win32/tests/migration-jobspan-test.bscr b/regress/win32/tests/migration-jobspan-test.bscr new file mode 100644 index 0000000000..8783e48b1d --- /dev/null +++ b/regress/win32/tests/migration-jobspan-test.bscr @@ -0,0 +1,40 @@ +@output +messages +@@out@ @topdir@/tmp/log1.out +@#setdebug level=10 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 +@#setdebug level=200 dir +@# should migrate both Volumes +run job=migrate-job yes +wait +purge volume=FileVolume001 +purge volume=FileVolume002 +list volumes +list jobs +messages +wait +@# +@# now do a restore +@# +@@out@ @topdir@/tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit + diff --git a/regress/win32/tests/migration-occupancy-test.bscr b/regress/win32/tests/migration-occupancy-test.bscr new file mode 100644 index 0000000000..9f15972708 --- /dev/null +++ b/regress/win32/tests/migration-occupancy-test.bscr @@ -0,0 +1,34 @@ +@output +messages +@@out@ @topdir@/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 +purge volume=FileVolume001 +wait +@# +@# now do a restore +@# +@@out@ @topdir@/tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit + diff --git a/regress/win32/tests/migration-time-test.bscr b/regress/win32/tests/migration-time-test.bscr new file mode 100644 index 0000000000..28d3c2dfe4 --- /dev/null +++ b/regress/win32/tests/migration-time-test.bscr @@ -0,0 +1,41 @@ +@output +messages +@@out@ @topdir@/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 +purge volume=FileVolume001 +list jobs +list volumes +@# +@# now do a restore +@# +@@out@ @topdir@/tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit + diff --git a/regress/win32/tests/migration-volume-test.bscr b/regress/win32/tests/migration-volume-test.bscr new file mode 100644 index 0000000000..0731143753 --- /dev/null +++ b/regress/win32/tests/migration-volume-test.bscr @@ -0,0 +1,64 @@ +@output +messages +@@out@ @topdir@/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 +@# +run job=@JobName@ yes +wait +run job=@JobName@ yes +wait +update volume=FileVolume001 VolStatus=Used +update volume=FileVolume002 VolStatus=Used +@#list volumes +@#list jobs +@# should migrate two jobs +@# setdebug level=11 dir +@echo "Run migrate-volume Job" +@#setdebug level=100 dir +run job=migrate-volume yes +@sleep 5 +list jobs +llist jobid=1 +llist jobid=2 +llist jobid=3 +llist jobid=4 +llist jobid=5 +status storage=DiskChanger +wait +list volumes +list jobs +llist jobid=1 +llist jobid=2 +llist jobid=3 +llist jobid=4 +llist jobid=5 +sql +select * from JobMedia where JobId=1; + +@# Now run a second Migration job, which should do nothing +run job=migrate-volume yes +wait +list jobs +@# ensure we don't pickup old backup by purging volume +@# purge volume=FileVolume001 +@# purge volume=FileVolume002 +@echo "Now do a restore" +messages +@# +@# now do a restore +@# +@@out@ @topdir@/tmp/log2.out +restore where=@topdir@/tmp/bacula-restores select storage=DiskChanger +unmark * +mark * +done +yes +wait +messages +@output +quit + -- 2.39.5