Changeset 05006c90 in rtems for testsuites/samples


Ignore:
Timestamp:
Dec 9, 2016, 7:25:47 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
b6606e8
Parents:
8c637ee
git-author:
Sebastian Huber <sebastian.huber@…> (12/09/16 07:25:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/09/16 07:26:47)
Message:

cdtest: Print proper begin/end of test messages

Location:
testsuites/samples/cdtest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • testsuites/samples/cdtest/cdtest.scn

    r8c637ee r05006c90  
    1 Hey I'm in base class constructor number 1 for 0x400010cc.
    2 Hey I'm in base class constructor number 2 for 0x400010d4.
    3 Hey I'm in derived class constructor number 3 for 0x400010d4.
     1*** BEGIN OF TEST CONSTRUCTOR/DESTRUCTOR ***
     2GLOBAL: Hey I'm in base class constructor number 1 for 0x2052154.
     3GLOBAL: Hey I'm in base class constructor number 2 for 0x2052148.
     4GLOBAL: Hey I'm in derived class constructor number 3 for 0x2052148.
    45
    56
    6 *** CONSTRUCTOR/DESTRUCTOR TEST ***
    7 Hey I'm in base class constructor number 4 for 0x4009ee08.
    8 Hey I'm in base class constructor number 5 for 0x4009ee10.
    9 Hey I'm in base class constructor number 6 for 0x4009ee18.
    10 Hey I'm in base class constructor number 7 for 0x4009ee20.
    11 Hey I'm in derived class constructor number 8 for 0x4009ee20.
    12 Testing a C++ I/O stream
    13 Hey I'm in derived class destructor number 8 for 0x4009ee20.
     7*** BEGIN OF TEST CONSTRUCTOR/DESTRUCTOR ***
     8LOCAL: Hey I'm in base class constructor number 4 for 0x2057978.
     9LOCAL: Hey I'm in base class constructor number 5 for 0x2057984.
     10LOCAL: Hey I'm in base class constructor number 6 for 0x2057990.
     11LOCAL: Hey I'm in base class constructor number 7 for 0x205799c.
     12LOCAL: Hey I'm in derived class constructor number 8 for 0x205799c.
     13IO Stream not tested
     14LOCAL: Hey I'm in derived class destructor number 8 for 205799C.
    1415Derived class - Instantiation order 8
    15 Hey I'm in base class destructor number 7 for 0x4009ee20.
    16 Instantiation order 8
    17 Hey I'm in base class destructor number 6 for 0x4009ee18.
    18 Instantiation order 6
    19 Hey I'm in base class destructor number 5 for 0x4009ee10.
    20 Instantiation order 5
    21 Hey I'm in base class destructor number 4 for 0x4009ee08.
    22 Instantiation order 5
    23 *** END OF CONSTRUCTOR/DESTRUCTOR TEST ***
     16LOCAL: Hey I'm in base class destructor number 7 for 205799C.
     17Derived class - Instantiation order 8
     18LOCAL: Hey I'm in base class destructor number 6 for 2057990.
     19Derived class - Instantiation order 6
     20LOCAL: Hey I'm in base class destructor number 5 for 2057984.
     21Derived class - Instantiation order 5
     22LOCAL: Hey I'm in base class destructor number 4 for 2057978.
     23Derived class - Instantiation order 5
     24*** TESTING C++ EXCEPTIONS ***
    2425
    25 
    26 Hey I'm in derived class destructor number 3 for 0x400010d4.
     26foo_function() catch block called:
     27   < foo_function() throw this exception  >
     28Success catching a char * exception
     29foo_function() re-throwing execption...
     30throw std::runtime: caught: thrown std::runtime object
     31throw an instance based exception
     32RtemsException raised=File:../../../../../../../rtems/c/src/../../testsuites/samples/cdtest/main.cc, Line:229, Error=55
     33Success catching RtemsException...
     34RtemsException ---> File:../../../../../../../rtems/c/src/../../testsuites/samples/cdtest/main.cc, Line:229, Error=55
     35Exceptions are working properly.
     36Global Dtors should be called after this line....
     37GLOBAL: Hey I'm in derived class destructor number 3 for 2052148.
    2738Derived class - Instantiation order 3
    28 Hey I'm in base class destructor number 2 for 0x400010d4.
    29 Instantiation order 3
    30 Hey I'm in base class destructor number 1 for 0x400010cc.
    31 Instantiation order 1
     39GLOBAL: Hey I'm in base class destructor number 2 for 2052148.
     40Derived class - Instantiation order 3
     41GLOBAL: Hey I'm in base class destructor number 1 for 2052154.
     42Derived class - Instantiation order 1
     43*** END OF TEST CONSTRUCTOR/DESTRUCTOR ***
  • testsuites/samples/cdtest/main.cc

    r8c637ee r05006c90  
    4545static int num_inst = 0;
    4646
     47static void check_begin_of_test(void)
     48{
     49  if ( num_inst == 0 ) {
     50    printf(TEST_BEGIN_STRING);
     51  }
     52}
     53
     54static void check_end_of_test(void)
     55{
     56  if ( num_inst == 0 ) {
     57    printk(TEST_END_STRING);
     58  }
     59}
     60
    4761class AClass {
    4862public:
    4963  AClass(const char *p = "LOCAL" ) : ptr( p )
    5064    {
     65        check_begin_of_test();
    5166        num_inst++;
    5267        printf(
     
    7287        printk("Derived class - %s\n", string);
    7388        num_inst--;
     89        check_end_of_test();
    7490    };
    7591
     
    85101  BClass(const char *p = "LOCAL" ) : AClass( p )
    86102    {
     103        check_begin_of_test();
    87104        num_inst++;
    88105        printf(
     
    108125        printk("Derived class - %s\n", string);
    109126        num_inst--;
     127        check_end_of_test();
    110128    };
    111129
     
    186204    cdtest();
    187205
    188     TEST_END();
    189 
    190206    printf( "*** TESTING C++ EXCEPTIONS ***\n\n" );
    191207
Note: See TracChangeset for help on using the changeset viewer.