#!/bin/sh
#
# Run a simple backup
#   to a tape then restore it, we do that twice to ensure that
#   we can correctly append to a tape.
#
TestName="win32-to-linux-tape"
JobName=AutoLabel
. scripts/functions

require_tape_drive

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

change_job $JobName

# Directory to backup.
# This directory will be created by setup_data().
BackupDirectory="${tmp}/data"

# Use a tgz to setup data to be backed up.
# Data will be placed at "${tmp}/data/".
setup_data data/small.tgz

# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
echo "${BackupDirectory}" >${tmp}/file-list


start_test

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

run_bareos
check_for_zombie_jobs storage=tape
stop_bareos

check_two_logs
# No diff for the moment
dstat=0
end_test
