]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/delta-test
baculum: Tweak trim whitespaces from joblog
[bacula/bacula] / regress / tests / delta-test
1 #!/bin/sh
2 #
3 # Attempt to backup and restore a file with the delta plugin
4 #
5
6 TestName="delta-test"
7 JobName=pluginTest
8 . scripts/functions
9
10 scripts/cleanup
11 scripts/copy-plugin-confs
12
13 cat << EOF >> $conf/bacula-dir.conf
14 FileSet {
15  Name = "FS_DELTA"
16  Include {
17   Options {
18     signature=MD5
19   }
20  Plugin = "delta-test"
21  }
22 }
23 EOF
24
25 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "FileSet", "FS_DELTA", "Job", "pluginTest")'
26 $bperl -e 'add_attribute("$conf/bacula-dir.conf", "Accurate", "yes", "Job", "pluginTest")'
27
28 # install the delta plugin
29 make -C build/src/plugins/fd install-test-plugin >/dev/null
30
31 start_test
32
33 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
34 @$out /dev/null
35 messages
36 @$out ${cwd}/tmp/log1.out
37 label storage=File volume=TestVolume001
38 setdebug level=150 client=$CLIENT
39 estimate job=$JobName level=Full
40 setdebug level=50 client=$CLIENT
41 run job=$JobName comment="read 400 bytes of passwd" yes
42 wait
43 status client=$CLIENT
44 messages
45 run job=$JobName comment="read 100 bytes of group" level=Incremental yes
46 wait
47 messages
48 run job=$JobName comment="read 100 bytes of hosts" level=Incremental yes
49 wait
50 messages
51 run job=$JobName comment="read 100 bytes of services" level=Incremental yes
52 wait
53 messages
54 status client=$CLIENT
55 quit
56 END_OF_DATA
57
58 run_bacula
59
60 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
61 messages
62 @# 
63 @# now do a restore
64 @#
65 @$out ${cwd}/tmp/log2.out
66 setdebug level=50 client=$CLIENT
67 restore where=$tmp select all done
68 yes
69 wait
70 messages
71 @exec "mv $tmp/delta.txt $tmp/delta.OK.txt"
72 restore where=$tmp jobid=1
73 m *
74 done
75 yes
76 wait
77 messages
78 @$out ${cwd}/tmp/log3.out
79 status client
80 setdebug level=0 client=$CLIENT
81 quit
82 END_OF_DATA
83
84 run_bconsole
85
86 check_two_logs
87
88 stop_bacula
89
90 head -c 50 /etc/passwd > $tmp/source
91 head -c 50 /etc/group >> $tmp/source
92 head -c 50 /etc/hosts >> $tmp/source
93 head -c 100 /etc/services >> $tmp/source
94 head -c 400 /etc/passwd | tail -c 150 >> $tmp/source
95
96 diff -u $tmp/source $tmp/delta.OK.txt > $tmp/d
97 if [ $? -ne 0 ]; then
98     print_debug "ERROR: delta.OK.txt and source are different, restore failed"
99     dstat=1
100 fi
101
102 head -c 400 /etc/passwd > $tmp/source2
103 diff -u $tmp/source2 $tmp/delta.txt > $tmp/d
104 if [ $? -ne 0 ]; then
105     print_debug "ERROR: delta.txt and source2 are different, restore failed"
106     dstat=1
107 fi
108
109
110
111 end_test