From 5705ecb2930ccc9b6b3da9fff3b826f949bae195 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 24 Sep 2008 19:05:56 +0000 Subject: [PATCH] ebl Update accurate test to check the number of files that are Written during backup. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7635 91ce42f0-d328-0410-95d8-f526ca767f89 --- regress/scripts/functions | 16 ++++++++++++++-- regress/tests/accurate-test | 8 ++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/regress/scripts/functions b/regress/scripts/functions index de08eb340f..53b90e60f1 100644 --- a/regress/scripts/functions +++ b/regress/scripts/functions @@ -98,6 +98,18 @@ print_debug() fi } +check_files_written() +{ + LOG=$1 + NB=$2 + FILES=`awk '/FD Files Written:/ { last=$4 } END { print last }' $LOG` + + if [ "$NB" != "$FILES" ]; then + print_debug "Expect $NB files, get $FILES" + bstat=2 + fi +} + run_bacula() { debug_wait @@ -187,13 +199,13 @@ change_jobname() check_two_logs() { grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null - bstat=$? + bstat=${bstat-$?} grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null if test $? -eq 0; then bstat=2 fi grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null - rstat=$? + rstat=${rstat-$?} grep "^ Termination: .*Restore Error" tmp/log2.out 2>&1 >/dev/null if test $? -eq 0; then rstat=2 diff --git a/regress/tests/accurate-test b/regress/tests/accurate-test index cf43ffa130..1de8294ad1 100755 --- a/regress/tests/accurate-test +++ b/regress/tests/accurate-test @@ -7,6 +7,7 @@ # Run a accurate backup of the Bacula build directory # then restore it. # + TestName="accurate-test" JobName=backup . scripts/functions @@ -90,6 +91,7 @@ check_for_zombie_jobs storage=File check_two_logs check_restore_diff +check_files_written ${cwd}/tmp/log1.out 4 rm -rf ${cwd}/tmp/bacula-restores @@ -104,6 +106,7 @@ check_for_zombie_jobs storage=File check_two_logs check_restore_diff +check_files_written ${cwd}/tmp/log1.out 3 rm -rf ${cwd}/tmp/bacula-restores @@ -117,6 +120,7 @@ check_for_zombie_jobs storage=File check_two_logs check_restore_diff +check_files_written ${cwd}/tmp/log1.out 2 rm -rf ${cwd}/tmp/bacula-restores @@ -130,6 +134,7 @@ check_for_zombie_jobs storage=File check_two_logs check_restore_diff +check_files_written ${cwd}/tmp/log1.out 2 rm -rf ${cwd}/tmp/bacula-restores @@ -143,6 +148,7 @@ check_for_zombie_jobs storage=File check_two_logs check_restore_diff +check_files_written ${cwd}/tmp/log1.out 2 rm -rf ${cwd}/tmp/bacula-restores @@ -240,6 +246,7 @@ touch ${cwd}/build/accurate/bbbbbb run_bconsole check_for_zombie_jobs storage=File +check_files_written ${cwd}/tmp/log1.out 3 check_two_logs check_restore_diff @@ -359,6 +366,7 @@ check_for_zombie_jobs storage=File check_two_logs check_restore_diff +check_files_written ${cwd}/tmp/log1.out 1 rm -rf ${cwd}/tmp/bacula-restores -- 2.39.5