1#!/bin/bash
2set -e
3set -u
4#
5# Run a simple backup
6#   then restore it.
7#
8TestName="$(basename "$(pwd)")"
9export TestName
10
11#shellcheck source=../environment.in
12. ./environment
13
14#shellcheck source=../scripts/functions
15. "${rscripts}"/functions
16"${rscripts}"/cleanup
17"${rscripts}"/setup
18
19# Directory to backup.
20# This directory will be created by setup_data().
21BackupDirectory="${tmp}/data"
22
23# Use a tgz to setup data to be backed up.
24# Data will be placed at "${tmp}/data/".
25setup_data "$@"
26
27start_test
28
29cat <<END_OF_DATA >$tmp/bconcmds
30@$out /dev/null
31messages
32@$out $tmp/log1.out
33setdebug level=100 storage=File
34label volume=TestVolume001 storage=File pool=Full
35status director
36status client
37status storage=File
38wait
39messages
40@#
41@# now do a restore
42@#
43@$out $tmp/log2.out
44wait
45restore client=bareos-fd fileset=SelfTest where=$tmp/bareos-restores select all done
46yes
47wait
48messages
49quit
50END_OF_DATA
51
52run_bareos "$@"
53check_for_zombie_jobs storage=File
54stop_bareos
55
56check_two_logs
57check_restore_diff ${BackupDirectory}
58end_test
59