1#!/bin/sh
2#
3#  Test if Bareos can automatically create a Volume label.
4#
5
6TestName="auto-label-test"
7JobName=AutoLabel
8. scripts/functions
9
10copy_test_confs
11
12
13# Directory to backup.
14# This directory will be created by setup_data().
15BackupDirectory="${tmp}/data"
16
17# Use a tgz to setup data to be backuped.
18# Data will be placed at "${tmp}/data/".
19setup_data data/small.tgz
20
21# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
22echo "${BackupDirectory}" >${tmp}/file-list
23
24
25
26cp ${cwd}/bin/bareos-dir.conf ${cwd}/tmp/1
27sed "s%# Label Format%  Label Format%" ${cwd}/tmp/1 >${cwd}/bin/bareos-dir.conf
28
29change_jobname CompressedTest $JobName
30start_test
31
32cat <<END_OF_SCRIPT >${cwd}/tmp/bconcmds
33@$out /dev/null
34messages
35@$out ${cwd}/tmp/log1.out
36status all
37status all
38list pools
39messages
40@#setdebug level=110 storage=File
41run job=$JobName storage=File yes
42list pools
43list volumes
44wait
45sql
46SELECT StartTime, JobFiles, JobId, Level, count(*) AS nb_jobmedia
47FROM JobMedia join Job using (JobId) join Client using (ClientId)
48where Client.Name = 'localhost-fd' group by JobId, Level, StartTime,
49JobFiles order by JobId desc ;
50
51messages
52@#
53@# now do a restore
54@#
55@$out ${cwd}/tmp/log2.out
56@#setdebug level=400 storage=File
57restore where=${cwd}/tmp/bareos-restores select storage=File
58unmark *
59mark *
60count
61ls *
62dir *
63find Makefile
64pwd
65lsmark
66estimate
67?
68help
69done
70yes
71wait
72messages
73quit
74END_OF_SCRIPT
75
76run_bareos
77check_for_zombie_jobs storage=File
78stop_bareos
79
80check_two_logs
81check_restore_diff
82end_test
83