4 This is Bacula's regression script directory.
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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
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.
19 You must end up with a file named config in the main regress
20 directory that has all the specifications that correspond to
23 If you are using SQLite, make sure that depkgs is pre-built if it
24 isn't already: (cd your-depkgs; make sqlite).
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.
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.
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
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.
54 All the tests expect you to execute them from the main regress
57 Running the disk based tests:
59 You can run all the disk based tests by doing:
63 The disk based tests are totally separate from any production
64 system, provided you have configured the database appropriately
67 Running all the "standard" tests:
69 You can run all the disk and most of the tape tests by doing:
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 ===================================
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.
85 You can run them individually as:
89 or all non-root tests (my normal testing under my account)
93 or all tests (I only run these before a production release):
99 after running the root tests, while still root, it is a good idea
104 this cleans up any files that may be created with root permissions.
106 Tape test naming convention:
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
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
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...
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:
133 Debugging failed tests:
135 Prior versions required editing the tests/xxxx and changing a debug flag.
136 However, that has been replaced by two environment variables:
141 If you define REGRESS_DEBUG, e.g.
146 then run a test, it will display the job and debug output.
148 If you define REGRESS_WAIT, the script will stop and request:
150 Start Bacula under debugger and enter anything when ready ...
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.
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)
172 gdb bacula-xx (where xx is the component you want to debug).
173 (possibly set a break point -- normally not)
175 (wait for the output to stop)
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).
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.
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.
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.
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:
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]
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:
218 info symbol 0x8082ae5
219 free_addresses(dlist*) + 53 in section .text
221 info symbol 0x8082d58
222 add_address(dlist**, IPADDR::i_type, unsigned short, int, char const*, char
223 const*, char**) + 568 in section .text
225 Testing a Binary Installation:
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
235 scripts=/opt/bacula/scripts
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
241 $ ./scripts/prepare-other-loc
242 $ ./tests/backup-bacula-test
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},
250 ./do_disk, ./do_all, ./nightly... scripts will work.
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.