diff options
Diffstat (limited to 'testsuites/validation/tc-thread-idle-body-no-return.c')
-rw-r--r-- | testsuites/validation/tc-thread-idle-body-no-return.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/testsuites/validation/tc-thread-idle-body-no-return.c b/testsuites/validation/tc-thread-idle-body-no-return.c index 5234a460f9..19c86dad99 100644 --- a/testsuites/validation/tc-thread-idle-body-no-return.c +++ b/testsuites/validation/tc-thread-idle-body-no-return.c @@ -3,11 +3,11 @@ /** * @file * - * @ingroup RTEMSTestCaseScoreThreadValIdleBodyNoReturn + * @ingroup ScoreThreadValIdleBodyNoReturn */ /* - * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2022 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -59,10 +59,10 @@ #include <rtems/test.h> /** - * @defgroup RTEMSTestCaseScoreThreadValIdleBodyNoReturn \ + * @defgroup ScoreThreadValIdleBodyNoReturn \ * spec:/score/thread/val/idle-body-no-return * - * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * @ingroup TestsuitesValidation0 * * @brief Tests thread idle body behaviour. * @@ -90,7 +90,7 @@ typedef struct { /** * @brief This member contains a counter. */ - uint32_t counter;; + uint32_t counter; } ScoreThreadValIdleBodyNoReturn_Context; static ScoreThreadValIdleBodyNoReturn_Context @@ -100,19 +100,30 @@ typedef ScoreThreadValIdleBodyNoReturn_Context Context; static void CheckIdleBody( Context *ctx, rtems_task_entry entry ) { - rtems_id id; + rtems_id id; + rtems_interval interval; + rtems_status_code sc; ctx->counter = 0; id = CreateTask( "WORK", PRIO_LOW ); StartTask( id, entry, ctx ); - while ( ctx->counter == 0 ) { - rtems_status_code sc; + /* + * With optimization disabled, coverage enabled, SMP enabled and a slow + * target, things may take some time. + */ + interval = 1; + while ( ctx->counter == 0 && interval <= 1024 ) { - sc = rtems_task_wake_after( 1 ); + sc = rtems_task_wake_after( interval ); T_rsc_success( sc ); + + interval *= 2; } + sc = rtems_task_wake_after( interval ); + T_rsc_success( sc ); + T_eq_u32( ctx->counter, 1 ); DeleteTask( id ); } |