]> git.sur5r.net Git - bacula/bacula/blob - regress/README
regress: Add test for bvfs-test with deleted files
[bacula/bacula] / regress / README
1              Bacula Regression
2                Kern Sibbald
3
4 This is Bacula's regression script directory.
5
6 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7 Warning!!!! Make sure not to run it on the same system 
8 with your production Catalog because the tables will all
9 be cleared. You can run it on the your production system
10 if you use a different database. E.g. if your production
11 system uses MySQL, you can use SQLite here.
12 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13
14
15 To set it up, create your personal configuration file, by
16 copying prototype.conf to config or simply editing prototype.conf
17 directly then copying it to the file config.
18
19 You must end up with a file named config in the main regress 
20 directory that has all the specifications that correspond to
21 your system.
22
23 If you are using SQLite, make sure that depkgs is pre-built if it
24 isn't already: (cd your-depkgs; make sqlite).
25
26 Note, if you use any database other than SQLite, be sure it is not              
27 your production database because Bacula will delete all the tables
28 and recreate them.  With SQLite, a new different database is created,
29 so it will not affect your production system.
30
31 Using the .conf file, you can now select between any Catalog type:
32 SQLite, SQLite3, MySQL, or PostgreSQL.  Be aware, however, if you
33 use an installed database on a production server, running these
34 tests will delete all the tables !!!!!!!!!!!!!!!!!!  I run my
35 tests on a non-production machine, and in addition, I normally use
36 SQLite as the database, while my production uses MySQL.
37
38 Then do:
39
40    make setup
41
42 You run the above one time.  This will build a Makefile from
43 Makefile.in and your xxx.conf file, copy the Bacula source,
44 configure, build it, and configure all the Bacula scripts
45 and conf files.  If you change your source, you will need to
46 redo this command.
47
48 Then you can run any of the tests in the tests subdirectory.
49 Each test whose name ends in -root requires you to be root for
50 a resonable run.  Each test is totally independent of any other
51 test. Aside from the required "make setup", each test is totally
52 self-initalizing and should clean up after itself.
53
54 All the tests expect you to execute them from the main regress 
55 directory!               
56
57 Running the disk based tests:
58
59 You can run all the disk based tests by doing:
60
61   ./do_file
62
63 The disk based tests are totally separate from any production
64 system, provided you have configured the database appropriately     
65 as noted above.
66
67 Running all the "standard" tests:
68
69 You can run all the disk and most of the tape tests by doing:
70
71   ./do_all
72
73 ======== Important !!! ============
74 When running the tape tests, Bacula will write on any tape that
75 is in the tape drive that you have configured.  If it is a production
76 Bacula tape, it will be destroyed.  If you have configured an Autochanger,
77 Bacula will write on the tapes in slots 1 and 2 thus destroying any
78 information on those tapes, even if they are Bacula production tapes.
79 =================================== 
80
81 Each of the above calls one or more scripts. By looking at the
82 scripts available in this directory, you can see that there are a number
83 of options for running tests.
84
85 You can run them individually as:
86
87    tests/two-jobs-test
88
89 or all non-root tests (my normal testing under my account)
90
91   ./all-non-root-tests
92
93 or all tests (I only run these before a production release):
94
95    su
96    ./all-tests
97
98
99 after running the root tests, while still root, it is a good idea
100 to do:
101
102    make reset
103
104 this cleans up any files that may be created with root permissions.
105
106 Tape test naming convention:
107
108 The last part of the tape test name indicates (in general) what kind
109 of test it is.  They are broken (for the most part) into test names
110 ending with:
111
112   -test     => a disk based test
113   -tape     => a tape based test (can be a standalone tape drive
114                 or an autochanger). Only one tape will be used
115                 and it is assumed to be mounted.
116   -changer  => you have an autochanger 
117
118 Adding tests:
119
120 If you want to add more tests, do so by putting the shell script 
121 in the tests subdirectory. Be careful when adding (or better not)
122 new clients, pools, and such to the test-bacula-dir.conf.in file
123 as it may invalidate a good number of tests, which respond to
124 questions by answering with a number (i.e. the order of the selection
125 list is known). It might be better to add your own testb-bacula...
126 configuration file.  
127
128 To avoid re-doing a make setup if you have made a change to the
129 conf files, and you do not need a new copy of the source, you can simply do:
130
131    make sed
132
133 Debugging failed tests:
134
135 Prior versions required editing the tests/xxxx and changing a debug flag.
136 However, that has been replaced by two environment variables:
137
138    REGRESS_DEBUG
139    REGRESS_WAIT
140
141 If you define REGRESS_DEBUG, e.g.
142
143    REGRESS_DEBUG=1
144    export REGRESS_DEBUG
145
146 then run a test, it will display the job and debug output.
147
148 If you define REGRESS_WAIT, the script will stop and request:
149
150 Start Bacula under debugger and enter anything when ready ...
151
152 At this point, you can start any of the daemons under the debugger,
153 then answer the message by entering any character.  The script will         
154 then continue. For any daemon or daemons that you have manually started,
155 you will see an error message when the script attempts to run a second
156 copy, but those messages can be ignored.  This makes it reasonably easy
157 to run any component or components under the debugger if necessary.
158
159 Explicit example:
160
161 In shell window 1.
162
163 cd regress
164 export REGRESS_DEBUG=1
165 export REGRESS_WAIT=1
166 tests/name-of-script-test
167 (wait until it tells you to start the debugger)
168
169 In shell window 2
170
171 cd regress/bin
172 gdb bacula-xx    (where xx is the component you want to debug).
173 (possibly set a break point -- normally not)
174 run -s -f
175 (wait for the output to stop)
176
177 In shell window 1
178 (enter any character or simply a return)
179 (ignore the error message it prints complaining that the daemon
180 you are debugging is already running, which is in fact the case).
181
182
183 That is all there is to it.  The debugger window will get some
184 output and will stop waiting for input if anything goes wrong
185 like a seg fault.  At that point, you can enter commands.
186
187 The procedure avoids modifying the test scripts and trying to
188 find pids and the such.  If you want less debug output when
189 debugging, don't set REGRESS_DEBUG=1.
190
191 ===
192
193 Also, if you run from time to time on a computer that is not connected
194 to the network, please be sure that "hostname" is set to "localhost",
195 otherwise, your tests may fail because the hostname used by Bacula's
196 ./configure cannot be properly resolved.
197
198 Anyway, you can debug where it is happening in the source code using the 
199 following example.  For example, here I get the following backtrace:
200
201 ======= Backtrace: =========
202 /lib/libc.so.6[0xb7b9d6e1]
203 /lib/libc.so.6(cfree+0x89)[0xb7b9ed79]
204 /home/kern/bacula/regress/bin/bacula-fd[0x8082ae5]
205 /home/kern/bacula/regress/bin/bacula-fd[0x8082d58]
206 /home/kern/bacula/regress/bin/bacula-fd[0x80838ac]
207 /home/kern/bacula/regress/bin/bacula-fd[0x807aa3f]
208 /home/kern/bacula/regress/bin/bacula-fd[0x807ac29]
209 /home/kern/bacula/regress/bin/bacula-fd[0x804d188]
210 /lib/libc.so.6(__libc_start_main+0xdc)[0xb7b4ef9c]
211 /home/kern/bacula/regress/bin/bacula-fd[0x804cd21]
212
213 Now to convert this into something more meaningful, kill off any hung Bacula 
214 processes.  Note the one that was running -- above you see that it was 
215 bacula-fd, then bring the same binary up in the debugger.  Then start at the 
216 first bacula-fd line, and feed the hex number to gdb as follows:
217
218 info symbol 0x8082ae5
219 free_addresses(dlist*) + 53 in section .text
220
221 info symbol 0x8082d58
222 add_address(dlist**, IPADDR::i_type, unsigned short, int, char const*, char 
223 const*, char**) + 568 in section .text
224
225 Testing a Binary Installation:
226
227 If you have installed your Bacula from a binary release such as (rpms or
228 debs), you can still run regression tests on it.  First, make sure that your
229 regression config file uses the same catalog backend as your installed
230 binaries.  Then define the variables bin and scripts variables in your config
231 file.
232
233 Example:
234 bin=/opt/bacula/bin
235 scripts=/opt/bacula/scripts
236
237 The ./scripts/prepare-other-loc will tweak the regress scripts to use
238 your binary location. You will need to run it manually once before you run any
239 regression tests.
240
241 $ ./scripts/prepare-other-loc
242 $ ./tests/backup-bacula-test
243 ...
244
245 All regression scripts must be run by hand or by calling the test scripts.  
246 These are principally scripts that begin with all_... such as all_disk_tests},
247 ./all_tests
248
249 None of the 
250 ./do_disk, ./do_all, ./nightly...  scripts will work.
251
252 If you want to switch back to running the regression scripts from source, first
253 remove the bin and scripts variables from your config file and
254 rerun the make setup step.
255