]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bvfs-acl-test
Make out of freespace non-fatal for removable devices -- i.e. behaves like tape
[bacula/bacula] / regress / tests / bvfs-acl-test
1 #!/bin/sh
2 #
3 # Copyright (C) 2000-2017 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
5 #
6 #
7 # Run a simple backup of the Bacula build directory then create some           
8 #   new files, do an Incremental and restore those two files.
9 # test the bvfs interface
10 #
11 TestName="bvfs-acl-test"
12 JobName=Incremental 
13 . scripts/functions
14
15 ${rscripts}/cleanup
16 ${rscripts}/copy-test-confs
17 echo "${tmpsrc}" >${tmp}/file-list
18 echo "${cwd}/build" >> ${tmp}/file-list
19
20 mkdir -p ${tmpsrc}
21 cp -p ${src}/src/dird/*.c ${tmpsrc}
22 cd ${tmp}
23 echo "${tmpsrc}/ficheriro1.txt" >restore-list
24 echo "${tmpsrc}/ficheriro2.txt" >>restore-list
25 cd ${cwd}
26
27 # Create a new client
28 $bperl -e "print get_resource('$conf/bacula-dir.conf', 'Client', '$HOST-fd')" | sed "s/$HOST-fd/$HOST-fd2/" >> $conf/bacula-dir.conf
29 $bperl -e "print get_resource('$conf/bacula-dir.conf', 'Client', '$HOST-fd')" | sed "s/$HOST-fd/$HOST-fd3/" >> $conf/bacula-dir.conf
30
31 cat <<EOF >> $conf/bacula-dir.conf
32 Console {
33   Name = restricted-user
34   Password = "xxx"
35   JobACL = NightlySave, $JobName
36   ClientACL = $HOST-fd
37   PoolACL = Default
38   FileSetACL = CompressedSet
39   CatalogACL = *all*
40   CommandACL = show, .jobs, messages, .pool, .storage, .client, .fileset, .bvfs_get_jobids, .bvfs_restore, .bvfs_lsdirs, .bvfs_update, reload, quit, .bvfs_lsfiles
41   WhereACL = "/"
42   DirectoryAcl = *all*
43 }
44 EOF
45
46 cp $conf/bconsole.conf $conf/bconsole.conf.2
47
48 cat <<EOF >> $conf/bconsole.conf.2
49 Console {
50   Name = restricted-user
51   Password = xxx
52 }
53 EOF
54
55 change_jobname CompressedTest $JobName
56 start_test
57
58 cat <<END_OF_DATA >${tmp}/bconcmds
59 @$out /dev/null
60 messages
61 @$out ${tmp}/log1.out
62 label storage=File volume=TestVolume001
63 label storage=File volume=TestVolume00
64 run job=$JobName client=$HOST-fd yes
65 wait
66 messages
67 run job=$JobName client=$HOST-fd2 yes
68 wait
69 messages
70 run job=$JobName client=$HOST-fd3 yes
71 wait
72 messages
73 run job=NightlySave client=$HOST-fd yes
74 wait
75 messages
76 @exec "touch ${tmpsrc}/fic1"
77 run job=$JobName client=$HOST-fd2 yes
78 wait
79 messages
80 run job=$JobName client=$HOST-fd3 yes
81 wait
82 messages
83 run job=$JobName client=$HOST-fd yes
84 wait
85 messages
86 run job=NightlySave client=$HOST-fd yes
87 wait
88 messages
89 .bvfs_update
90 @$out $tmp/out10.log
91 .bvfs_get_jobids client=$HOST-fd
92 quit
93 END_OF_DATA
94
95 run_bacula
96 check_for_zombie_jobs storage=File $HOST-fd
97
98 cat << EOF > $tmp/cmd
99 @$out $tmp/out10.log
100 .bvfs_get_jobids client=$HOST-fd
101 .bvfs_lsfiles jobid=1 path=${tmpsrc}/ filename=dird_conf.c
102 @$out $tmp/out11.log
103 .bvfs_get_jobids client=$HOST-fd2
104 .bvfs_lsfiles jobid=2 path=${tmpsrc}/ filename=dird_conf.c
105 @$out $tmp/out12.log
106 .bvfs_get_jobids client=$HOST-fd3
107 .bvfs_lsfiles jobid=3 path=${tmpsrc}/ filename=dird_conf.c
108 EOF
109
110 cat <<END_OF_DATA >${tmp}/bconcmds
111 reload
112 END_OF_DATA
113
114 $bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
115
116 sed -i "s/out1/out2/" $tmp/cmd
117 sed -i "s/ClientACL = $HOST-fd/ClientACL = $HOST-fd2/" $conf/bacula-dir.conf
118
119 run_bconsole
120
121 $bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
122
123 sed -i "s/out2/out3/" $tmp/cmd
124 sed -i "s/ClientACL = $HOST-fd2/ClientACL = $HOST-fd3/" $conf/bacula-dir.conf
125
126 run_bconsole
127
128 $bin/bconsole -c $conf/bconsole.conf.2 < $tmp/cmd
129
130 stop_bacula
131
132 grep -E "\s1\s.*dird_conf.c" $tmp/out10.log > /dev/null
133 if [ $? -ne 0 ]; then
134     print_debug "ERROR: should find dird_conf.c for jobid 1 in out10.log"
135     estat=1
136 fi
137
138 grep -E "\s[32]\s.*dird_conf.c" $tmp/out11.log $tmp/out12.log > /dev/null
139 if [ $? -eq 0 ]; then
140     print_debug "ERROR: should not find dird_conf.c for jobid 2 or 3 in out10.log or out11.log"
141     estat=2
142 fi
143
144 grep -E "\s2\s.*dird_conf.c" $tmp/out21.log > /dev/null
145 if [ $? -ne 0 ]; then
146     print_debug "ERROR: should find dird_conf.c for jobid 2 in out21.log"
147     estat=3
148 fi
149
150 grep -E "\s[31]\s.*dird_conf.c" $tmp/out20.log $tmp/out22.log > /dev/null
151 if [ $? -eq 0 ]; then
152     print_debug "ERROR: should not find dird_conf.c for jobid 3 or 1 in out20.log or out22.log"
153     estat=4
154 fi
155
156 grep -E "\s3\s.*dird_conf.c" $tmp/out32.log > /dev/null
157 if [ $? -ne 0 ]; then
158     print_debug "ERROR: should find dird_conf.c for jobid 3 in out32.log"
159     estat=5
160 fi
161
162 grep -E "\s[21]\s.*dird_conf.c" $tmp/out31.log $tmp/out30.log > /dev/null
163 if [ $? -eq 0 ]; then
164     print_debug "ERROR: should not find dird_conf.c for jobid 2 or 1 in out31.log or out30.log"
165     estat=6
166 fi
167
168 end_test