Changeset 2d60095 in rtems


Ignore:
Timestamp:
Aug 26, 1997, 7:24:22 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
39ffc7d
Parents:
588a2382
Message:

Patches from Chris Johns to clean up test.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/libtests/rtems++/Init.cc

    r588a2382 r2d60095  
    2626#include "System.h"
    2727
     28// make global so it lasts past the Init task's stack's life time
     29Task1 task_1;
     30
    2831rtems_task Init(rtems_task_argument )
    2932{
    3033  puts( "\n\n*** RTEMS++ TEST ***" );
    3134
    32   rtemsEvent end_me("INIT");
    33   Task1 task_1;
    34  
    35   task_1.set_end_event(end_me);
    36  
    3735  printf( "INIT - Task.create() - " );
    3836  task_1.create("TA1 ", 0, RTEMS_MINIMUM_STACK_SIZE);
     
    5553  printf("%s\n", task_1.last_status_string());
    5654
    57   // block waiting for any event
    58   rtems_event_set out;
    59 
    60   // wait for task1 to tell me to finish
    61   end_me.receive(RTEMS_SIGNAL_0, out);
    62 
    63   task_1.destroy();
    64  
    65   printf("*** END OF RTEMS++ TEST ***");
     55  printf("INIT - Destroy it's self\n");
    6656
    6757  // needs to be in C, no C++ object owns the Init task
  • c/src/tests/libtests/rtems++/System.h

    r588a2382 r2d60095  
    4040  rtemsEvent end_init;
    4141 
     42  rtemsEvent end_init;
     43 
     44  rtemsEvent end_init;
     45 
    4246  void print_mode(rtems_mode mode, rtems_mode mask);
    4347 
     
    4953  void screen6(void);
    5054
     55  void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
    5156protected:
    5257  virtual void body(rtems_task_argument argument);
     58  void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
    5359
    5460public:
     
    7379  : public rtemsTask
    7480{
     81};
     82
     83class EndTask
     84  : public rtemsTask
     85{
     86protected:
     87  virtual void body(rtems_task_argument argument);
     88
     89public: 
     90  EndTask(const char* name,
     91          const rtems_task_priority initial_priority,
     92          const rtems_unsigned32 stack_size);
    7593  void screen6(void);
    7694
  • c/src/tests/libtests/rtems++/Task1.cc

    r588a2382 r2d60095  
    2424 */
    2525
     26#include <stdlib.h>
    2627#include <string.h>
    2728#include "System.h"
     
    5556 
    5657  screen6();
    57   rtems_test_pause_and_screen_number(7);
    58 
    59   // causes init to delete me and itself
    60   end_init.send(RTEMS_SIGNAL_0);
     58
     59  // do not call exit(0) from this thread as this object is static
     60  // the static destructor call delete the task which is calling exit
     61  // so exit never completes
     62 
     63  EndTask end_task("ENDT", (rtems_task_priority) 1, RTEMS_MINIMUM_STACK_SIZE * 6);
     64  end_task.start(0);
     65
     66  rtemsEvent block_me;
     67  rtems_event_set out;
     68 
     69  block_me.receive(RTEMS_SIGNAL_0, out);
     70
     71  printf("**** TASK 1 did not block ????\n");
    6172}
    6273
     
    656667           mode & RTEMS_INTERRUPT_MASK);
    657668}
     669
     670EndTask::EndTask(const char* name,
     671                 const rtems_task_priority initial_priority,
     672                 const rtems_unsigned32 stack_size)
     673  : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
     674{
     675}
     676 
     677void EndTask::body(rtems_task_argument )
     678{
     679 printf("*** END OF RTEMS++ TEST ***\n");
     680 exit(0);
     681}
     682
  • c/src/tests/libtests/rtems++/Task2.cc

    r588a2382 r2d60095  
    3333  screen4();
    3434
    35   printf("%s - destory itself\n", name_string());
     35  printf("%s - destroy itself\n", name_string());
    3636  destroy();
    3737}
  • c/src/tests/libtests/rtems++/Task3.cc

    r588a2382 r2d60095  
    3333  screen6();
    3434
    35   printf("%s - destory itself\n", name_string());
     35  printf("%s - destroy itself\n", name_string());
    3636  destroy();
    3737}
  • testsuites/libtests/rtems++/Init.cc

    r588a2382 r2d60095  
    2626#include "System.h"
    2727
     28// make global so it lasts past the Init task's stack's life time
     29Task1 task_1;
     30
    2831rtems_task Init(rtems_task_argument )
    2932{
    3033  puts( "\n\n*** RTEMS++ TEST ***" );
    3134
    32   rtemsEvent end_me("INIT");
    33   Task1 task_1;
    34  
    35   task_1.set_end_event(end_me);
    36  
    3735  printf( "INIT - Task.create() - " );
    3836  task_1.create("TA1 ", 0, RTEMS_MINIMUM_STACK_SIZE);
     
    5553  printf("%s\n", task_1.last_status_string());
    5654
    57   // block waiting for any event
    58   rtems_event_set out;
    59 
    60   // wait for task1 to tell me to finish
    61   end_me.receive(RTEMS_SIGNAL_0, out);
    62 
    63   task_1.destroy();
    64  
    65   printf("*** END OF RTEMS++ TEST ***");
     55  printf("INIT - Destroy it's self\n");
    6656
    6757  // needs to be in C, no C++ object owns the Init task
  • testsuites/libtests/rtems++/System.h

    r588a2382 r2d60095  
    4040  rtemsEvent end_init;
    4141 
     42  rtemsEvent end_init;
     43 
     44  rtemsEvent end_init;
     45 
    4246  void print_mode(rtems_mode mode, rtems_mode mask);
    4347 
     
    4953  void screen6(void);
    5054
     55  void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
    5156protected:
    5257  virtual void body(rtems_task_argument argument);
     58  void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
    5359
    5460public:
     
    7379  : public rtemsTask
    7480{
     81};
     82
     83class EndTask
     84  : public rtemsTask
     85{
     86protected:
     87  virtual void body(rtems_task_argument argument);
     88
     89public: 
     90  EndTask(const char* name,
     91          const rtems_task_priority initial_priority,
     92          const rtems_unsigned32 stack_size);
    7593  void screen6(void);
    7694
  • testsuites/libtests/rtems++/Task1.cc

    r588a2382 r2d60095  
    2424 */
    2525
     26#include <stdlib.h>
    2627#include <string.h>
    2728#include "System.h"
     
    5556 
    5657  screen6();
    57   rtems_test_pause_and_screen_number(7);
    58 
    59   // causes init to delete me and itself
    60   end_init.send(RTEMS_SIGNAL_0);
     58
     59  // do not call exit(0) from this thread as this object is static
     60  // the static destructor call delete the task which is calling exit
     61  // so exit never completes
     62 
     63  EndTask end_task("ENDT", (rtems_task_priority) 1, RTEMS_MINIMUM_STACK_SIZE * 6);
     64  end_task.start(0);
     65
     66  rtemsEvent block_me;
     67  rtems_event_set out;
     68 
     69  block_me.receive(RTEMS_SIGNAL_0, out);
     70
     71  printf("**** TASK 1 did not block ????\n");
    6172}
    6273
     
    656667           mode & RTEMS_INTERRUPT_MASK);
    657668}
     669
     670EndTask::EndTask(const char* name,
     671                 const rtems_task_priority initial_priority,
     672                 const rtems_unsigned32 stack_size)
     673  : rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
     674{
     675}
     676 
     677void EndTask::body(rtems_task_argument )
     678{
     679 printf("*** END OF RTEMS++ TEST ***\n");
     680 exit(0);
     681}
     682
  • testsuites/libtests/rtems++/Task2.cc

    r588a2382 r2d60095  
    3333  screen4();
    3434
    35   printf("%s - destory itself\n", name_string());
     35  printf("%s - destroy itself\n", name_string());
    3636  destroy();
    3737}
  • testsuites/libtests/rtems++/Task3.cc

    r588a2382 r2d60095  
    3333  screen6();
    3434
    35   printf("%s - destory itself\n", name_string());
     35  printf("%s - destroy itself\n", name_string());
    3636  destroy();
    3737}
Note: See TracChangeset for help on using the changeset viewer.