]> git.sur5r.net Git - bacula/bacula/blobdiff - regress/tests/regexwhere-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / regexwhere-test
index cecbc5f95f47c6bd998ccd3ab7110648486ffcb5..c2fa8ea88fd683e049dda1771434484867cdb09b 100755 (executable)
@@ -1,4 +1,9 @@
 #!/bin/sh
+#
+# Copyright (C) 2000-2015 Kern Sibbald
+# License: BSD 2-Clause; see file LICENSE-FOSS
+#
+
 #
 #  Test file relocation feature
 #
@@ -8,15 +13,22 @@ JobName=backup
 
 . scripts/functions
 
-copy_test_confs
+scripts/cleanup
+scripts/copy-test-confs
 
-rm -f bin/bacula-dir.conf
-rm -f tmp/RUN*
-rm -f ${cwd}/build/po/*old*
-rm -rf tmp/po
 /bin/cp -f scripts/bacula-dir.conf.regexwhere bin/bacula-dir.conf
 
-echo "${cwd}/build/po" >/tmp/file-list
+#
+# Remove the !restored from the messages resource because
+#  this test needs the restored listing to verify the
+#  restore results
+#
+outf="${cwd}/tmp/sed_tmp"
+echo "s%, \!restored%%g" >${outf}
+cp ${cwd}/bin/bacula-fd.conf ${cwd}/tmp/1
+sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-fd.conf
+
+echo "${cwd}/build/po" >tmp/file-list
 
 start_test
 
@@ -95,7 +107,7 @@ wait
 messages
 @##################################
 @$out tmp/RUN_JobG
-restore strip_prefix="${cwd}" add_prefix="/tmp/bacula-restore"
+restore strip_prefix="${cwd}" add_prefix="${tmp}/bacula-restore.$$"
 5
 cd ${cwd}/build/po
 m *.po
@@ -146,7 +158,7 @@ mod
 @## Where 
 m
 9
-/tmp/bacula-restore-it
+tmp/bacula-restore-it
 m
 @## use add suffix
 10
@@ -160,9 +172,8 @@ messages
 quit
 END_OF_DATA
 
+run_bacula
 
-bin/bacula start
-cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf > /dev/null
 stop_bacula
 
 
@@ -174,8 +185,10 @@ export bstat
 export rstat
 
 J=JobA
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "${cwd}/build/po/fr.old.po" tmp/RUN_$J 
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "${cwd}/build/po/fr.old.po" tmp/RUN_$J > /dev/null
+
+if [ $? = 0 ] 
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -184,9 +197,10 @@ else
 fi
 
 J=JobB
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "tmp/bacula-restore${cwd}/po/fr.po.old" tmp/RUN_$J > /dev/null
 # $cwd begins with /
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "/tmp/bacula-restore${cwd}/po/fr.po.old" tmp/RUN_$J
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -195,8 +209,9 @@ else
 fi
 
 J=JobC
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "/tmp/bacula-restore${cwd}/build/po/fr.po" tmp/RUN_$J
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "tmp/bacula-restore${cwd}/build/po/fr.po" tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -205,7 +220,8 @@ else
 fi
 
 J=JobD
-if grep -q "Restore Error"  tmp/RUN_$J
+grep "Restore Error"  tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -214,8 +230,9 @@ else
 fi
 
 J=JobE
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "${cwd}/tmp/fr.po"  tmp/RUN_$J
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "${cwd}/tmp/fr.po"  tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -224,8 +241,9 @@ else
 fi
 
 J=JobF
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "${cwd}/build/po/fr.po" tmp/RUN_$J
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "${cwd}/build/po/fr.po" tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -234,18 +252,21 @@ else
 fi
 
 J=JobG
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "/tmp/bacula-restore/build/po/fr.po" tmp/RUN_$J
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "tmp/bacula-restore.$$/build/po/fr.po" tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
    echo "$J in error"
    rstat=1
 fi
+rm -rf ${tmp}/bacula-restore.$$
 
 J=JobH
-if grep -q "Restore OK"  tmp/RUN_$J &&
-   grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -254,8 +275,9 @@ else
 fi
 
 J=JobI
-if grep  -q "Restore OK"  tmp/RUN_$J &&
-   grep  -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
+grep "Restore OK"  tmp/RUN_$J > /dev/null && \
+grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -265,10 +287,11 @@ fi
 
 
 J=JobJ
-if grep -q "Restore OK"      tmp/RUN_$J &&
-   grep -q "/etc/passwd.old" tmp/RUN_$J &&
-   grep -q -e "Where: */tmp/bacula-restore-it" tmp/RUN_$J &&
-   grep -q "${cwd}/build/po/fr.po.old" tmp/RUN_$J
+grep "Restore OK"      tmp/RUN_$J > /dev/null && \
+grep "/etc/passwd.old" tmp/RUN_$J > /dev/null && \
+grep "Where: *tmp/bacula-restore-it" tmp/RUN_$J > /dev/null && \
+grep "${cwd}/build/po/fr.po.old" tmp/RUN_$J > /dev/null
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo $J ok
 else
@@ -283,7 +306,8 @@ find ${cwd}/build > tmp/list
 sed -e 's/[Rr][Ee][Aa][Dd][Mm][Ee]/readme/' -e 's/\([ch]\)$/.old.\1/' tmp/list > tmp/list.sed
 ./build/src/tools/bregtest -s -f tmp/list -e '/readme/readme/i,/([ch])$/.old.$1/' > tmp/list.bsed
 
-if diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
+diff tmp/list.bsed tmp/list.sed >/dev/null 2>&1
+if [ $? = 0 ]
 then
     [ "$debug" = 1 ] && echo bregtest ok
 else