Navigation Menu

Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
fixes use of variables for package tests.
Browse files Browse the repository at this point in the history
Replaced some paths with variables available in both, local compiled and
packaged versions of bareos.
  • Loading branch information
joergsteffens committed Dec 11, 2017
1 parent 6652b4c commit a5a19fc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions scripts/cleanup
Expand Up @@ -32,8 +32,8 @@ rm -rf ${conf}/tls/


# bin directory does not always exist
if [ -d ${scripts} ] ; then
if [ -f ${scripts}/bareos ] ; then
if [ -d ${scripts} ]; then
if [ -f ${scripts}/bareos ]; then
${scripts}/bareos stop 2>&1 >/dev/null
fi
${scripts}/drop_bareos_tables ${DBTYPE} >/dev/null 2>&1
Expand Down
10 changes: 5 additions & 5 deletions tests/bextract-test
Expand Up @@ -38,8 +38,8 @@ messages
@#
@# now build the bsr file but do not restore
@#
@$out ${cwd}/tmp/log2.out
restore bootstrap=${cwd}/working/restore.bsr where=${cwd}/tmp/bareos-restores select all storage=File1 done
@$out ${tmp}/log2.out
restore bootstrap=${working}/restore.bsr where=${tmp}/bareos-restores select all storage=File1 done
no
wait
messages
Expand All @@ -52,12 +52,12 @@ stop_bareos

mkdir -p ${cwd}/tmp/bareos-restores
if test "$debug" -eq 1 ; then
$bin/bextract -v -c ${conf} -b working/restore.bsr ${cwd}/tmp ${cwd}/tmp/bareos-restores
$bin/bextract -v -c ${conf} -b ${working}/restore.bsr ${tmp} ${tmp}/bareos-restores
else
$bin/bextract -c ${conf} -b working/restore.bsr ${cwd}/tmp ${cwd}/tmp/bareos-restores 2>&1 >/dev/null
$bin/bextract -c ${conf} -b ${working}/restore.bsr ${tmp} ${tmp}/bareos-restores 2>&1 >/dev/null
fi
rstat=$?
grep "^ Termination: *Backup OK" ${cwd}/tmp/log1.out 2>&1 >/dev/null
grep "^ Termination: *Backup OK" ${tmp}/log1.out 2>&1 >/dev/null
bstat=$?
check_restore_diff
end_test
9 changes: 5 additions & 4 deletions tests/bsr-opt-test
Expand Up @@ -27,7 +27,7 @@ start_test
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
@$out ${tmp}/log1.out
label storage=File1 volume=TestVolume001
label storage=File1 volume=TestVolume002
update Volume=TestVolume001 MaxVolBytes=10000
Expand All @@ -37,9 +37,9 @@ messages
@#
@# now do a restore
@#
@$out ${cwd}/tmp/log2.out
@$out ${tmp}/log2.out
setdebug level=150 storage=File1
restore bootstrap=${cwd}/working/restore.bsr where=${cwd}/tmp/bareos-restores select storage=File1
restore bootstrap=${working}/restore.bsr where=${tmp}/bareos-restores select storage=File1
unmark *
cd ${BackupDirectory}
mark *
Expand All @@ -59,7 +59,7 @@ stop_bareos
# to select files on only one Volume, then insure here
# that only one Volume is chosen.
#
grep TestVolume002 working/restore.bsr 2>&1 >/dev/null
grep TestVolume002 ${working}/restore.bsr 2>&1 >/dev/null
bsrstat=$?
if [ $bsrstat != 0 ]; then
echo " !!!!! Volume selection error !!!!! "
Expand All @@ -72,3 +72,4 @@ check_restore_diff

# end tests and check for error codes
end_test

28 changes: 14 additions & 14 deletions tests/virtual-backup-test
Expand Up @@ -36,10 +36,10 @@ start_test
# Pool Full uses Storage=DiskChanger

# Write out bconsole commands
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
cat <<END_OF_DATA >${tmp}/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
@$out ${tmp}/log1.out
@#setdebug level=100 storage=File
label storage=File volume=FileVolume001 Pool=Default
label storage=DiskChanger volume=ChangerVolume001 slot=1 Pool=Full drive=0
Expand Down Expand Up @@ -71,7 +71,7 @@ list volumes
@# now do a normal restore of normal backups
@#
setdebug level=10 dir
restore where=${cwd}/tmp/bareos-restores select
restore where=${tmp}/bareos-restores select
unmark *
mark *
done
Expand All @@ -88,7 +88,7 @@ list jobs
@#
@# now do a restore of the consolidated Full
@#
restore where=${cwd}/tmp/bareos-restores select storage=DiskChanger
restore where=${tmp}/bareos-restores select storage=DiskChanger
unmark *
mark *
done
Expand All @@ -109,18 +109,18 @@ stop_bareos
# We only used one log so copy it to the second log
# so that any restore errors will be picked up
#
cp -f ${cwd}/tmp/log1.out ${cwd}/tmp/log2.out
cp -f ${tmp}/log1.out ${tmp}/log2.out
check_two_logs
check_restore_diff

# remove restored data as we want to restore it again after bscan run
rm -Rvf ${cwd}/tmp/bareos-restores
rm -Rf ${tmp}/bareos-restores


cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log3.out
@$out ${tmp}/log3.out
mount storage=DiskChanger volume=ChangerVolume002
purge volume=FileVolume001
Expand All @@ -141,7 +141,7 @@ stop_bareos
# prepare BSR file

#echo "volume=ChangerVolume001" >tmp/bscan.bsr
echo "volume=ChangerVolume002" >>tmp/bscan.bsr
echo "volume=ChangerVolume002" >>${tmp}/bscan.bsr
# If the database has a password pass it to bscan
if test "x${db_password}" = "x"; then
PASSWD=
Expand All @@ -155,19 +155,19 @@ BSCAN_OUT="write_stdin_to_file ${tmp}/log-bscan.out"
if is_debug; then
BSCAN_OUT="tee ${tmp}/log-bscan.out"
fi
$bin/bscan -c ${conf} $BSCANLIBDBI -B ${DBTYPE} -n ${db_name} -u ${db_user} $PASSWD -m -s -v -b $tmp/bscan.bsr Drive-0 2>&1 | $BSCAN_OUT
$bin/bscan -c ${conf} $BSCANLIBDBI -B ${DBTYPE} -n ${db_name} -u ${db_user} $PASSWD -m -s -v -b ${tmp}/bscan.bsr Drive-0 2>&1 | $BSCAN_OUT


# do a restore of the bscan-ed content
cat <<END_OF_DATA >${cwd}/tmp/bconcmds
cat <<END_OF_DATA >${tmp}/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log4.out
@$out ${tmp}/log4.out
@#setdebug level=100 storage=File
@#
@# now do a restore of the consolidated Full
@#
restore where=${cwd}/tmp/bareos-restores select storage=DiskChanger
restore where=${tmp}/bareos-restores select storage=DiskChanger
unmark *
mark *
done
Expand All @@ -188,9 +188,9 @@ stop_bareos
# We only used one log so copy it to the second log
# so that any restore errors will be picked up
#
cp -f ${cwd}/tmp/log1.out ${cwd}/tmp/log2.out
cp -f ${tmp}/log1.out ${tmp}/log2.out
check_two_logs
check_restore_diff


end_test

0 comments on commit a5a19fc

Please sign in to comment.