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