]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl make runscript-test working
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 20 Apr 2007 20:21:33 +0000 (20:21 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Fri, 20 Apr 2007 20:21:33 +0000 (20:21 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4572 91ce42f0-d328-0410-95d8-f526ca767f89

regress/scripts/bacula-dir.conf.testrunscript.in
regress/tests/runscript-test

index 9efaf661582527b103f9756406147c6d274f83e6..2228c63a64b11905b306b41fdece0c0c09b3c71a 100644 (file)
@@ -99,6 +99,33 @@ Job {
   Run After Failed Job = "/bin/echo RunAfterFailedJob"
 }
 
+#@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"
+#we dont execute FAILED2 
+#@hostname@-dir: AfterJob: run command "/bin/echo RunAfterFailedJob"
+Job {
+  Name = "RUN_FD_FAILED2"
+  FileSet = FS_TESTJOB  
+  JobDefs = DefaultJob
+  RunScript {
+    Command = "/bin/false RUN_FD_FAILED1"
+    abortjobonerror = yes
+    RunsWhen = Before
+  }
+  RunScript {
+    Command = "/bin/false RUN_FD_FAILED2"
+    abortjobonerror = yes
+    RunsWhen = Before
+  }
+  RunScript {
+    Command = "/bin/false RUN_FD_FAILED3"
+    abortjobonerror = yes
+    RunsOnFailure = yes
+    RunsWhen = Before
+  }
+
+  Run After Failed Job = "/bin/echo RunAfterFailedJob"
+}
+
 #@hostname@-fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"
 #Backup OK -- with warnings
 Job {
@@ -140,13 +167,13 @@ Storage {
 # Generic catalog service
 Catalog {
   Name = MyCatalog
-  dbname = bacula; user = bacula; password = ""
+  dbname = regress; user = regress; password = ""
 }
 
 
 Messages {
   Name = Standard
-  stdout = all, !skipped
+  console = all, !skipped, !saved
 }
 
 # Default pool definition
index 77212621fc5bfd73bda94cf6ddd40f74c09ac687..54210228a8f4a32c7e10379cb07bb83856ce72b5 100755 (executable)
@@ -4,39 +4,47 @@
 #
 
 TestName="runscript-test"
+JobName=backup
 
 . scripts/functions
 set_debug 0
 copy_test_confs
 
 rm -f bin/bacula-dir.conf
+rm -f tmp/RUN*log
 /bin/cp -f scripts/bacula-dir.conf.testrunscript bin/bacula-dir.conf
 
-echo "${cwd}/build" >/tmp/file-list
+echo "${cwd}/build/po" >/tmp/file-list
 
 start_test
 
 cat <<END_OF_DATA >tmp/bconcmds
-@output /dev/null
+@$out /dev/null
 messages
 label volume=TestVolume001
-@#setdebug level=100 storage=File
-@output tmp/log.RUN2.out
+@$out tmp/RUN_FD_WARNING.log
 run job=RUN_FD_WARNING yes
 wait
-@sleep 5
 messages
+@sleep 1
+@$out tmp/RUN_ALL_OK.log
 run job=RUN_ALL_OK yes
 wait
-@sleep 5
 messages
+@sleep 1
+@$out tmp/RUN_FD_FAILED.log
 run job=RUN_FD_FAILED yes
 wait
-@sleep 5
 messages
+@sleep 1
+@$out tmp/RUN_DIR_FAILED.log
 run job=RUN_DIR_FAILED yes
 wait
-@sleep 5
+messages
+@sleep 1
+@$out tmp/RUN_FD_FAILED2.log
+run job=RUN_FD_FAILED2 yes
+wait
 messages
 st dir
 quit
@@ -44,47 +52,65 @@ END_OF_DATA
 
 
 bin/bacula start
-cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf &> tmp/log.RUN1.out
-
+cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
 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
+export dstat=0
+export bstat=0
+export rstat=0
+
+if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"'          tmp/RUN_ALL_OK.log   &&
+   grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob'                    tmp/RUN_ALL_OK.log   &&
+   grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob'  tmp/RUN_ALL_OK.log   &&
+   grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob'             tmp/RUN_ALL_OK.log
 then
-   [ "$debug" -eq 1 ] && echo RUN_ALL_OK ok
+   [ "$debug" = 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
+if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log   &&
+   grep -q 'dir: AfterJob: RunAfterFailedJob'                        tmp/RUN_DIR_FAILED.log   &&
+   true #   grep -q 'Backup OK -- with warnings'                              tmp/RUN_DIR_FAILED.log
 then
-   [ "$debug" -eq 1 ] && echo RUN_DIR_FAILED ok
+   [ "$debug" = 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
+if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"'  tmp/RUN_FD_FAILED.log   &&
+   grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"'  tmp/RUN_FD_FAILED.log   &&
+   grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"'      tmp/RUN_FD_FAILED.log   &&
+   grep -q '*** Backup Error ***'                                          tmp/RUN_FD_FAILED.log
 then
-   [ "$debug" -eq 1 ] && echo RUN_FD_FAILED ok
+   [ "$debug" = 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
+if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"'   tmp/RUN_FD_FAILED2.log &&
+   ! grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log &&
+   grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"'   tmp/RUN_FD_FAILED2.log &&
+   grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"'       tmp/RUN_FD_FAILED2.log &&
+   grep -q '*** Backup Error ***'                                           tmp/RUN_FD_FAILED2.log
+
+then
+   [ "$debug" = 1 ] && echo RUN_FD_FAILED ok
+else
+   echo "RUN_FD_FAILED2 in error"
+   rstat=1
+fi
+
+if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log   &&
+   grep -q 'Backup OK -- with warnings'                                   tmp/RUN_FD_WARNING.log
 then
-   [ "$debug" -eq 1 ] && echo RUN_FD_WARNING ok
+   [ "$debug" = 1 ] && echo RUN_FD_WARNING ok
 else
    echo "RUN_FD_WARNING in error"
    rstat=1
 fi
 
+end_test
\ No newline at end of file