summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/sp69
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-10 20:25:39 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-12-10 20:25:39 +0000
commitfe0286a0cf2451509c02696b5773ab5985e89f89 (patch)
treef96c88eb07178d0444c4c6ef3d5e47c367d67771 /testsuites/sptests/sp69
parent2009-12-10 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-fe0286a0cf2451509c02696b5773ab5985e89f89.tar.bz2
2009-12-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* sp69/init.c, sp69/sp69.doc, sp69/sp69.scn: Add test for statistics on expired periods. This detected the recently introduced PR1480.
Diffstat (limited to 'testsuites/sptests/sp69')
-rw-r--r--testsuites/sptests/sp69/init.c51
-rw-r--r--testsuites/sptests/sp69/sp69.doc1
-rw-r--r--testsuites/sptests/sp69/sp69.scn2
3 files changed, 46 insertions, 8 deletions
diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/init.c
index 1b79e610e7..4e62014686 100644
--- a/testsuites/sptests/sp69/init.c
+++ b/testsuites/sptests/sp69/init.c
@@ -17,10 +17,12 @@ rtems_task Init(
rtems_task_argument argument
)
{
- rtems_id period_id;
- rtems_name period_name;
- rtems_rate_monotonic_period_status period_status;
- rtems_status_code status;
+ rtems_id period_id;
+ rtems_name period_name;
+ rtems_rate_monotonic_period_status period_status;
+ rtems_status_code status;
+ rtems_rate_monotonic_period_statistics statistics;
+ int i;
period_name = rtems_build_name('P','E','R','1');
@@ -88,9 +90,7 @@ rtems_task Init(
/*
* Check normal get_status results.
*/
- puts(
- "rtems_rate_monotonic_get_status - verify values of an active period"
- );
+ puts( "rtems_rate_monotonic_get_status - verify values of an active period" );
rtems_test_spin_until_next_tick();
status = rtems_rate_monotonic_period( period_id, 100 );
directive_failed( status, "rate_monotonic_period" );
@@ -140,7 +140,42 @@ rtems_task Init(
rtems_test_assert( period_status.executed_since_last_period <= 12 );
#endif
- puts("*** END OF TEST 69 ***");
+ /* ensure the missed periods are properly accounted for */
+ puts( "rtems_rate_monotonic_cancel - OK" );
+ status = rtems_rate_monotonic_cancel( period_id );
+ directive_failed( status, "rate_monotonic_cancel" );
+
+ puts( "Testing statistics on missed periods" );
+ rtems_test_spin_until_next_tick();
+ status = rtems_rate_monotonic_period( period_id, 50 );
+ directive_failed( status, "rate_monotonic_period above loop" );
+
+ for ( i=1 ; i <= 3 ; i++ ) {
+ status = rtems_task_wake_after( 100 );
+ directive_failed( status, "rtems_task_wake_after(100)" );
+
+ rtems_test_spin_until_next_tick();
+ status = rtems_rate_monotonic_period( period_id, 50 );
+ fatal_directive_status(
+ status,
+ RTEMS_TIMEOUT,
+ "rtems_rate_monotonic_period 2-n"
+ );
+
+ status = rtems_rate_monotonic_get_statistics( period_id, &statistics );
+ directive_failed( status, "rate_monotonic_get_statistics" );
+ if ( statistics.missed_count != i ) {
+ printf(
+ "Expected %d got %d for missed_count\n",
+ i,
+ statistics.missed_count
+ );
+ }
+
+ rtems_test_assert( statistics.missed_count == i );
+ }
+
+ puts( "*** END OF TEST 69 ***" );
rtems_test_exit(0);
}
diff --git a/testsuites/sptests/sp69/sp69.doc b/testsuites/sptests/sp69/sp69.doc
index 96777e776e..9d204e8d19 100644
--- a/testsuites/sptests/sp69/sp69.doc
+++ b/testsuites/sptests/sp69/sp69.doc
@@ -23,3 +23,4 @@ concepts:
+ Ensure that RTEMS_NOT_DEFINED is returned if the cpu usage is reset after
a period is initiated.
+ Verify the correctness of the status values returned on an active period.
++ Ensure the missed period count is properly maintained.
diff --git a/testsuites/sptests/sp69/sp69.scn b/testsuites/sptests/sp69/sp69.scn
index a100465cbf..654eea08f1 100644
--- a/testsuites/sptests/sp69/sp69.scn
+++ b/testsuites/sptests/sp69/sp69.scn
@@ -4,4 +4,6 @@ rtems_rate_monotonic_get_status - check RTEMS_NOT_DEFINED
rtems_rate_monotonic_get_status - verify values of an active period
wall time should be ~600000000 is 609216000
cpu time should be ~100000000 is 109217000
+rtems_rate_monotonic_cancel - OK
+Testing statistics on missed periods
*** END OF TEST 69 ***