From 052328d1672828decf9c730098d2b9095dfbfd32 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 10 Mar 2011 16:01:56 +0100 Subject: [PATCH] regress: test restore object in plugin-test --- regress/scripts/cleanup | 1 + regress/tests/plugin-test | 65 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/regress/scripts/cleanup b/regress/scripts/cleanup index d63a52e1bf..c501428061 100755 --- a/regress/scripts/cleanup +++ b/regress/scripts/cleanup @@ -13,6 +13,7 @@ rm -rf ${working}/log ${tmp}/Backup-* rm -rf ${working}/*.bsr ${working}/log*.sd rm -rf ${working}/*.trace ${working}/*.traceback ${working}/*.bactrace rm -rf ${tmp}disk-changer +rm -f ${cwd}/bin/plugins/test-plugin-fd.so find . -name "gigaslam.gif" -exec rm -f {} \; diff --git a/regress/tests/plugin-test b/regress/tests/plugin-test index 00e7d2d53d..e2604920c2 100755 --- a/regress/tests/plugin-test +++ b/regress/tests/plugin-test @@ -8,6 +8,8 @@ JobName=pluginTest scripts/cleanup scripts/copy-plugin-confs +make -C $src/src/plugins/fd install-test-plugin + file=encrypt-bug.jpg rm -rf ${cwd}/tmp/* echo "${cwd}/README" >${cwd}/tmp/file-list @@ -26,6 +28,12 @@ run job=$JobName storage=File1 yes wait status client=$CLIENT messages +setdebug level=50 trace=1 client=$CLIENT +run job=TestPluginTest storage=File1 yes +wait +status client=$CLIENT +messages +setdebug level=50 trace=0 client=$CLIENT quit END_OF_DATA @@ -39,7 +47,7 @@ messages @# @$out ${cwd}/tmp/log2.out setdebug level=50 client=$CLIENT -restore where=${cwd}/tmp select all storage=File1 done +restore fileset=pluginSet where=${cwd}/tmp select all storage=File1 done yes wait setdebug level=0 client=$CLIENT @@ -67,7 +75,7 @@ cat <${cwd}/tmp/bconcmds @# @$out ${cwd}/tmp/log2.out @#setdebug level=50 client=$CLIENT -restore where=${cwd}/tmp select all storage=File1 done +restore fileset=pluginSet where=${cwd}/tmp select all storage=File1 done yes wait messages @@ -77,6 +85,23 @@ END_OF_DATA run_bacula -d50 run_bconsole +cat <${cwd}/tmp/bconcmds +messages +@# +@# now do a restore +@# +@$out ${cwd}/tmp/log3.out +setdebug level=50 client=$CLIENT trace=1 +restore fileset=TestPluginSet where=${cwd}/tmp select all storage=File1 done +yes +wait +setdebug level=0 client=$CLIENT trace=0 +messages +quit +END_OF_DATA + +run_bconsole + check_for_zombie_jobs storage=File1 stop_bacula # @@ -90,4 +115,40 @@ check_two_logs # diff ${cwd}/${file} ${cwd}/tmp/${file} dstat=$? + +# the test-plugin should create a RestoreObject, just check +# compare restore object before/after +perl -ne ' + chomp(); + if (/Creating RestoreObject/) { + @elt = split(/\s/, $_, 7); + $clen = $elt[4]; + $cdata = $elt[6]; + $cname = $elt[5]; + } elsif (/Get RestoreObject/) { + @elt = split(/\s/, $_, 8); + $glen = $elt[4]; + $gdata = $elt[7]; + $gname = $elt[6]; + } + END { + $err=0; + if ($clen ne $glen) { + print "ERROR: $clen != $glen\n"; + $err++; + } + if ($cdata ne $gdata) { + print "ERROR: <$cdata> != <$gdata>\n"; + $err++; + } + if ($cname ne $gname) { + print "ERROR: $cname != $gname\n"; + $err++; + } + exit $err; + } +' working/*.trace + +estat=$? + end_test -- 2.39.5