]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/exclude-dir-test
Tweak license
[bacula/bacula] / regress / tests / exclude-dir-test
1 #!/bin/sh
2 #
3 # Author: Eric Bollengier, 2009
4 # License: AGPLv3
5 #
6 # Run a simple backup of the Bacula build directory using the compressed option
7 #   then backup a second time and finally restore it
8 #
9 TestName="exclude-dir-test"
10 JobName=exclude-dir
11 . scripts/functions
12
13 cwd=`pwd`
14 scripts/cleanup
15 scripts/copy-test-confs
16 cat >> $conf/bacula-dir.conf <<EOF
17 FileSet {
18   Name = "ExcludeDir"
19   Include { 
20     Exclude Dir Containing = ".nobkp"
21     Options {
22       signature=MD5
23       compression=GZIP
24     }
25     File = "$cwd/build"
26   }
27   Include { 
28     Exclude Dir Containing = "bacula-dir.conf"
29     Options {
30       signature=MD5
31       compression=GZIP
32     }
33     File = "$conf"
34     File = "$rscripts"
35     File = "$cwd/build/po"
36   }
37 }
38 EOF
39 sed 's/FileSet="CompressedSet"/FileSet=ExcludeDir/' $conf/bacula-dir.conf >$tmp/1
40 cp -f $tmp/1 $conf/bacula-dir.conf
41 change_jobname CompressedTest $JobName
42 start_test
43
44 mkdir -p ${cwd}/build/src/xxtestdir
45 touch ${cwd}/build/src/xxtestdir/.nobkp
46 cp ${cwd}/build/src/dird/*.c ${cwd}/build/src/xxtestdir
47
48 cat >tmp/bconcmds <<END_OF_DATA
49 @$out /dev/null
50 messages
51 @$out $tmp/log3.out
52 estimate job=$JobName listing
53 messages
54 @$out $tmp/log1.out
55 label storage=File volume=TestVolume001
56 run job=$JobName yes
57 wait
58 messages
59 @$out $tmp/log2.out
60 restore where=${cwd}/tmp/bacula-restores select all storage=File done
61 yes
62 wait
63 messages
64 quit
65 END_OF_DATA
66
67 run_bacula
68 check_for_zombie_jobs storage=File 
69 stop_bacula
70
71 check_two_logs
72
73 # should be ok if we remove the xxtestdir
74 rm -rf ${cwd}/build/src/xxtestdir
75 check_restore_diff
76
77 grep '/xxtestdir' $tmp/log3.out > /dev/null
78 if [ $? = 0 ]; then
79     print_debug "ERROR: Should not see xxtestdir in estimate output"
80     bstat=2
81 fi
82
83 # build/po is included 2 times with a different exclude file
84 # we shouldn't see scripts and bin
85 nb=`egrep -c 'build/po/fr.po$' $tmp/log3.out`
86 if [ $nb != 2 ]; then
87     print_debug "ERROR: Should see fr.po two times"
88     bstat=2
89 fi
90
91 grep $rscripts $tmp/log3.out > /dev/null
92 if [ $? = 0 ]; then
93     print_debug "ERROR: Should not $rscripts in estimate output"
94     bstat=2
95 fi
96
97 grep $conf $tmp/log3.out > /dev/null
98 if [ $? = 0 ]; then
99     print_debug "ERROR: Should not $conf in estimate output"
100     bstat=2
101 fi
102
103 end_test