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