]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/allowcompress-test
Backport from Bacula Enterprise
[bacula/bacula] / regress / tests / allowcompress-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6
7 #
8 # Run a simple backup of the Bacula build directory using the compressed option
9 #   then restore it.  Then do the same against the second storage, File1, which 
10 #   has AllowCompression=No set.
11 #
12 TestName="allowcompress-test"
13 JobName=compressed
14 . scripts/functions
15
16 scripts/cleanup
17 scripts/copy-test-confs
18 echo "${cwd}/build" >${cwd}/tmp/file-list
19
20 outf="tmp/sed_tmp"
21 echo "s/FileStorage$/FileStorage; AllowCompression=no/" > $outf
22 cp $scripts/bacula-dir.conf $tmp/1
23 sed -f ${outf} ${cwd}/tmp/1 > $scripts/bacula-dir.conf 
24
25 change_jobname CompressedTest $JobName
26 start_test
27       
28 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
29 @$out /dev/null
30 messages
31 @$out ${cwd}/tmp/log1.out
32 messages
33 label storage=File volume=TestVolume001
34 setdebug level=4 storage=File
35 run level=Full job=$JobName storage=File yes
36 wait
37 messages
38 @# 
39 @# now do a restore
40 @#
41 @$out ${cwd}/tmp/log2.out
42 restore where=${cwd}/tmp/bacula-restores select storage=File
43 unmark *
44 mark *
45 done
46 yes
47 wait
48 messages
49 @$out ${cwd}/tmp/log3.out
50 messages
51 label storage=File1 volume=TestVolume002
52 setdebug level=4 storage=File
53 run level=Full job=$JobName storage=File1 yes
54 wait
55 messages
56 @# 
57 @# now do a restore
58 @#
59 @$out ${cwd}/tmp/log2.out
60 restore where=${cwd}/tmp/bacula-restores select storage=File1
61 unmark *
62 mark *
63 done
64 yes
65 wait
66 messages
67 quit
68 END_OF_DATA
69
70 run_bacula
71 check_for_zombie_jobs storage=File
72 stop_bacula
73
74 check_two_logs
75 check_restore_diff
76 grep " Software Compression" ${cwd}/tmp/log3.out | grep "None" 2>&1 1>/dev/null
77 if [ $? = 0 ] ; then
78    echo "  !!!!! No Compression when AllowCompression=yes is set !!!!!"
79    bstat=1
80 fi
81
82 end_test