aboutsummaryrefslogtreecommitdiff
path: root/doc/overview/customizing.html
blob: fb81523a47e47e56a5c68f56d46db17ea0e5fd79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><TITLE
>Customizing DejaGnu</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="DejaGnu"
HREF="book1.html"><LINK
REL="PREVIOUS"
TITLE="The files DejaGnu produces."
HREF="outputfiles.html"><LINK
REL="NEXT"
TITLE="Global Config File"
HREF="global.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>DejaGnu: The GNU Testing Framework</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="outputfiles.html"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="global.html"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="CUSTOMIZING"
>Customizing DejaGnu</A
></H1
><P
>The site configuration file, <TT
CLASS="FILENAME"
>site.exp</TT
>,
    captures configuration-dependent values and propagates them to the
    DejaGnu test environment using Tcl variables.  This ties the
    DejaGnu test scripts into the <B
CLASS="COMMAND"
>configure</B
> and
    <B
CLASS="COMMAND"
>make</B
> programs. If this file is setup correctly,
    it is possible to execute a test suite merely by typing
    <B
CLASS="COMMAND"
>runtest</B
>.</P
><P
>DejaGnu supports two <TT
CLASS="FILENAME"
>site.exp</TT
>
    files. The multiple instances of <TT
CLASS="FILENAME"
>site.exp</TT
> are
    loaded in a fixed order built into DejaGnu. The first file loaded
    is the local file <TT
CLASS="FILENAME"
>site.exp</TT
>, and then the
    optional global <TT
CLASS="FILENAME"
>site.exp</TT
> file as
    pointed to by the <SPAN
CLASS="SYMBOL"
>DEJAGNU</SPAN
> environment
    variable.</P
><P
>There is an optional <I
CLASS="EMPHASIS"
>master</I
>
    <TT
CLASS="FILENAME"
>site.exp</TT
>, capturing configuration values that
    apply to DejaGnu across the board, in each configuration-specific
    subdirectory of the DejaGnu library directory.
    <B
CLASS="COMMAND"
>runtest</B
> loads these values first. The master
    <TT
CLASS="FILENAME"
>site.exp</TT
> contains the default values for all
    targets and hosts supported by DejaGnu. This master file is
    identified by setting the environment variable
    <SPAN
CLASS="SYMBOL"
>DEJAGNU</SPAN
> to the name of the file. This is also
    refered to as the ``global'' config file.</P
><P
>Any directory containing a configured test suite also has a
    local <TT
CLASS="FILENAME"
>site.exp</TT
>, capturing configuration values
    specific to the tool under test.  Since <B
CLASS="COMMAND"
>runtest</B
>
    loads these values last, the individual test configuration can
    either rely on and use, or override, any of the global values from
    the global <TT
CLASS="FILENAME"
>site.exp</TT
> file.</P
><P
>You can usually generate or update the testsuite's local
    <TT
CLASS="FILENAME"
>site.exp</TT
> by typing <B
CLASS="COMMAND"
>make
    site.exp</B
> in the test suite directory, after the test
    suite is configured.</P
><P
>You can also have a file in your home directory called
    <TT
CLASS="FILENAME"
>.dejagnurc</TT
>. This gets loaded first before the
    other config files. Usually this is used for personal stuff, like
    setting the <SPAN
CLASS="SYMBOL"
>all_flag</SPAN
> so all the output gets
    printed, or your own verbosity levels. This file is usually
    restricted to setting command line options.</P
><P
>You can further override the default values in a
    user-editable section of any <TT
CLASS="FILENAME"
>site.exp</TT
>, or by
    setting variables on the <B
CLASS="COMMAND"
>runtest</B
> command
    line.</P
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="LOCAL"
>Local Config File</A
></H1
><P
>It is usually more convenient to keep these <I
CLASS="EMPHASIS"
>manual
      overrides</I
> in the <TT
CLASS="FILENAME"
>site.exp</TT
>
      local to each test directory, rather than in the global
      <TT
CLASS="FILENAME"
>site.exp</TT
> in the installed DejaGnu
      library. This file is mostly for supplying tool specific info
      that is required by the test suite.</P
><P
>All local <TT
CLASS="FILENAME"
>site.exp</TT
> files have
      two sections, separated by comment text. The first section is
      the part that is generated by <B
CLASS="COMMAND"
>make</B
>. It is
      essentially a collection of Tcl variable definitions based on
      <TT
CLASS="FILENAME"
>Makefile</TT
> environment variables. Since they
      are generated by <B
CLASS="COMMAND"
>make</B
>, they contain the
      values as specified by <B
CLASS="COMMAND"
>configure</B
>.  (You can
      also customize these values by using the <TT
CLASS="OPTION"
>--site</TT
>
      option to <B
CLASS="COMMAND"
>configure</B
>.) In particular, this
      section contains the <TT
CLASS="FILENAME"
>Makefile</TT
>
      variables for host and target configuration data. Do not edit
      this first section; if you do, your changes are replaced next
      time you run <B
CLASS="COMMAND"
>make</B
>.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN896"
></A
><P
><B
>Example 1. The first section starts with</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>	## these variables are automatically generated by make ##
	# Do not edit here. If you wish to override these values
	# add them to the last section
	</PRE
></TD
></TR
></TABLE
></DIV
><P
>In the second section, you can override any default values
      (locally to DejaGnu) for all the variables.  The second section
      can also contain your preferred defaults for all the command
      line options to <B
CLASS="COMMAND"
>runtest</B
>. This allows you to
      easily customize <B
CLASS="COMMAND"
>runtest</B
> for your preferences
      in each configured test-suite tree, so that you need not type
      options repeatedly on the command line.  (The second section may
      also be empty, if you do not wish to override any defaults.)</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN902"
></A
><P
><B
>Example 2. The first section ends with this line</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>	## All variables above are generated by configure. Do Not Edit ##
	</PRE
></TD
></TR
></TABLE
></DIV
><P
>You can make any changes under this line. If you wish to
      redefine a variable in the top section, then just put a
      duplicate value in this second section. Usually the values
      defined in this config file are related to the configuration of
      the test run. This is the ideal place to set the variables
      <SPAN
CLASS="SYMBOL"
>host_triplet</SPAN
>, <SPAN
CLASS="SYMBOL"
>build_triplet</SPAN
>,
      <SPAN
CLASS="SYMBOL"
>target_triplet</SPAN
>. All other variables are tool
      dependant, i.e., for testing a compiler, the value for
      <SPAN
CLASS="SYMBOL"
>CC</SPAN
> might be set to a freshly built binary, as
      opposed to one in the user's path.</P
><P
>Here's an example local site.exp file, as used for
      <SPAN
CLASS="PRODUCTNAME"
>GCC/G++</SPAN
> testing.</P
><DIV
CLASS="EXAMPLE"
><A
NAME="AEN912"
></A
><P
><B
>Example 3. Local Config File</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>
      ## these variables are automatically generated by make ##
      # Do not edit here. If you wish to override these values
      # add them to the last section
      set rootme "/build/devo-builds/i586-pc-linux-gnulibc1/gcc"
      set host_triplet i586-pc-linux-gnulibc1
      set build_triplet i586-pc-linux-gnulibc1
      set target_triplet i586-pc-linux-gnulibc1
      set target_alias i586-pc-linux-gnulibc1
      set CFLAGS ""
      set CXXFLAGS "-I/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libio -I$srcdir/../libg++/src -I$srcdir/../libio -I$srcdir/../libstdc++ -I$srcdir/../libstdc++/stl -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libg++ -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../libstdc++"
      append LDFLAGS " -L/build/devo-builds/i586-pc-linux-gnulibc1/gcc/../ld"
      set tmpdir /build/devo-builds/i586-pc-linux-gnulibc1/gcc/testsuite
      set srcdir "${srcdir}/testsuite"
      ## All variables above are generated by configure. Do Not Edit ##

      </PRE
></TD
></TR
></TABLE
></DIV
><P
>This file defines the required fields for a local config
    file, namely the three config triplets, and the srcdir. It also
    defines several other Tcl variables that are used exclusivly by
    the GCC test suite. For most test cases, the CXXFLAGS and LDFLAGS
    are supplied by DejaGnu itself for cross testing, but to test a
    compiler, GCC needs to manipulate these itself.</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="outputfiles.html"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="global.html"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The files DejaGnu produces.</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Global Config File</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>