OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [doc/] [xml/] [manual/] [test.xml] - Blame information for rev 833

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
2
         xml:id="manual.intro.setup.test" xreflabel="Testing">
3
4
 
5
Test
6
  
7
    
8
      ISO C++
9
    
10
    
11
      test
12
    
13
    
14
      testsuite
15
    
16
    
17
      performance
18
    
19
    
20
      conformance
21
    
22
    
23
      ABI
24
    
25
    
26
      exception safety
27
    
28
  
29
30
 
31
32
The libstdc++ testsuite includes testing for standard conformance,
33
regressions, ABI, and performance.
34
35
 
36
Organization
37
 
38
 
39
Directory Layout
40
 
41
 
42
43
  The directory libsrcdir/testsuite contains the
44
  individual test cases organized in sub-directories corresponding to
45
  chapters of the C++ standard (detailed below), the dejagnu test
46
  harness support files, and sources to various testsuite utilities
47
  that are packaged in a separate testing library.
48
49
 
50
51
  All test cases for functionality required by the runtime components
52
  of the C++ standard (ISO 14882) are files within the following
53
  directories.
54
55
 
56
   
57
17_intro
58
18_support
59
19_diagnostics
60
20_util
61
21_strings
62
22_locale
63
23_containers
64
25_algorithms
65
26_numerics
66
27_io
67
28_regex
68
29_atomics
69
30_threads
70
   
71
 
72
   
73
      In addition, the following directories include test files:
74
   
75
 
76
   
77
tr1               Tests for components as described by the Technical Report on Standard Library Extensions (TR1).
78
backward          Tests for backwards compatibility and deprecated features.
79
demangle          Tests for __cxa_demangle, the IA 64 C++ ABI demangler
80
ext               Tests for extensions.
81
performance       Tests for performance analysis, and performance regressions.
82
   
83
 
84
   
85
      Some directories don't have test files, but instead contain
86
      auxiliary information:
87
   
88
 
89
   
90
config            Files for the dejagnu test harness.
91
lib               Files for the dejagnu test harness.
92
libstdc++*        Files for the dejagnu test harness.
93
data              Sample text files for testing input and output.
94
util              Files for libtestc++, utilities and testing routines.
95
   
96
 
97
   
98
      Within a directory that includes test files, there may be
99
      additional subdirectories, or files.  Originally, test cases
100
      were appended to one file that represented a particular section
101
      of the chapter under test, and was named accordingly. For
102
      instance, to test items related to  21.3.6.1 -
103
      basic_string::find [lib.string::find] in the standard,
104
      the following was used:
105
   
106
   
107
21_strings/find.cc
108
   
109
   
110
      However, that practice soon became a liability as the test cases
111
      became huge and unwieldy, and testing new or extended
112
      functionality (like wide characters or named locales) became
113
      frustrating, leading to aggressive pruning of test cases on some
114
      platforms that covered up implementation errors. Now, the test
115
      suite has a policy of one file, one test case, which solves the
116
      above issues and gives finer grained results and more manageable
117
      error debugging. As an example, the test case quoted above
118
      becomes:
119
   
120
   
121
21_strings/basic_string/find/char/1.cc
122
21_strings/basic_string/find/char/2.cc
123
21_strings/basic_string/find/char/3.cc
124
21_strings/basic_string/find/wchar_t/1.cc
125
21_strings/basic_string/find/wchar_t/2.cc
126
21_strings/basic_string/find/wchar_t/3.cc
127
   
128
 
129
   
130
      All new tests should be written with the policy of one test
131
      case, one file in mind.
132
   
133
134
 
135
 
136
Naming Conventions
137
 
138
 
139
   
140
      In addition, there are some special names and suffixes that are
141
      used within the testsuite to designate particular kinds of
142
      tests.
143
   
144
 
145
146
147
  
148
   _xin.cc
149
  
150
   
151
      This test case expects some kind of interactive input in order
152
      to finish or pass. At the moment, the interactive tests are not
153
      run by default. Instead, they are run by hand, like:
154
   
155
      
156
g++ 27_io/objects/char/3_xin.cc
157
cat 27_io/objects/char/3_xin.in | a.out
158
     
159
160
161
   
162
     .in
163
   
164
   
165
      This file contains the expected input for the corresponding 
166
      _xin.cc test case.
167
   
168
169
170
  
171
   _neg.cc
172
  
173
   
174
      This test case is expected to fail: it's a negative test. At the
175
      moment, these are almost always compile time errors.
176
   
177
178
179
  
180
   char
181
  
182
   
183
      This can either be a directory name or part of a longer file
184
      name, and indicates that this file, or the files within this
185
      directory are testing the char instantiation of a
186
      template.
187
   
188
189
190
  
191
   wchar_t
192
  
193
   
194
      This can either be a directory name or part of a longer file
195
      name, and indicates that this file, or the files within this
196
      directory are testing the wchar_t instantiation of
197
      a template. Some hosts do not support wchar_t
198
      functionality, so for these targets, all of these tests will not
199
      be run.
200
   
201
202
203
  
204
   thread
205
  
206
   
207
      This can either be a directory name or part of a longer file
208
      name, and indicates that this file, or the files within this
209
      directory are testing situations where multiple threads are
210
      being used.
211
   
212
213
214
  
215
   performance
216
  
217
   
218
      This can either be an enclosing directory name or part of a
219
      specific file name. This indicates a test that is used to
220
      analyze runtime performance, for performance regression testing,
221
      or for other optimization related analysis. At the moment, these
222
      test cases are not run by default.
223
   
224
225
226
 
227
228
229
 
230
 
231
Running the Testsuite
232
 
233
 
234
  
Basic
235
 
236
 
237
    
238
      You can check the status of the build without installing it
239
      using the dejagnu harness, much like the rest of the gcc
240
      tools.
241
    make check
242
   in the libbuilddir directory.
243
   or
244
    make check-target-libstdc++-v3
245
   in the gccbuilddir directory.
246
     
247
 
248
     
249
       These commands are functionally equivalent and will create a
250
       'testsuite' directory underneath
251
       libbuilddir containing the results of the
252
       tests. Two results files will be generated: 
253
       libstdc++.sum, which is a PASS/FAIL summary for each
254
       test, and libstdc++.log which is a log of
255
       the exact command line passed to the compiler, the compiler
256
       output, and the executable output (if any).
257
     
258
 
259
     
260
       Archives of test results for various versions and platforms are
261
       available on the GCC website in the build
262
       status section of each individual release, and are also
263
       archived on a daily basis on the gcc-testresults
264
       mailing list. Please check either of these places for a similar
265
       combination of source version, operating system, and host CPU.
266
     
267
  
268
 
269
  
Variations
270
 
271
    
272
      There are several options for running tests, including testing
273
      the regression tests, testing a subset of the regression tests,
274
      testing the performance tests, testing just compilation, testing
275
      installed tools, etc. In addition, there is a special rule for
276
      checking the exported symbols of the shared library.
277
    
278
    
279
      To debug the dejagnu test harness during runs, try invoking with a
280
      specific argument to the variable RUNTESTFLAGS, as below.
281
    
282
 
283
284
make check-target-libstdc++-v3 RUNTESTFLAGS="-v"
285
286
 
287
    
288
      or
289
    
290
 
291
292
make check-target-libstdc++-v3 RUNTESTFLAGS="-v -v"
293
294
 
295
    
296
      To run a subset of the library tests, you will need to generate
297
      the testsuite_files file by running
298
      make testsuite_files in the
299
      libbuilddir/testsuite directory, described
300
      below.  Edit the file to remove the tests you don't want and
301
      then run the testsuite as normal.
302
    
303
 
304
    
305
      There are two ways to run on a simulator: set up DEJAGNU to point to a
306
      specially crafted site.exp, or pass down --target_board flags.
307
    
308
 
309
    
310
    Example flags to pass down for various embedded builds are as follows:
311
    
312
 
313
314
      --target=powerpc-eabism (libgloss/sim)
315
make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=powerpc-sim"
316
 
317
--target=calmrisc32 (libgloss/sid)
318
make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=calmrisc32-sid"
319
 
320
--target=xscale-elf (newlib/sim)
321
make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=arm-sim"
322
323
 
324
    
325
      Also, here is an example of how to run the libstdc++ testsuite
326
      for a multilibed build directory with different ABI settings:
327
    
328
 
329
 
330
make check-target-libstdc++-v3 RUNTESTFLAGS='--target_board \"unix{-mabi=32,,-mabi=64}\"'
331
332
 
333
    
334
      You can run the tests with a compiler and library that have
335
      already been installed.  Make sure that the compiler (e.g.,
336
      g++) is in your PATH.  If you are
337
      using shared libraries, then you must also ensure that the
338
      directory containing the shared version of libstdc++ is in your
339
      LD_LIBRARY_PATH, or equivalent.  If your GCC source
340
      tree is at /path/to/gcc, then you can run the tests
341
      as follows:
342
    
343
 
344
345
runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite
346
347
 
348
    
349
      The testsuite will create a number of files in the directory in
350
      which you run this command,.  Some of those files might use the
351
      same name as files created by other testsuites (like the ones
352
      for GCC and G++), so you should not try to run all the
353
      testsuites in parallel from the same directory.
354
    
355
 
356
    
357
      In addition, there are some testing options that are mostly of
358
      interest to library maintainers and system integrators. As such,
359
      these tests may not work on all cpu and host combinations, and
360
      may need to be executed in the
361
      libbuilddir/testsuite directory.  These
362
      options include, but are not necessarily limited to, the
363
      following:
364
   
365
 
366
   
367
   make testsuite_files
368
   
369
 
370
  
371
    Five files are generated that determine what test files
372
    are run. These files are:
373
  
374
 
375
   
376
     
377
       
378
         testsuite_files
379
       
380
       
381
         This is a list of all the test cases that will be run. Each
382
         test case is on a separate line, given with an absolute path
383
         from the libsrcdir/testsuite directory.
384
       
385
     
386
 
387
     
388
       
389
         testsuite_files_interactive
390
       
391
       
392
         This is a list of all the interactive test cases, using the
393
         same format as the file list above. These tests are not run
394
         by default.
395
     
396
     
397
 
398
     
399
       
400
         testsuite_files_performance
401
       
402
       
403
         This is a list of all the performance test cases, using the
404
         same format as the file list above. These tests are not run
405
         by default.
406
     
407
     
408
 
409
     
410
       
411
         testsuite_thread
412
       
413
       
414
         This file indicates that the host system can run tests which
415
         involved multiple threads.
416
       
417
     
418
 
419
     
420
       
421
         testsuite_wchar_t
422
       
423
       
424
         This file indicates that the host system can run the wchar_t
425
         tests, and corresponds to the macro definition 
426
         _GLIBCXX_USE_WCHAR_T in the file c++config.h.
427
       
428
     
429
    
430
 
431
   
432
   make check-abi
433
   
434
 
435
   
436
     The library ABI can be tested. This involves testing the shared
437
     library against an ABI-defining previous version of symbol
438
     exports.
439
   
440
 
441
  
442
   make check-compile
443
  
444
 
445
   
446
     This rule compiles, but does not link or execute, the
447
     testsuite_files test cases and displays the
448
     output on stdout.
449
   
450
 
451
   
452
   make check-performance
453
   
454
 
455
   
456
     This rule runs through the
457
     testsuite_files_performance test cases and
458
     collects information for performance analysis and can be used to
459
     spot performance regressions. Various timing information is
460
     collected, as well as number of hard page faults, and memory
461
     used. This is not run by default, and the implementation is in
462
     flux.
463
   
464
 
465
   
466
      We are interested in any strange failures of the testsuite;
467
      please email the main libstdc++ mailing list if you see
468
      something odd or have questions.
469
   
470
  
471
 
472
  
Permutations
473
 
474
    
475
      To run the libstdc++ test suite under the debug mode, edit
476
      libstdc++-v3/scripts/testsuite_flags to add the
477
      compile-time flag -D_GLIBCXX_DEBUG to the
478
      result printed by the --build-cxx
479
      option. Additionally, add the
480
      -D_GLIBCXX_DEBUG_PEDANTIC flag to turn on
481
      pedantic checking. The libstdc++ test suite should produce
482
      precisely the same results under debug mode that it does under
483
      release mode: any deviation indicates an error in either the
484
      library or the test suite.
485
    
486
 
487
    
488
      The parallel
489
      mode can be tested in much the same manner, substituting
490
      -D_GLIBCXX_PARALLEL for
491
      -D_GLIBCXX_DEBUG in the previous paragraph.
492
    
493
 
494
    
495
      Or, just run the testsuites with CXXFLAGS
496
      set to -D_GLIBCXX_DEBUG or
497
      -D_GLIBCXX_PARALLEL.
498
    
499
  
500
501
 
502
Writing a new test case
503
 
504
 
505
   
506
    The first step in making a new test case is to choose the correct
507
    directory and file name, given the organization as previously
508
    described.
509
   
510
 
511
   
512
    All files are copyright the FSF, and GPL'd: this is very
513
    important.  The first copyright year should correspond to the date
514
    the file was checked in to SVN.
515
   
516
 
517
   
518
     As per the dejagnu instructions, always return 0 from main to
519
     indicate success.
520
   
521
 
522
   
523
   A bunch of utility functions and classes have already been
524
   abstracted out into the testsuite utility library, 
525
   libtestc++. To use this functionality, just include the
526
   appropriate header file: the library or specific object files will
527
   automatically be linked in as part of the testsuite run.
528
   
529
 
530
   
531
   For a test that needs to take advantage of the dejagnu test
532
   harness, what follows below is a list of special keyword that
533
   harness uses. Basically, a test case contains dg-keywords (see
534
   dg.exp) indicating what to do and what kinds of behavior are to be
535
   expected.  New test cases should be written with the new style
536
   DejaGnu framework in mind.
537
   
538
 
539
   
540
    To ease transition, here is the list of dg-keyword documentation
541
    lifted from dg.exp.
542
   
543
 
544
545
# The currently supported options are:
546
#
547
# dg-prms-id N
548
#       set prms_id to N
549
#
550
# dg-options "options ..." [{ target selector }]
551
#       specify special options to pass to the tool (eg: compiler)
552
#
553
# dg-do do-what-keyword [{ target/xfail selector }]
554
#       `do-what-keyword' is tool specific and is passed unchanged to
555
#       ${tool}-dg-test.  An example is gcc where `keyword' can be any of:
556
#       preprocess|compile|assemble|link|run
557
#       and will do one of: produce a .i, produce a .s, produce a .o,
558
#       produce an a.out, or produce an a.out and run it (the default is
559
#       compile).
560
#
561
# dg-error regexp comment [{ target/xfail selector } [{.|0|linenum}]]
562
#       indicate an error message <regexp> is expected on this line
563
#       (the test fails if it doesn't occur)
564
#       Linenum=0 for general tool messages (eg: -V arg missing).
565
#       "." means the current line.
566
#
567
# dg-warning regexp comment [{ target/xfail selector } [{.|0|linenum}]]
568
#       indicate a warning message <regexp> is expected on this line
569
#       (the test fails if it doesn't occur)
570
#
571
# dg-bogus regexp comment [{ target/xfail selector } [{.|0|linenum}]]
572
#       indicate a bogus error message <regexp> use to occur here
573
#       (the test fails if it does occur)
574
#
575
# dg-build regexp comment [{ target/xfail selector }]
576
#       indicate the build use to fail for some reason
577
#       (errors covered here include bad assembler generated, tool crashes,
578
#       and link failures)
579
#       (the test fails if it does occur)
580
#
581
# dg-excess-errors comment [{ target/xfail selector }]
582
#       indicate excess errors are expected (any line)
583
#       (this should only be used sparingly and temporarily)
584
#
585
# dg-output regexp [{ target selector }]
586
#       indicate the expected output of the program is <regexp>
587
#       (there may be multiple occurrences of this, they are concatenated)
588
#
589
# dg-final { tcl code }
590
#       add some tcl code to be run at the end
591
#       (there may be multiple occurrences of this, they are concatenated)
592
#       (unbalanced braces must be \-escaped)
593
#
594
# "{ target selector }" is a list of expressions that determine whether the
595
# test succeeds or fails for a particular target, or in some cases whether the
596
# option applies for a particular target.  If the case of `dg-do' it specifies
597
# whether the test case is even attempted on the specified target.
598
#
599
# The target selector is always optional.  The format is one of:
600
#
601
# { xfail *-*-* ... } - the test is expected to fail for the given targets
602
# { target *-*-* ... } - the option only applies to the given targets
603
#
604
# At least one target must be specified, use *-*-* for "all targets".
605
# At present it is not possible to specify both `xfail' and `target'.
606
# "native" may be used in place of "*-*-*".
607
 
608
Example 1: Testing compilation only
609
// { dg-do compile }
610
 
611
Example 2: Testing for expected warnings on line 36, which all targets fail
612
// { dg-warning "string literals" "" { xfail *-*-* } 36 }
613
 
614
Example 3: Testing for expected warnings on line 36
615
// { dg-warning "string literals" "" { target *-*-* } 36 }
616
 
617
Example 4: Testing for compilation errors on line 41
618
// { dg-do compile }
619
// { dg-error "no match for" "" { target *-*-* } 41 }
620
 
621
Example 5: Testing with special command line settings, or without the
622
use of pre-compiled headers, in particular the stdc++.h.gch file. Any
623
options here will override the DEFAULT_CXXFLAGS and PCH_CXXFLAGS set
624
up in the normal.exp file.
625
// { dg-options "-O0" { target *-*-* } }
626
627
 
628
   
629
    More examples can be found in the libstdc++-v3/testsuite/*/*.cc files.
630
   
631
632
 
633
 
634
Test Harness and Utilities
635
 
636
 
637
Dejagnu Harness Details
638
 
639
  
640
    Underlying details of testing for conformance and regressions are
641
    abstracted via the GNU Dejagnu package. This is similar to the
642
    rest of GCC.
643
  
644
 
645
 
646
This is information for those looking at making changes to the testsuite
647
structure, and/or needing to trace dejagnu's actions with --verbose.  This
648
will not be useful to people who are "merely" adding new tests to the existing
649
structure.
650
651
 
652
The first key point when working with dejagnu is the idea of a "tool".
653
Files, directories, and functions are all implicitly used when they are
654
named after the tool in use.  Here, the tool will always be "libstdc++".
655
656
 
657
The lib subdir contains support routines.  The
658
lib/libstdc++.exp file ("support library") is loaded
659
automagically, and must explicitly load the others.  For example, files can
660
be copied from the core compiler's support directory into lib.
661
662
 
663
Some routines in lib/libstdc++.exp are callbacks, some are
664
our own.  Callbacks must be prefixed with the name of the tool.  To easily
665
distinguish the others, by convention our own routines are named "v3-*".
666
667
 
668
The next key point when working with dejagnu is "test files".  Any
669
directory whose name starts with the tool name will be searched for test files.
670
(We have only one.)  In those directories, any .exp file is
671
considered a test file, and will be run in turn.  Our main test file is called
672
normal.exp; it runs all the tests in testsuite_files using the
673
callbacks loaded from the support library.
674
675
 
676
The config directory is searched for any particular "target
677
board" information unique to this library.  This is currently unused and sets
678
only default variables.
679
680
 
681
682
 
683
Utilities
684
 
685
  
686
  
687
  
688
   The testsuite directory also contains some files that implement
689
   functionality that is intended to make writing test cases easier,
690
   or to avoid duplication, or to provide error checking in a way that
691
   is consistent across platforms and test harnesses. A stand-alone
692
   executable, called abi_check, and a static
693
   library called libtestc++ are
694
   constructed. Both of these items are not installed, and only used
695
   during testing.
696
  
697
 
698
  
699
  These files include the following functionality:
700
  
701
 
702
  
703
     
704
       
705
       testsuite_abi.h,
706
       testsuite_abi.cc,
707
       testsuite_abi_check.cc
708
       
709
       
710
        Creates the executable abi_check.
711
        Used to check correctness of symbol versioning, visibility of
712
        exported symbols, and compatibility on symbols in the shared
713
        library, for hosts that support this feature. More information
714
        can be found in the ABI documentation here
715
       
716
     
717
     
718
       
719
       testsuite_allocator.h,
720
       testsuite_allocator.cc
721
       
722
       
723
        Contains specialized allocators that keep track of construction
724
        and destruction. Also, support for overriding global new and
725
        delete operators, including verification that new and delete
726
        are called during execution, and that allocation over max_size
727
        fails.
728
       
729
     
730
     
731
       
732
       testsuite_character.h
733
       
734
       
735
        Contains std::char_traits and
736
        std::codecvt specializations for a user-defined
737
        POD.
738
       
739
     
740
     
741
       
742
       testsuite_hooks.h,
743
       testsuite_hooks.cc
744
       
745
       
746
       A large number of utilities, including:
747
       
748
       
749
         VERIFY
750
         set_memory_limits
751
         verify_demangle
752
         run_tests_wrapped_locale
753
         run_tests_wrapped_env
754
         try_named_locale
755
         try_mkfifo
756
         func_callback
757
         counter
758
         copy_tracker
759
         copy_constructor
760
         assignment_operator
761
         destructor
762
         
763
         pod_char, pod_int and associated char_traits specializations
764
         
765
       
766
     
767
     
768
       
769
         testsuite_io.h
770
       
771
       
772
       Error, exception, and constraint checking for
773
       std::streambuf, std::basic_stringbuf, std::basic_filebuf.
774
       
775
     
776
     
777
       
778
         testsuite_iterators.h
779
       
780
       
781
         Wrappers for various iterators.
782
       
783
     
784
     
785
       
786
         testsuite_performance.h
787
       
788
       
789
       A number of class abstractions for performance counters, and
790
       reporting functions including:
791
       
792
      
793
         time_counter
794
         resource_counter
795
         report_performance
796
      
797
     
798
  
799
800
 
801
802
 
803
Special Topics
804
 
805
 
806
</code></pre></td> </tr> <tr valign="middle"> <td>807</td> <td></td> <td></td> <td class="code"><pre><code> Qualifying Exception Safety Guarantees</code></pre></td> </tr> <tr valign="middle"> <td>808</td> <td></td> <td></td> <td class="code"><pre><code> <indexterm></code></pre></td> </tr> <tr valign="middle"> <td>809</td> <td></td> <td></td> <td class="code"><pre><code> <primary>Test</primary></code></pre></td> </tr> <tr valign="middle"> <td>810</td> <td></td> <td></td> <td class="code"><pre><code> <secondary>Exception Safety</secondary></code></pre></td> </tr> <tr valign="middle"> <td>811</td> <td></td> <td></td> <td class="code"><pre><code> </indexterm></code></pre></td> </tr> <tr valign="middle"> <td>812</td> <td></td> <td></td> <td class="code"><pre><code>
813
 
814
 
815
Overview
816
 
817
 
818
       
819
         Testing is composed of running a particular test sequence,
820
         and looking at what happens to the surrounding code when
821
         exceptions are thrown. Each test is composed of measuring
822
         initial state, executing a particular sequence of code under
823
         some instrumented conditions, measuring a final state, and
824
         then examining the differences between the two states.
825
       
826
 
827
       
828
         Test sequences are composed of constructed code sequences
829
         that exercise a particular function or member function, and
830
         either confirm no exceptions were generated, or confirm the
831
         consistency/coherency of the test subject in the event of a
832
         thrown exception.
833
       
834
 
835
       
836
         Random code paths can be constructed using the basic test
837
         sequences and instrumentation as above, only combined in a
838
         random or pseudo-random way.
839
       
840
 
841
        To compute the code paths that throw, test instruments
842
         are used that throw on allocation events
843
         (__gnu_cxx::throw_allocator_random
844
         and __gnu_cxx::throw_allocator_limit)
845
         and copy, assignment, comparison, increment, swap, and
846
         various operators
847
         (__gnu_cxx::throw_type_random
848
         and __gnu_cxx::throw_type_limit). Looping
849
         through a given test sequence and conditionally throwing in
850
         all instrumented places.  Then, when the test sequence
851
         completes without an exception being thrown, assume all
852
         potential error paths have been exercised in a sequential
853
         manner.
854
       
855
856
 
857
 
858
</code></pre></td> </tr> <tr valign="middle"> <td>859</td> <td></td> <td></td> <td class="code"><pre><code> Existing tests</code></pre></td> </tr> <tr valign="middle"> <td>860</td> <td></td> <td></td> <td class="code"><pre><code>
861
 
862
 
863
  
864
     
865
       
866
         Ad Hoc
867
       
868
       
869
         For example,
870
         testsuite/23_containers/list/modifiers/3.cc.
871
       
872
     
873
 
874
     
875
       
876
         Policy Based Data Structures
877
       
878
       
879
         For example, take the test
880
         functor rand_reg_test in
881
         in testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc. This uses container_rand_regression_test in
882
testsuite/util/regression/rand/assoc/container_rand_regression_test.h.
883
 
884
       
885
 
886
       
887
         Which has several tests for container member functions,
888
Includes control and test container objects. Configuration includes
889
random seed, iterations, number of distinct values, and the
890
probability that an exception will be thrown. Assumes instantiating
891
container uses an extension
892
allocator, __gnu_cxx::throw_allocator_random,
893
as the allocator type.
894
       
895
     
896
 
897
     
898
       
899
         C++11 Container Requirements.
900
       
901
 
902
       
903
         Coverage is currently limited to testing container
904
         requirements for exception safety,
905
         although __gnu_cxx::throw_type meets
906
         the additional type requirements for testing numeric data
907
         structures and instantiating algorithms.
908
       
909
 
910
       
911
         Of particular interest is extending testing to algorithms and
912
         then to parallel algorithms. Also io and locales.
913
       
914
 
915
       
916
         The test instrumentation should also be extended to add
917
         instrumentation to iterator
918
         and const_iterator types that throw
919
         conditionally on iterator operations.
920
       
921
     
922
  
923
924
 
925
 
926
</code></pre></td> </tr> <tr valign="middle"> <td>927</td> <td></td> <td></td> <td class="code"><pre><code>C++11 Requirements Test Sequence Descriptions</code></pre></td> </tr> <tr valign="middle"> <td>928</td> <td></td> <td></td> <td class="code"><pre><code>
929
 
930
 
931
  
932
     
933
       
934
         Basic
935
       
936
 
937
       
938
         Basic consistency on exception propagation tests. For
939
         each container, an object of that container is constructed,
940
         a specific member function is exercised in
941
         a try block, and then any thrown
942
         exceptions lead to error checking in the appropriate
943
         catch block. The container's use of
944
         resources is compared to the container's use prior to the
945
         test block. Resource monitoring is limited to allocations
946
         made through the container's allocator_type,
947
         which should be sufficient for container data
948
         structures. Included in these tests are member functions
949
         are iterator and const_iterator
950
         operations, pop_front, pop_back, push_front, push_back, insert, erase, swap, clear,
951
         and rehash. The container in question is
952
         instantiated with two instrumented template arguments,
953
         with __gnu_cxx::throw_allocator_limit
954
         as the allocator type, and
955
         with __gnu_cxx::throw_type_limit as
956
         the value type. This allows the test to loop through
957
         conditional throw points.
958
       
959
 
960
     
961
         The general form is demonstrated in
962
         testsuite/23_containers/list/requirements/exception/basic.cc
963
         . The instantiating test object is __gnu_test::basic_safety and is detailed in testsuite/util/exception/safety.h.
964
       
965
     
966
 
967
 
968
     
969
       
970
         Generation Prohibited
971
       
972
 
973
       
974
         Exception generation tests. For each container, an object of
975
         that container is constructed and all member functions
976
         required to not throw exceptions are exercised. Included in
977
         these tests are member functions
978
         are iterator and const_iterator operations, erase, pop_front, pop_back, swap,
979
         and clear. The container in question is
980
         instantiated with two instrumented template arguments,
981
         with __gnu_cxx::throw_allocator_random
982
         as the allocator type, and
983
         with __gnu_cxx::throw_type_random as
984
         the value type. This test does not loop, an instead is sudden
985
         death: first error fails.
986
       
987
       
988
         The general form is demonstrated in
989
         testsuite/23_containers/list/requirements/exception/generation_prohibited.cc
990
         . The instantiating test object is __gnu_test::generation_prohibited and is detailed in testsuite/util/exception/safety.h.
991
       
992
     
993
 
994
 
995
     
996
       
997
         Propagation Consistent
998
       
999
 
1000
       
1001
         Container rollback on exception propagation tests. For
1002
         each container, an object of that container is constructed,
1003
         a specific member function that requires rollback to a previous
1004
         known good state is exercised in
1005
         a try block, and then any thrown
1006
         exceptions lead to error checking in the appropriate
1007
         catch block. The container is compared to
1008
         the container's last known good state using such parameters
1009
         as size, contents, and iterator references. Included in these
1010
         tests are member functions
1011
         are push_front, push_back, insert,
1012
         and rehash. The container in question is
1013
         instantiated with two instrumented template arguments,
1014
         with __gnu_cxx::throw_allocator_limit
1015
         as the allocator type, and
1016
         with __gnu_cxx::throw_type_limit as
1017
         the value type. This allows the test to loop through
1018
         conditional throw points.
1019
       
1020
 
1021
       
1022
         The general form demonstrated in
1023
         testsuite/23_containers/list/requirements/exception/propagation_coherent.cc
1024
         . The instantiating test object is __gnu_test::propagation_coherent and is detailed in testsuite/util/exception/safety.h.
1025
       
1026
     
1027
  
1028
 
1029
1030
 
1031
1032
 
1033
1034
 
1035

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.