parallel_mode.xml: Clarify use of explicit parallel algorithms.
[gcc.git] / libstdc++-v3 / doc / xml / manual / test.xml
1 <sect1 id="manual.intro.setup.test" xreflabel="Testing">
2 <?dbhtml filename="test.html"?>
3
4 <sect1info>
5 <keywordset>
6 <keyword>
7 ISO C++
8 </keyword>
9 <keyword>
10 test
11 </keyword>
12 <keyword>
13 testsuite
14 </keyword>
15 </keywordset>
16 </sect1info>
17
18 <title>Test</title>
19
20 <sect2 id="test.organization" xreflabel="test.organization">
21 <title>Organization</title>
22 <para>
23 The directory <emphasis>libsrcdir/testsuite</emphasis> contains the
24 individual test cases organized in sub-directories corresponding to
25 chapters of the C++ standard (detailed below), the dejagnu test
26 harness support files, and sources to various testsuite utilities
27 that are packaged in a separate testing library.
28 </para>
29
30 <para>
31 All test cases for functionality required by the runtime components
32 of the C++ standard (ISO 14882) are files within the following
33 directories.
34 </para>
35
36 <programlisting>
37 17_intro
38 18_support
39 19_diagnostics
40 20_util
41 21_strings
42 22_locale
43 23_containers
44 25_algorithms
45 26_numerics
46 27_io
47 </programlisting>
48
49 <para>
50 In addition, the following directories include test files:
51 </para>
52
53 <programlisting>
54 tr1 Tests for components as described by the Technical Report on Standard Library Extensions (TR1).
55 backward Tests for backwards compatibility and deprecated features.
56 demangle Tests for __cxa_demangle, the IA 64 C++ ABI demangler
57 ext Tests for extensions.
58 performance Tests for performance analysis, and performance regressions.
59 thread Tests for threads.
60 </programlisting>
61
62 <para>
63 Some directories don't have test files, but instead contain
64 auxiliary information (<ulink url="#internals">more information</ulink>):
65 </para>
66
67 <programlisting>
68 config Files for the dejagnu test harness.
69 lib Files for the dejagnu test harness.
70 libstdc++* Files for the dejagnu test harness.
71 data Sample text files for testing input and output.
72 util Files for libtestc++, utilities and testing routines.
73 </programlisting>
74
75 <para>
76 Within a directory that includes test files, there may be
77 additional subdirectories, or files. Originally, test cases
78 were appended to one file that represented a particular section
79 of the chapter under test, and was named accordingly. For
80 instance, to test items related to <code> 21.3.6.1 -
81 basic_string::find [lib.string::find]</code> in the standard,
82 the following was used:
83 </para>
84 <programlisting>
85 21_strings/find.cc
86 </programlisting>
87 <para>
88 However, that practice soon became a liability as the test cases
89 became huge and unwieldy, and testing new or extended
90 functionality (like wide characters or named locales) became
91 frustrating, leading to aggressive pruning of test cases on some
92 platforms that covered up implementation errors. Now, the test
93 suite has a policy of one file, one test case, which solves the
94 above issues and gives finer grained results and more manageable
95 error debugging. As an example, the test case quoted above
96 becomes:
97 </para>
98 <programlisting>
99 21_strings/basic_string/find/char/1.cc
100 21_strings/basic_string/find/char/2.cc
101 21_strings/basic_string/find/char/3.cc
102 21_strings/basic_string/find/wchar_t/1.cc
103 21_strings/basic_string/find/wchar_t/2.cc
104 21_strings/basic_string/find/wchar_t/3.cc
105 </programlisting>
106
107 <para>
108 All new tests should be written with the policy of one test
109 case, one file in mind.
110 </para>
111
112 </sect2>
113
114 <sect2 id="test.naming" xreflabel="test.naming">
115 <title>Naming Conventions</title>
116
117 <para>
118 In addition, there are some special names and suffixes that are
119 used within the testsuite to designate particular kinds of
120 tests.
121 </para>
122
123 <itemizedlist>
124 <listitem>
125 <para>
126 <emphasis>_xin.cc</emphasis>
127 </para>
128 <para>
129 This test case expects some kind of interactive input in order
130 to finish or pass. At the moment, the interactive tests are not
131 run by default. Instead, they are run by hand, like:
132 </para>
133 <programlisting>
134 g++ 27_io/objects/char/3_xin.cc
135 cat 27_io/objects/char/3_xin.in | a.out
136 </programlisting>
137 </listitem>
138 <listitem>
139 <para>
140 <emphasis>.in</emphasis>
141 </para>
142 <para>
143 This file contains the expected input for the corresponding <emphasis>
144 _xin.cc</emphasis> test case.
145 </para>
146 </listitem>
147 <listitem>
148 <para>
149 <emphasis>_neg.cc</emphasis>
150 </para>
151 <para>
152 This test case is expected to fail: it's a negative test. At the
153 moment, these are almost always compile time errors.
154 </para>
155 </listitem>
156 <listitem>
157 <para>
158 <emphasis>char</emphasis>
159 </para>
160 <para>
161 This can either be a directory name or part of a longer file
162 name, and indicates that this file, or the files within this
163 directory are testing the <code>char</code> instantiation of a
164 template.
165 </para>
166 </listitem>
167 <listitem>
168 <para>
169 <emphasis>wchar_t</emphasis>
170 </para>
171 <para>
172 This can either be a directory name or part of a longer file
173 name, and indicates that this file, or the files within this
174 directory are testing the <code>wchar_t</code> instantiation of
175 a template. Some hosts do not support <code>wchar_t</code>
176 functionality, so for these targets, all of these tests will not
177 be run.
178 </para>
179 </listitem>
180 <listitem>
181 <para>
182 <emphasis>thread</emphasis>
183 </para>
184 <para>
185 This can either be a directory name or part of a longer file
186 name, and indicates that this file, or the files within this
187 directory are testing situations where multiple threads are
188 being used.
189 </para>
190 </listitem>
191 <listitem>
192 <para>
193 <emphasis>performance</emphasis>
194 </para>
195 <para>
196 This can either be an enclosing directory name or part of a
197 specific file name. This indicates a test that is used to
198 analyze runtime performance, for performance regression testing,
199 or for other optimization related analysis. At the moment, these
200 test cases are not run by default.
201 </para>
202 </listitem>
203 </itemizedlist>
204
205 </sect2>
206
207 <sect2 id="test.utils" xreflabel="test.utils">
208 <title>Utilities</title>
209 <para>
210 </para>
211 <para>
212 The testsuite directory also contains some files that implement
213 functionality that is intended to make writing test cases easier,
214 or to avoid duplication, or to provide error checking in a way that
215 is consistent across platforms and test harnesses. A stand-alone
216 executable, called <emphasis>abi_check</emphasis>, and a static
217 library called <emphasis>libtestc++</emphasis> are
218 constructed. Both of these items are not installed, and only used
219 during testing.
220 </para>
221
222 <para>
223 These files include the following functionality:
224 </para>
225
226 <itemizedlist>
227 <listitem>
228 <para>
229 <emphasis>testsuite_abi.h</emphasis>,
230 <emphasis>testsuite_abi.cc</emphasis>,
231 <emphasis>testsuite_abi_check.cc</emphasis>
232 </para>
233 <para>
234 Creates the executable <emphasis>abi_check</emphasis>.
235 Used to check correctness of symbol versioning, visibility of
236 exported symbols, and compatibility on symbols in the shared
237 library, for hosts that support this feature. More information
238 can be found in the ABI documentation <ulink url="abi.html">here</ulink>
239 </para>
240 </listitem>
241 <listitem>
242 <para>
243 <emphasis>testsuite_allocator.h</emphasis>,
244 <emphasis>testsuite_allocator.cc</emphasis>
245 </para>
246 <para>
247 Contains specialized allocators that keep track of construction
248 and destruction. Also, support for overriding global new and
249 delete operators, including verification that new and delete
250 are called during execution, and that allocation over max_size
251 fails.
252 </para>
253 </listitem>
254 <listitem>
255 <para>
256 <emphasis>testsuite_character.h</emphasis>
257 </para>
258 <para>
259 Contains <code>std::char_traits</code> and
260 <code>std::codecvt</code> specializations for a user-defined
261 POD.
262 </para>
263 </listitem>
264 <listitem>
265 <para>
266 <emphasis>testsuite_hooks.h</emphasis>,
267 <emphasis>testsuite_hooks.cc</emphasis>
268 </para>
269 <para>
270 A large number of utilities, including:
271 </para>
272 <itemizedlist>
273 <listitem><para>VERIFY</para></listitem>
274 <listitem><para>set_memory_limits</para></listitem>
275 <listitem><para>verify_demangle</para></listitem>
276 <listitem><para>run_tests_wrapped_locale</para></listitem>
277 <listitem><para>run_tests_wrapped_env</para></listitem>
278 <listitem><para>try_named_locale</para></listitem>
279 <listitem><para>try_mkfifo</para></listitem>
280 <listitem><para>func_callback</para></listitem>
281 <listitem><para>counter</para></listitem>
282 <listitem><para>copy_tracker</para></listitem>
283 <listitem><para>copy_constructor</para></listitem>
284 <listitem><para>assignment_operator</para></listitem>
285 <listitem><para>destructor</para></listitem>
286 <listitem>
287 <para>pod_char, pod_int and associated char_traits specializations</para>
288 </listitem>
289 </itemizedlist>
290 </listitem>
291 <listitem>
292 <para>
293 <emphasis>testsuite_io.h</emphasis>
294 </para>
295 <para>
296 Error, exception, and constraint checking for
297 <code>std::streambuf, std::basic_stringbuf, std::basic_filebuf</code>.
298 </para>
299 </listitem>
300 <listitem>
301 <para>
302 <emphasis>testsuite_iterators.h</emphasis>
303 </para>
304 <para>
305 Wrappers for various iterators.
306 </para>
307 </listitem>
308 <listitem>
309 <para>
310 <emphasis>testsuite_performance.h</emphasis>
311 </para>
312 <para>
313 A number of class abstractions for performance counters, and
314 reporting functions including:
315 </para>
316 <itemizedlist>
317 <listitem><para>time_counter</para></listitem>
318 <listitem><para>resource_counter</para></listitem>
319 <listitem><para>report_performance</para></listitem>
320 </itemizedlist>
321 </listitem>
322 </itemizedlist>
323
324 </sect2>
325
326 <sect2 id="test.run" xreflabel="test.run">
327 <title>Running the Testsuite</title>
328
329 <sect3 id="test.run.basic" xreflabel="test.run.basic">
330 <title>Basic Results</title>
331 <para>
332 There are several options for running tests, including testing
333 the regression tests, testing a subset of the regression tests,
334 testing the performance tests, testing just compilation, testing
335 installed tools, etc. In addition, there is a special rule for
336 checking the exported symbols of the shared library.
337 </para>
338
339 <para>
340 You can check the status of the build without installing it
341 using the dejagnu harness, much like the rest of the gcc
342 tools.</para>
343 <programlisting> make check</programlisting>
344 <para>in the <emphasis>libbuilddir</emphasis> directory.</para>
345 <para>or</para>
346 <programlisting> make check-target-libstdc++-v3</programlisting>
347 <para>in the <emphasis>gccbuilddir</emphasis> directory.
348 </para>
349
350 <para>
351 These commands are functionally equivalent and will create a
352 'testsuite' directory underneath
353 <emphasis>libbuilddir</emphasis> containing the results of the
354 tests. Two results files will be generated: <emphasis>
355 libstdc++.sum</emphasis>, which is a PASS/FAIL summary for each
356 test, and <emphasis>libstdc++.log</emphasis> which is a log of
357 the exact command line passed to the compiler, the compiler
358 output, and the executable output (if any).
359 </para>
360
361 <para>
362 Archives of test results for various versions and platforms are
363 available on the GCC website in the <ulink
364 url="http://gcc.gnu.org/gcc-4.1/buildstat.html">build
365 status</ulink> section of each individual release, and are also
366 archived on a daily basis on the <ulink
367 url="http://gcc.gnu.org/ml/gcc-testresults/current">gcc-testresults</ulink>
368 mailing list. Please check either of these places for a similar
369 combination of source version, operating system, and host CPU.
370 </para>
371 </sect3>
372
373 <sect3 id="test.run.options" xreflabel="test.run.options">
374 <title>Options</title>
375 <para>
376 To debug the dejagnu test harness during runs, try invoking with a
377 specific argument to the variable RUNTESTFLAGS, as below.
378 </para>
379
380 <programlisting>
381 make check-target-libstdc++-v3 RUNTESTFLAGS="-v"
382 </programlisting>
383
384 <para>
385 or
386 </para>
387
388 <programlisting>
389 make check-target-libstdc++-v3 RUNTESTFLAGS="-v -v"
390 </programlisting>
391
392 <para>
393 To run a subset of the library tests, you will need to generate
394 the <emphasis>testsuite_files</emphasis> file by running
395 <command>make testsuite_files</command> in the
396 <emphasis>libbuilddir/testsuite</emphasis> directory, described
397 below. Edit the file to remove the tests you don't want and
398 then run the testsuite as normal.
399 </para>
400
401 <para>
402 There are two ways to run on a simulator: set up DEJAGNU to point to a
403 specially crafted site.exp, or pass down --target_board flags.
404 </para>
405
406 <para>
407 Example flags to pass down for various embedded builds are as follows:
408 </para>
409
410 <programlisting>
411 --target=powerpc-eabism (libgloss/sim)
412 make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=powerpc-sim"
413
414 --target=calmrisc32 (libgloss/sid)
415 make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=calmrisc32-sid"
416
417 --target=xscale-elf (newlib/sim)
418 make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=arm-sim"
419 </programlisting>
420
421 <para>
422 Also, here is an example of how to run the libstdc++ testsuite
423 for a multilibed build directory with different ABI settings:
424 </para>
425
426 <programlisting>
427 make check-target-libstdc++-v3 RUNTESTFLAGS='--target_board \"unix{-mabi=32,,-mabi=64}\"'
428 </programlisting>
429
430 <para>
431 You can run the tests with a compiler and library that have
432 already been installed. Make sure that the compiler (e.g.,
433 <code>g++</code>) is in your <code>PATH</code>. If you are
434 using shared libraries, then you must also ensure that the
435 directory containing the shared version of libstdc++ is in your
436 <code>LD_LIBRARY_PATH</code>, or equivalent. If your GCC source
437 tree is at <code>/path/to/gcc</code>, then you can run the tests
438 as follows:
439 </para>
440
441 <programlisting>
442 runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite
443 </programlisting>
444
445 <para>
446 The testsuite will create a number of files in the directory in
447 which you run this command,. Some of those files might use the
448 same name as files created by other testsuites (like the ones
449 for GCC and G++), so you should not try to run all the
450 testsuites in parallel from the same directory.
451 </para>
452
453 <para>
454 In addition, there are some testing options that are mostly of
455 interest to library maintainers and system integrators. As such,
456 these tests may not work on all cpu and host combinations, and
457 may need to be executed in the
458 <emphasis>libbuilddir/testsuite</emphasis> directory. These
459 options include, but are not necessarily limited to, the
460 following:
461 </para>
462
463 <programlisting>
464 make testsuite_files
465 </programlisting>
466
467 <para>
468 Five files are generated that determine what test files
469 are run. These files are:
470 </para>
471
472 <itemizedlist>
473 <listitem>
474 <para>
475 <emphasis>testsuite_files</emphasis>
476 </para>
477 <para>
478 This is a list of all the test cases that will be run. Each
479 test case is on a separate line, given with an absolute path
480 from the <emphasis>libsrcdir/testsuite</emphasis> directory.
481 </para>
482 </listitem>
483
484 <listitem>
485 <para>
486 <emphasis>testsuite_files_interactive</emphasis>
487 </para>
488 <para>
489 This is a list of all the interactive test cases, using the
490 same format as the file list above. These tests are not run
491 by default.
492 </para>
493 </listitem>
494
495 <listitem>
496 <para>
497 <emphasis>testsuite_files_performance</emphasis>
498 </para>
499 <para>
500 This is a list of all the performance test cases, using the
501 same format as the file list above. These tests are not run
502 by default.
503 </para>
504 </listitem>
505
506 <listitem>
507 <para>
508 <emphasis>testsuite_thread</emphasis>
509 </para>
510 <para>
511 This file indicates that the host system can run tests which
512 involved multiple threads.
513 </para>
514 </listitem>
515
516 <listitem>
517 <para>
518 <emphasis>testsuite_wchar_t</emphasis>
519 </para>
520 <para>
521 This file indicates that the host system can run the wchar_t
522 tests, and corresponds to the macro definition <code>
523 _GLIBCXX_USE_WCHAR_T</code> in the file c++config.h.
524 </para>
525 </listitem>
526 </itemizedlist>
527
528 <programlisting>
529 make check-abi
530 </programlisting>
531
532 <para>
533 The library ABI can be tested. This involves testing the shared
534 library against an ABI-defining previous version of symbol
535 exports.
536 </para>
537
538 <programlisting>
539 make check-compile
540 </programlisting>
541
542 <para>
543 This rule compiles, but does not link or execute, the
544 <emphasis>testsuite_files</emphasis> test cases and displays the
545 output on stdout.
546 </para>
547
548 <programlisting>
549 make check-performance
550 </programlisting>
551
552 <para>
553 This rule runs through the
554 <emphasis>testsuite_files_performance</emphasis> test cases and
555 collects information for performance analysis and can be used to
556 spot performance regressions. Various timing information is
557 collected, as well as number of hard page faults, and memory
558 used. This is not run by default, and the implementation is in
559 flux.
560 </para>
561
562 <para>
563 We are interested in any strange failures of the testsuite;
564 please email the main libstdc++ mailing list if you see
565 something odd or have questions.
566 </para>
567 </sect3>
568
569 <sect3 id="test.run.permutations" xreflabel="test.run.permutations">
570 <title>Test Permutations</title>
571 <para>
572 To run the libstdc++ test suite under the <link
573 linkend="manual.ext.debug_mode">debug mode</link>, edit
574 <filename>libstdc++-v3/scripts/testsuite_flags</filename> to add the
575 compile-time flag <constant>-D_GLIBCXX_DEBUG</constant> to the
576 result printed by the <literal>--build-cxx</literal>
577 option. Additionally, add the
578 <constant>-D_GLIBCXX_DEBUG_PEDANTIC</constant> flag to turn on
579 pedantic checking. The libstdc++ test suite should produce
580 precisely the same results under debug mode that it does under
581 release mode: any deviation indicates an error in either the
582 library or the test suite.
583 </para>
584
585 <para>
586 Or, just run the testsuites with <constant>CXXFLAGS</constant>
587 set to <constant>-D_GLIBCXX_DEBUG</constant>.
588 </para>
589 </sect3>
590 </sect2>
591
592 <sect2 id="test.new_tests" xreflabel="test.new_tests">
593 <title>New Test Cases</title>
594
595 <para>
596 The first step in making a new test case is to choose the correct
597 directory and file name, given the organization as previously
598 described.
599 </para>
600
601 <para>
602 All files are copyright the FSF, and GPL'd: this is very
603 important. The first copyright year should correspond to the date
604 the file was checked in to SVN.
605 </para>
606
607 <para>
608 As per the dejagnu instructions, always return 0 from main to
609 indicate success.
610 </para>
611
612 <para>
613 A bunch of utility functions and classes have already been
614 abstracted out into the testsuite utility library, <code>
615 libtestc++</code>. To use this functionality, just include the
616 appropriate header file: the library or specific object files will
617 automatically be linked in as part of the testsuite run.
618 </para>
619
620 <para>
621 For a test that needs to take advantage of the dejagnu test
622 harness, what follows below is a list of special keyword that
623 harness uses. Basically, a test case contains dg-keywords (see
624 dg.exp) indicating what to do and what kinds of behavior are to be
625 expected. New test cases should be written with the new style
626 DejaGnu framework in mind.
627 </para>
628
629 <para>
630 To ease transition, here is the list of dg-keyword documentation
631 lifted from dg.exp.
632 </para>
633
634 <programlisting>
635 # The currently supported options are:
636 #
637 # dg-prms-id N
638 # set prms_id to N
639 #
640 # dg-options "options ..." [{ target selector }]
641 # specify special options to pass to the tool (eg: compiler)
642 #
643 # dg-do do-what-keyword [{ target/xfail selector }]
644 # `do-what-keyword' is tool specific and is passed unchanged to
645 # ${tool}-dg-test. An example is gcc where `keyword' can be any of:
646 # preprocess|compile|assemble|link|run
647 # and will do one of: produce a .i, produce a .s, produce a .o,
648 # produce an a.out, or produce an a.out and run it (the default is
649 # compile).
650 #
651 # dg-error regexp comment [{ target/xfail selector } [{.|0|linenum}]]
652 # indicate an error message &lt;regexp&gt; is expected on this line
653 # (the test fails if it doesn't occur)
654 # Linenum=0 for general tool messages (eg: -V arg missing).
655 # "." means the current line.
656 #
657 # dg-warning regexp comment [{ target/xfail selector } [{.|0|linenum}]]
658 # indicate a warning message &lt;regexp&gt; is expected on this line
659 # (the test fails if it doesn't occur)
660 #
661 # dg-bogus regexp comment [{ target/xfail selector } [{.|0|linenum}]]
662 # indicate a bogus error message &lt;regexp&gt; use to occur here
663 # (the test fails if it does occur)
664 #
665 # dg-build regexp comment [{ target/xfail selector }]
666 # indicate the build use to fail for some reason
667 # (errors covered here include bad assembler generated, tool crashes,
668 # and link failures)
669 # (the test fails if it does occur)
670 #
671 # dg-excess-errors comment [{ target/xfail selector }]
672 # indicate excess errors are expected (any line)
673 # (this should only be used sparingly and temporarily)
674 #
675 # dg-output regexp [{ target selector }]
676 # indicate the expected output of the program is &lt;regexp&gt;
677 # (there may be multiple occurrences of this, they are concatenated)
678 #
679 # dg-final { tcl code }
680 # add some tcl code to be run at the end
681 # (there may be multiple occurrences of this, they are concatenated)
682 # (unbalanced braces must be \-escaped)
683 #
684 # "{ target selector }" is a list of expressions that determine whether the
685 # test succeeds or fails for a particular target, or in some cases whether the
686 # option applies for a particular target. If the case of `dg-do' it specifies
687 # whether the test case is even attempted on the specified target.
688 #
689 # The target selector is always optional. The format is one of:
690 #
691 # { xfail *-*-* ... } - the test is expected to fail for the given targets
692 # { target *-*-* ... } - the option only applies to the given targets
693 #
694 # At least one target must be specified, use *-*-* for "all targets".
695 # At present it is not possible to specify both `xfail' and `target'.
696 # "native" may be used in place of "*-*-*".
697
698 Example 1: Testing compilation only
699 // { dg-do compile }
700
701 Example 2: Testing for expected warnings on line 36, which all targets fail
702 // { dg-warning "string literals" "" { xfail *-*-* } 36
703
704 Example 3: Testing for expected warnings on line 36
705 // { dg-warning "string literals" "" { target *-*-* } 36
706
707 Example 4: Testing for compilation errors on line 41
708 // { dg-do compile }
709 // { dg-error "no match for" "" { target *-*-* } 41 }
710
711 Example 5: Testing with special command line settings, or without the
712 use of pre-compiled headers, in particular the stdc++.h.gch file. Any
713 options here will override the DEFAULT_CXXFLAGS and PCH_CXXFLAGS set
714 up in the normal.exp file.
715 // { dg-options "-O0" { target *-*-* } }
716 </programlisting>
717
718 <para>
719 More examples can be found in the libstdc++-v3/testsuite/*/*.cc files.
720 </para>
721
722
723 </sect2>
724
725 <sect2 id="test.dejagnu" xreflabel="test.dejagnu">
726 <title>Test Harness Details</title>
727 <para>
728 Underlying details of testing are abstracted via the GNU Dejagnu package.
729 </para>
730
731
732 <para>This is information for those looking at making changes to the testsuite
733 structure, and/or needing to trace dejagnu's actions with --verbose. This
734 will not be useful to people who are "merely" adding new tests to the existing
735 structure.
736 </para>
737
738 <para>The first key point when working with dejagnu is the idea of a "tool".
739 Files, directories, and functions are all implicitly used when they are
740 named after the tool in use. Here, the tool will always be "libstdc++".
741 </para>
742
743 <para>The <code>lib</code> subdir contains support routines. The
744 <code>lib/libstdc++.exp</code> file ("support library") is loaded
745 automagically, and must explicitly load the others. For example, files can
746 be copied from the core compiler's support directory into <code>lib</code>.
747 </para>
748
749 <para>Some routines in <code>lib/libstdc++.exp</code> are callbacks, some are
750 our own. Callbacks must be prefixed with the name of the tool. To easily
751 distinguish the others, by convention our own routines are named "v3-*".
752 </para>
753
754 <para>The next key point when working with dejagnu is "test files". Any
755 directory whose name starts with the tool name will be searched for test files.
756 (We have only one.) In those directories, any <code>.exp</code> file is
757 considered a test file, and will be run in turn. Our main test file is called
758 <code>normal.exp</code>; it runs all the tests in testsuite_files using the
759 callbacks loaded from the support library.
760 </para>
761
762 <para>The <code>config</code> directory is searched for any particular "target
763 board" information unique to this library. This is currently unused and sets
764 only default variables.
765 </para>
766
767 </sect2>
768
769 <sect2 id="test.future" xreflabel="test.future">
770 <title>Future</title>
771 <para>
772 </para>
773
774
775 <para>
776 Shared runs need to be implemented, for targets that support shared libraries.
777 </para>
778
779 <para>
780 Diffing of expected output to standard streams needs to be finished off.
781 </para>
782
783 <para>
784 The V3 testing framework supports, or will eventually support,
785 additional keywords for the purpose of easing the job of writing
786 test cases. All V3-keywords are of the form <code>@xxx@</code>.
787 Currently plans for supported keywords include:
788 </para>
789
790 <variablelist>
791 <varlistentry><term> <code> @require@ &lt;files&gt; </code> </term>
792 <listitem>
793 <para>
794 The existence of &lt;files&gt; is essential for the test to complete
795 successfully. For example, a test case foo.C using bar.baz as
796 input file could say
797 </para>
798 <programlisting>
799 // @require@ bar.baz</programlisting>
800 <para>
801 The special variable % stands for the rootname, e.g. the
802 file-name without its `.C' extension. Example of use (taken
803 verbatim from 27_io/filebuf.cc)
804 </para>
805 <programlisting>
806 // @require@ %-*.tst %-*.txt</programlisting>
807 </listitem></varlistentry>
808 <varlistentry><term> <code> @diff@ &lt;first-list&gt; &lt;second-list&gt; </code> </term>
809 <listitem>
810 <para>
811 After the test case compiles and ran successfully, diff
812 &lt;first-list&gt; against &lt;second-list&gt;, these lists should
813 have the same length. The test fails if diff returns non-zero a
814 pair of files.
815 </para>
816 </listitem></varlistentry>
817 </variablelist>
818
819 </sect2>
820
821 </sect1>