Ignore:
Timestamp:
11/22/22 18:09:12 (15 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
8bc15aba
Parents:
94df7a01
git-author:
Sebastian Huber <sebastian.huber@…> (11/22/22 18:09:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/23 05:47:37)
Message:

validation: Test the global construction

Update #3716.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/validation/tc-score-thread.c

    r94df7a01 rc821b92  
    9696 *   - Clean up all used resources.
    9797 *
     98 * - Validate the global construction.  Mark that the test case executed.
     99 *
     100 *   - Check that the global constructor was called exactly once.
     101 *
     102 *   - Check that the global construction was done by the Classic API user
     103 *     initialization task.
     104 *
     105 *   - Check that the global constructor was called before the task entry.
     106 *
    98107 * @{
    99108 */
     
    123132
    124133typedef ScoreThreadValThread_Context Context;
     134
     135static bool test_case_executed;
     136
     137static bool constructor_test_case_executed;
     138
     139static uint32_t constructor_calls;
     140
     141static rtems_id constructor_id;
     142
     143static __attribute__(( __constructor__ )) void Constructor( void )
     144{
     145  constructor_test_case_executed = test_case_executed;
     146  ++constructor_calls;
     147  constructor_id = rtems_task_self();
     148}
    125149
    126150static void TaskTerminate( rtems_tcb *executing )
     
    291315
    292316/**
     317 * @brief Validate the global construction.  Mark that the test case executed.
     318 */
     319static void ScoreThreadValThread_Action_2( ScoreThreadValThread_Context *ctx )
     320{
     321  test_case_executed = true;
     322
     323  /*
     324   * Check that the global constructor was called exactly once.
     325   */
     326  T_eq_u32( constructor_calls, 1 );
     327
     328  /*
     329   * Check that the global construction was done by the Classic API user
     330   * initialization task.
     331   */
     332  T_eq_u32( constructor_id, rtems_task_self() );
     333
     334  /*
     335   * Check that the global constructor was called before the task entry.
     336   */
     337  T_false( constructor_test_case_executed );
     338}
     339
     340/**
    293341 * @fn void T_case_body_ScoreThreadValThread( void )
    294342 */
     
    301349  ScoreThreadValThread_Action_0( ctx );
    302350  ScoreThreadValThread_Action_1( ctx );
     351  ScoreThreadValThread_Action_2( ctx );
    303352}
    304353
Note: See TracChangeset for help on using the changeset viewer.