#!/bin/sh
#
# Copyright (C) 2000-2023 Kern Sibbald
# License: BSD 2-Clause; see file LICENSE-FOSS
#
# Run a simple backup of the Bacula build directory 
#   to a tape then restore it, we do that twice to ensure that
#   we can correctly append to a tape.
#
TestName="backup-win32-tape"
JobName=backupwintape
. scripts/functions

require_tape_drive_drive

scripts/cleanup-tape
scripts/copy-win32-confs

echo "${cwd}/build" >${cwd}/tmp/file-list

change_jobname $JobName
start_test


cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@$out /dev/null
messages
@$out ${cwd}/tmp/log1.out
label storage=tape volume=TestVolume001 slot=0 pool=Default
run job=NightlySave yes
@sleep 10
status storage=tape
@sleep 30
messages
wait
messages
@# 
@# now do a restore
@#
@$outt ${cwd}/tmp/log2.out
@#restore where=${cwd}/tmp/bacula-restores select all storage=tape done
@#yes
@#wait
@#messages
END_OF_DATA

run_bacula
check_for_zombie_jobs storage=tape client=$WIN32_CLIENT
stop_bacula

check_two_logs
check_restore_diff
end_test
