From: Eric Bollengier Date: Fri, 18 Dec 2015 10:38:54 +0000 (+0100) Subject: Add new verify data test X-Git-Tag: Release-7.4.0~118 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5ded5fed01964df1a34b7375ca54093026ae34b5;p=bacula%2Fbacula Add new verify data test --- diff --git a/regress/all-dev-tests b/regress/all-dev-tests index f787e590f6..32e07b2def 100755 --- a/regress/all-dev-tests +++ b/regress/all-dev-tests @@ -46,6 +46,7 @@ rm -f dumps/* ./run tests/strip-test ./run tests/sqlite-test ./run tests/two-vol-test +./run tests/verify-data-test ./run tests/verify-vol-test ./run tests/weird-files2-test ./run tests/weird-files-test diff --git a/regress/all-disk-tests b/regress/all-disk-tests index 4d467f2e7a..fd1b94e345 100755 --- a/regress/all-disk-tests +++ b/regress/all-disk-tests @@ -76,6 +76,7 @@ rm -f dumps/* ./run tests/strip-test ./run tests/two-jobs-test ./run tests/two-vol-test +./run tests/verify-data-test ./run tests/verify-cat-test ./run tests/verify-vol-test ./run tests/verify-voltocat-test diff --git a/regress/scripts/new-test-bacula-dir.conf.in b/regress/scripts/new-test-bacula-dir.conf.in index 7ecb324b59..c389f9f0a0 100644 --- a/regress/scripts/new-test-bacula-dir.conf.in +++ b/regress/scripts/new-test-bacula-dir.conf.in @@ -104,6 +104,19 @@ Job { Max Run Time = 30min } +Job { + Name = "VerifyData" + Type = Verify + Level = Data + Client=@hostname@-fd + FileSet="Full Set" + Storage = File + Messages = Standard + Pool = Default + Write Bootstrap = "@working_dir@/NightlySave.bsr" + Max Run Time = 30min +} + Job { Name = "SparseTest" @@ -286,6 +299,94 @@ FileSet { } } +FileSet { + Name = "FSno5" + Include { Options { verify=s5 } + File = <@tmpdir@/file-list + } + Include { Options { sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { compression=GZIP } + File = <@tmpdir@/file-list + } + Include { Options { compression=LZO } + File = <@tmpdir@/file-list + } + Include { Options { compression=LZO; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { compression=GZIP; sparse=yes } + File = <@tmpdir@/file-list + } +} + +FileSet { + Name = "FS5" + Include { Options { signature=MD5; verify=s5 } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=GZIP } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=LZO } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=LZO; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=GZIP; sparse=yes } + File = <@tmpdir@/file-list + } +} + +FileSet { + Name = "FS5nocheck" + Include { Options { verify="nog"; signature=MD5 } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=GZIP } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=LZO } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=LZO; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { signature=MD5; compression=GZIP; sparse=yes } + File = <@tmpdir@/file-list + } +} + +FileSet { + Name = "FS1" + Include { Options { verify=s1; signature=SHA1 } + File = <@tmpdir@/file-list + } + Include { Options { signature=SHA1; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { signature=SHA1; compression=GZIP } + File = <@tmpdir@/file-list + } + Include { Options { signature=SHA1; compression=LZO } + File = <@tmpdir@/file-list + } + Include { Options { signature=SHA1; compression=LZO; sparse=yes } + File = <@tmpdir@/file-list + } + Include { Options { signature=SHA1; compression=GZIP; sparse=yes } + File = <@tmpdir@/file-list + } +} + FileSet { Name = "SimpleSet" Include { diff --git a/regress/tests/verify-data-test b/regress/tests/verify-data-test new file mode 100644 index 0000000000..712073f292 --- /dev/null +++ b/regress/tests/verify-data-test @@ -0,0 +1,108 @@ +#!/bin/sh +# +# Copyright (C) 2000-2015 Kern Sibbald +# License: BSD 2-Clause; see file LICENSE-FOSS +# +# +# Run a simple backup of the Bacula build directory +# then verify the data on the volume. +# +TestName="verify-data-test" +JobName=VerifyVol +. scripts/functions + +cwd=`pwd` +scripts/cleanup +scripts/copy-test-confs +echo "${cwd}/tmp/files" >$tmp/file-list +echo "${cwd}/build/src/dird" >>$tmp/file-list +echo "${cwd}/build/src/filed" >>$tmp/file-list + +# +# Add this back when verify can handle sparse files +# the same way that backup does +# +mkdir -p $tmp/files +dd if=${cwd}/build/configure of=$tmp/files/sparsefile bs=1 count=1 seek=10M > /dev/null + +change_jobname NightlySave $JobName +start_test + +cat <tmp/bconcmds +@output /dev/null +messages +@$out tmp/log1.out +label storage=File volume=TestVolume001 +run job=$JobName level=full fileset=FS1 yes +run job=$JobName level=full fileset=FS5 yes +run job=$JobName level=full fileset=FSno5 yes +run job=$JobName level=full fileset=FS5nocheck yes +wait +messages +@# +@# now do a verify volume +@# +@$out ${cwd}/tmp/log2.out +setdebug level=10 client +run job=VerifyData jobid=1 yes +run job=VerifyData jobid=2 yes +run job=VerifyData jobid=3 yes +run job=VerifyData jobid=4 yes +wait +messages +quit +END_OF_DATA + +run_bacula + +sleep 2 +check_for_zombie_jobs storage=File +stop_bacula + +$bperl -e 'add_attribute("$conf/bacula-sd.conf", "BlockChecksum", "no", "Device")' + +nbok=2 +if [ x$FORCE_DEDUP = xyes ]; then + nbok=4 +elif [ x$FORCE_ALIGNED = xyes ]; then + sed -i 's/DUALCASE/PUALCASE/g' $tmp/TestVolume001.add +else + sed -i 's/DUALCASE/PUALCASE/g' $tmp/TestVolume001 +fi + +cat <tmp/bconcmds +@$out tmp/log3.out +@# +@# now do a verify volume with errors +@# +@$out ${cwd}/tmp/log3.out +setdebug level=10 client +run job=VerifyData jobid=1 yes +run job=VerifyData jobid=2 yes +run job=VerifyData jobid=3 yes +run job=VerifyData jobid=4 yes +wait +messages +quit +END_OF_DATA + +run_bacula + +sleep 2 +check_for_zombie_jobs storage=File +stop_bacula + +nb=`grep "^ Termination: *Backup OK" tmp/log1.out | wc -l` +if [ $nb -ne 4 ]; then + bstat=1 +fi +nb=`grep "^ Termination: *Verify OK" tmp/log2.out | wc -l` +if [ $nb -ne 4 ]; then + rstat=1 +fi +nb=`grep "^ Termination: *Verify OK" tmp/log3.out | wc -l` +if [ $nb -ne $nbok ]; then + rstat=2 +fi +dstat=0 +end_test