1#!/bin/sh
2#
3# Run a simple backup  then create some
4#   new files, do an Incremental and restore those two files.
5#
6TestName="short-incremental-test"
7JobName=Incremental
8. scripts/functions
9
10${rscripts}/cleanup
11${rscripts}/copy-test-confs
12change_jobname CompressedTest $JobName
13
14# Directory to backup.
15# This directory will be created by setup_data().
16BackupDirectory="${tmp}/data"
17
18# Use a tgz to setup data to be backuped.
19# Data will be placed at "${tmp}/data/".
20setup_data data/small.tgz
21
22# the default fileset FS_TESTJOB backups all file and directories defined in "${tmp}/file-list".
23echo "${BackupDirectory}" >${tmp}/file-list
24
25echo "${BackupDirectory}/ficheriro1.txt" >${tmp}/restore-list
26echo "${BackupDirectory}/ficheriro2.txt" >>${tmp}/restore-list
27
28start_test
29
30cat <<END_OF_DATA >${tmp}/bconcmds
31@$out /dev/null
32messages
33@$out ${tmp}/log1.out
34@#setdebug level=100 storage=File
35@#setdebug level=200 client
36@#setdebug level=100 director
37label storage=File volume=TestVolume001
38label storage=File volume=TestVolume002
39run job=$JobName yes
40status client
41wait
42messages
43quit
44END_OF_DATA
45
46run_bareos
47check_for_zombie_jobs storage=File
48#
49# Now create two new files to be restored later
50#
51sleep 1
52echo "ficheriro1.txt" >${BackupDirectory}/ficheriro1.txt
53echo "ficheriro2.txt" >${BackupDirectory}/ficheriro2.txt
54
55cat <<END_OF_DATA >${tmp}/bconcmds
56@$out /dev/null
57messages
58@$out ${tmp}/log1.out
59@# Force Incremental on the second Volume
60update volume=TestVolume001 VolStatus=Used
61run level=Differential job=$JobName yes
62wait
63messages
64quit
65END_OF_DATA
66
67run_bconsole
68
69cat <<END_OF_DATA >${tmp}/bconcmds
70@$out /dev/null
71messages
72@$out ${tmp}/log1.out
73setdebug level=200 storage=File
74run level=Incremental job=$JobName yes
75wait
76messages
77@#
78@# now do a restore
79@#
80@$out ${tmp}/log2.out
81setdebug level=10 storage=File
82restore where=${tmp}/bareos-restores storage=File file=<${tmp}/restore-list
83yes
84wait
85status client
86status storage=File
87messages
88quit
89END_OF_DATA
90
91run_bconsole
92check_for_zombie_jobs storage=File
93stop_bareos
94
95check_two_logs
96check_restore_files_diff `cat ${tmp}/restore-list`
97end_test
98