Skip to content

Commit

Permalink
systemtests: add bcopy to bscan-bextract-bls
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and alaaeddineelamri committed Aug 18, 2022
1 parent 96e6184 commit 4ac05e9
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
5 changes: 3 additions & 2 deletions core/src/stored/bcopy.cc
Expand Up @@ -242,12 +242,13 @@ int main(int argc, char* argv[])

Pmsg2(000, _("%u Jobs copied. %u records copied.\n"), jobs, records);

delete in_dev;
delete out_dev;

FreeJcr(in_jcr);
FreeJcr(out_jcr);

delete in_dev;
delete out_dev;

return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions systemtests/scripts/functions
Expand Up @@ -497,9 +497,9 @@ run_bscan_db()

run_bcopy()
{
print_debug "bcopyning with ${BAREOS_BCOPY_BINARY}"
print_debug "bcopying with ${BAREOS_BCOPY_BINARY}"
if test "$debug" -eq 1 ; then
"${BAREOS_BCOPY_BINARY}" -c "${conf}" "$@" </dev/null | tee "${tmp}/bcopy.out"
"${BAREOS_BCOPY_BINARY}" -c "${conf}" -d 500 "$@" </dev/null | tee "${tmp}/bcopy.out"
else
"${BAREOS_BCOPY_BINARY}" -c "${conf}" "$@" </dev/null 2>&1 >"${tmp}/bcopy.out"
fi
Expand Down
@@ -0,0 +1,11 @@
Device {
Name = FileStorage2
Media Type = File
Archive Device = storage
LabelMedia = yes; # lets Bareos label unlabeled media
Random Access = yes;
AutomaticMount = yes; # when device opened, read it
RemovableMedia = no;
AlwaysOpen = no;
Description = "File device. A connecting Director must have the same Name and MediaType."
}
27 changes: 26 additions & 1 deletion systemtests/tests/bscan-bextract-bls/testrunner
Expand Up @@ -33,6 +33,7 @@ messages
@$out $tmp/log1.out
setdebug level=100 storage=File
label volume=TestVolume001 storage=File pool=Full
label volume=TestVolume002 storage=File pool=Full
run job=$JobName yes
status director
status client
Expand Down Expand Up @@ -124,6 +125,27 @@ if [ "$my_jobid_records" -ne "$total_jobid_records" ]; then
exit 1
fi

# use bcopy to copy the job and extract it afterwards to verify copy is verbatim
# TestVolume 002 is the target volume for the copy operation
run_bcopy -v -i TestVolume001 -o TestVolume002 FileStorage FileStorage2

rm -rf "$tmp/bareos-restores"
mkdir -p "$tmp/bareos-restores"
run_bextract -vv -V TestVolume002 FileStorage2 "$tmp/bareos-restores"
ret=$?

if [ $ret -ne 0 ]; then
echo "bextract exit code: $ret"
stop_bareos
exit $ret
else
find "$tmp/bareos-restores"
check_restore_diff "${BackupDirectory}" # check extracted files
mv "$tmp/bareos-restores" "$tmp/bextract-restores" # move extracted files away
mkdir -p "$tmp/bareos-restores"
fi


cat <<END_OF_DATA >"$tmp/bconcmds2"
@#
@# now do a restore
Expand All @@ -139,7 +161,10 @@ END_OF_DATA

run_bconsole "$tmp/bconcmds2"

run_bcopy -v -i TestVolume001 -o TestVolume002 FileStorage FileStorage2





check_for_zombie_jobs storage=File

Expand Down

0 comments on commit 4ac05e9

Please sign in to comment.