]> git.sur5r.net Git - bacula/bacula/blob - regress/README
Restructure regress configuration
[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 You can run all the disk based tests by doing:
58
59   ./do_file
60
61 The disk based tests are totally separate from any production
62 system, provided you have configured the database appropriately     
63 as noted above.
64
65 You can run all the disk and most of the tape tests by doing:
66
67   ./do_all
68
69 ======== Important !!! ============
70 When running the tape tests, Bacula will write on any tape that
71 is in the tape drive that you have configured.  If it is a production
72 Bacula tape, it will be destroyed.  If you have configured an Autochanger,
73 Bacula will write on the tapes in slots 1 and 2 thus destroying any
74 information on those tapes, even if they are Bacula production tapes.
75 =================================== 
76
77 Each of the above calls one or more scripts. By looking at the
78 scripts available in this directory, you can see that there are a number
79 of options for running tests.
80
81 You can run them individually as:
82
83    tests/two-jobs-test
84
85 or all non-root tests (my normal testing under my account)
86
87   ./all-non-root-tests
88
89 or all tests (I only run these before a production release):
90
91    su
92    ./all-tests
93
94
95 after running the root tests, while still root, it is a good idea
96 to do:
97
98    make reset
99
100 this cleans up any files that may be created with root permissions.
101
102 If you want to add more tests, do so by putting the shell script 
103 in the tests subdirectory. Be careful when adding (or better not)
104 new clients, pools, and such to the test-bacula-dir.conf.in file
105 as it may invalidate a good number of tests, which respond to
106 questions by answering with a number (i.e. the order of the selection
107 list is known). It might be better to add your own testb-bacula...
108 configuration file.  
109
110 To avoid re-doing a make setup if you have made a change to the
111 conf files, and you do not need a new copy of the source, you can simply do:
112
113    make sed
114
115 Debugging failed tests:
116 Prior versions required editing the tests/xxxx and changing a debug flag.
117 However, that has been replaced by two environment variables:
118
119    REGRESS_DEBUG
120    REGRESS_WAIT
121
122 If you define REGRESS_DEBUG, e.g.
123
124    REGRESS_DEBUG=1
125    export REGRESS_DEBUG
126
127 then run a test, it will display the job and debug output.
128
129 If you define REGRESS_WAIT, the script will stop and request:
130
131 Start Bacula under debugger and enter anything when ready ...
132
133 At this point, you can start any of the daemons under the debugger,
134 then answer the message by entering any character.  The script will         
135 then continue. For any daemon or daemons that you have manually started,
136 you will see an error message when the script attempts to run a second
137 copy, but those messages can be ignored.  This makes it reasonably easy
138 to run any component or components under the debugger if necessary.
139
140 Explicit example:
141
142 In shell window 1.
143
144 cd regress
145 export REGRESS_DEBUG=1
146 export REGRESS_WAIT=1
147 tests/name-of-script-test
148 (wait until it tells you to start the debugger)
149
150 In shell window 2
151
152 cd regress/bin
153 gdb bacula-xx    (where xx is the component you want to debug).
154 (possibly set a break point -- normally not)
155 run -s -f
156 (wait for the output to stop)
157
158 In shell window 1
159 (enter any character or simply a return)
160 (ignore the error message it prints complaining that the daemon
161 you are debugging is already running, which is in fact the case).
162
163
164 That is all there is to it.  The debugger window will get some
165 output and will stop waiting for input if anything goes wrong
166 like a seg fault.  At that point, you can enter commands.
167
168 The procedure avoids modifying the test scripts and trying to
169 find pids and the such.  If you want less debug output when
170 debugging, don't set REGRESS_DEBUG=1.
171
172 ===
173
174 Also, if you run from time to time on a computer that is not connected
175 to the network, please be sure that "hostname" is set to "localhost",
176 otherwise, your tests may fail because the hostname used by Bacula's
177 ./configure cannot be properly resolved.
178
179 Anyway, you can debug where it is happening in the source code using the 
180 following example.  For example, here I get the following backtrace:
181
182 ======= Backtrace: =========
183 /lib/libc.so.6[0xb7b9d6e1]
184 /lib/libc.so.6(cfree+0x89)[0xb7b9ed79]
185 /home/kern/bacula/regress/bin/bacula-fd[0x8082ae5]
186 /home/kern/bacula/regress/bin/bacula-fd[0x8082d58]
187 /home/kern/bacula/regress/bin/bacula-fd[0x80838ac]
188 /home/kern/bacula/regress/bin/bacula-fd[0x807aa3f]
189 /home/kern/bacula/regress/bin/bacula-fd[0x807ac29]
190 /home/kern/bacula/regress/bin/bacula-fd[0x804d188]
191 /lib/libc.so.6(__libc_start_main+0xdc)[0xb7b4ef9c]
192 /home/kern/bacula/regress/bin/bacula-fd[0x804cd21]
193
194 Now to convert this into something more meaningful, kill off any hung Bacula 
195 processes.  Note the one that was running -- above you see that it was 
196 bacula-fd, then bring the same binary up in the debugger.  Then start at the 
197 first bacula-fd line, and feed the hex number to gdb as follows:
198
199 info symbol 0x8082ae5
200 free_addresses(dlist*) + 53 in section .text
201
202 info symbol 0x8082d58
203 add_address(dlist**, IPADDR::i_type, unsigned short, int, char const*, char 
204 const*, char**) + 568 in section .text