1#!/bin/sh
2#
3# Run a simple backup but
4#   split the archive into two volumes, then restore
5#   files on only one of the volumes and ensure that
6#   the other volume is not used.  I.e. bsr optimization
7#   works.
8#
9TestName="bsr-opt-test"
10JobName=bsr-opt
11. scripts/functions
12
13scripts/cleanup
14scripts/copy-test-confs
15change_jobname NightlySave $JobName
16
17# Directory to backup.
18# This directory will be created by setup_data().
19BackupDirectory="${tmp}/data"
20
21# Use a tgz to setup data to be backuped.
22# Data will be placed at "${tmp}/data/".
23setup_data data/small.tgz
24
25start_test
26
27cat <<END_OF_DATA >${cwd}/tmp/bconcmds
28@$out /dev/null
29messages
30@$out ${tmp}/log1.out
31label storage=File1 volume=TestVolume001
32label storage=File1 volume=TestVolume002
33update Volume=TestVolume001 MaxVolBytes=10000
34run job=$JobName storage=File1 yes
35wait
36messages
37@#
38@# now do a restore
39@#
40@$out ${tmp}/log2.out
41setdebug level=150 storage=File1
42restore bootstrap=${working}/restore.bsr where=${tmp}/bareos-restores select storage=File1
43unmark *
44cd ${BackupDirectory}
45mark *
46ls
47done
48yes
49wait
50messages
51quit
52END_OF_DATA
53
54run_bareos
55check_for_zombie_jobs storage=File1
56stop_bareos
57#
58# This test is not really reliable. What we want to do is
59#   to select files on only one Volume, then insure here
60#   that only one Volume is chosen.
61#
62grep TestVolume002 ${working}/restore.bsr 2>&1 >/dev/null
63bsrstat=$?
64if [ $bsrstat != 0 ]; then
65   echo "  !!!!! Volume selection error         !!!!! "
66   echo "  !!!!! Volume selection error         !!!!! " >>test.out
67fi
68
69check_two_logs
70
71check_restore_diff
72
73# end tests and check for error codes
74end_test
75
76