summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-19 14:55:24 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-19 14:55:24 +0000
commit712726d3df9965ddf15e9e9d61af79268a453e3a (patch)
treececf989ca45babe0c7be421f22d91480064790b7 /testsuites/psxtests
parent2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-712726d3df9965ddf15e9e9d61af79268a453e3a.tar.bz2
2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
* psx07/init.c, psx07/psx07.scn, psx07/system.h, psx07/task.c: Update test to reflect not allowing poriority changes when mutex is locked.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/ChangeLog5
-rw-r--r--testsuites/psxtests/psx07/init.c34
-rw-r--r--testsuites/psxtests/psx07/psx07.scn34
-rw-r--r--testsuites/psxtests/psx07/system.h7
-rw-r--r--testsuites/psxtests/psx07/task.c33
5 files changed, 112 insertions, 1 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 3c2c66daa1..498e57409c 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-19 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * psx07/init.c, psx07/psx07.scn, psx07/system.h, psx07/task.c: Update
+ test to reflect not allowing poriority changes when mutex is locked.
+
2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com>
* psx01/init.c, psx01/psx01.scn: Add test case for nanosleep with NULL
diff --git a/testsuites/psxtests/psx07/init.c b/testsuites/psxtests/psx07/init.c
index 4db4d4552e..56f7ebdf5d 100644
--- a/testsuites/psxtests/psx07/init.c
+++ b/testsuites/psxtests/psx07/init.c
@@ -555,6 +555,40 @@ void *POSIX_Init(
status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
fatal_directive_check_status_only( status, EINVAL, "invalid priority" );
+ /*
+ * Create a sporadic thread that doesn't need it's priority
+ * boosted
+ */
+ empty_line();
+
+ puts( "Init - pthread_attr_init - SUCCESSFUL" );
+ status = pthread_attr_init( &attr );
+ posix_service_failed( status, "pthread_attr_init" );
+
+ puts( "Init - pthread_attr_setinheritsched - EXPLICIT - SUCCESSFUL" );
+ status = pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
+ assert( !status );
+
+ schedparam.ss_replenish_period.tv_sec = 3;
+ schedparam.ss_replenish_period.tv_nsec = 3;
+ schedparam.ss_initial_budget.tv_sec = 1;
+ schedparam.ss_initial_budget.tv_nsec = 1;
+ schedparam.sched_priority = sched_get_priority_max( SCHED_FIFO );
+ schedparam.ss_low_priority = sched_get_priority_max( SCHED_FIFO ) - 6;
+
+ puts( "Init - pthread_attr_setschedpolicy - SUCCESSFUL" );
+ status = pthread_attr_setschedpolicy( &attr, SCHED_SPORADIC );
+ posix_service_failed( status, "pthread_attr_setschedparam");
+ puts( "Init - pthread_attr_setschedparam - SUCCESSFUL" );
+ status = pthread_attr_setschedparam( &attr, &schedparam );
+ posix_service_failed( status, "pthread_attr_setschedparam");
+
+ status = pthread_create( &Task2_id, &attr, Task_2, NULL );
+ assert( !status );
+
+ status = pthread_join( Task2_id, NULL );
+ posix_service_failed( status, " pthread_join");
+
puts( "*** END OF POSIX TEST 7 ***" );
rtems_test_exit( 0 );
diff --git a/testsuites/psxtests/psx07/psx07.scn b/testsuites/psxtests/psx07/psx07.scn
index b151cdadbf..b66a2fb612 100644
--- a/testsuites/psxtests/psx07/psx07.scn
+++ b/testsuites/psxtests/psx07/psx07.scn
@@ -9,9 +9,18 @@ Init - pthread_create - EINVAL (attr not initialized)
Init - pthread_create - EINVAL (stacksize too small)
Init - pthread_create - EAGAIN (stacksize too large)
Init - pthread_create - EINVAL (invalid inherit scheduler)
+Init - pthread_attr_settime - EINVAL ( null attribute )
+Init - pthread_attr_gettime - EINVAL ( null attribute )
+Init - pthread_attr_settime - EINVAL ( is initialized )
+Init - pthread_attr_gettime - EINVAL ( is initialized )
+Init - pthread_attr_settime - EINVAL ( invalid clock allowed )
+Init - pthread_attr_gettime - EINVAL ( NULL clock allowed )
+Init - validate pthread_attr_setcputime - CLOCK_DISABLED
+Init - validate pthread_attr_setcputime - CLOCK_ENABLED
Init - pthread_create - ENOTSUP (unsupported system contention scope)
Init - pthread_create - SUCCESSFUL (inherit scheduler)
Task_1 - exitting
+
Init - pthread_attr_setscope - EINVAL (NULL attr)
Init - pthread_attr_setscope - ENOTSUP
Init - pthread_attr_setscope - EINVAL (not initialized attr)
@@ -22,6 +31,7 @@ Init - pthread_attr_getscope - EINVAL (NULL scope)
Init - pthread_attr_getscope - EINVAL (not initialized attr)
Init - pthread_attr_getscope - SUCCESSFUL
Init - current scope attribute = 0
+
Init - pthread_attr_setinheritsched - EINVAL (NULL attr)
Init - pthread_attr_setinheritsched - EINVAL (not initialized attr)
Init - pthread_attr_setinheritsched - ENOTSUP (invalid inheritsched)
@@ -31,6 +41,7 @@ Init - pthread_attr_getinheritsched - EINVAL (NULL inheritsched)
Init - pthread_attr_getinheritsched - EINVAL (not initialized attr)
Init - pthread_attr_getinheritsched - SUCCESSFUL
Init - current inherit scheduler attribute = 1
+
Init - pthread_attr_setschedpolicy - EINVAL (NULL attr)
Init - pthread_attr_setschedpolicy - EINVAL (not initialized attr)
Init - pthread_attr_setschedpolicy - ENOTSUP (invalid schedpolicy)
@@ -40,6 +51,7 @@ Init - pthread_attr_getschedpolicy - EINVAL (NULL schedpolicy)
Init - pthread_attr_getschedpolicy - EINVAL (not initialized attr)
Init - pthread_attr_getschedpolicy - SUCCESSFUL
Init - current scheduler policy attribute = 2
+
Init - pthread_attr_setstacksize - EINVAL (NULL attr)
Init - pthread_attr_setstacksize - EINVAL (not initialized attr)
Init - pthread_attr_setstacksize - SUCCESSFUL (low stacksize)
@@ -49,6 +61,7 @@ Init - pthread_attr_getstacksize - EINVAL (NULL stacksize)
Init - pthread_attr_getstacksize - EINVAL (not initialized attr)
Init - pthread_attr_getstacksize - SUCCESSFUL
Init - current stack size attribute is OK
+
Init - pthread_attr_setstackaddr - EINVAL (NULL attr)
Init - pthread_attr_setstackaddr - EINVAL (not initialized attr)
Init - pthread_attr_setstackaddr - SUCCESSFUL
@@ -57,6 +70,7 @@ Init - pthread_attr_getstackaddr - EINVAL (NULL stackaddr)
Init - pthread_attr_getstackaddr - EINVAL (not initialized attr)
Init - pthread_attr_getstackaddr - SUCCESSFUL
Init - current stack address attribute = 0x0
+
Init - pthread_attr_setdetachstate - EINVAL (NULL attr)
Init - pthread_attr_setdetachstate - EINVAL (not initialized attr)
Init - pthread_attr_setdetachstate - EINVAL (invalid detachstate)
@@ -66,6 +80,7 @@ Init - pthread_attr_getdetachstate - EINVAL (NULL detatchstate)
Init - pthread_attr_getdetachstate - EINVAL (not initialized attr)
Init - pthread_attr_getdetachstate - SUCCESSFUL
Init - current detach state attribute = 1
+
Init - pthread_attr_getschedparam - SUCCESSFUL
Init - sched priority = 2
Init - ss_low_priority = 0
@@ -78,6 +93,7 @@ Init - pthread_attr_setschedparam - SUCCESSFUL
Init - pthread_attr_getschedparam - EINVAL (NULL attr)
Init - pthread_attr_getschedparam - EINVAL (not initialized attr)
Init - pthread_attr_getschedparam - EINVAL (NULL schedparam)
+
Init - pthread_getschedparam - EINVAL (NULL policy)
Init - pthread_getschedparam - EINVAL (NULL schedparam)
Init - pthread_getschedparam - ESRCH (bad thread)
@@ -87,6 +103,7 @@ Init - sched priority = 2
Init - ss_low_priority = 0
Init - ss_replenish_period = (0, 0)
Init - ss_initial_budget = (0, 0)
+
Init - pthread_setschedparam - EINVAL (NULL schedparam)
Init - pthread_setschedparam - EINVAL (invalid priority)
Init - pthread_setschedparam - EINVAL (invalid policy)
@@ -95,4 +112,21 @@ Init - pthread_setschedparam - EINVAL (replenish == 0)
Init - pthread_setschedparam - EINVAL (budget == 0)
Init - pthread_setschedparam - EINVAL (replenish < budget)
Init - pthread_setschedparam - EINVAL (invalid priority)
+
+Init - pthread_attr_init - SUCCESSFUL
+Init - pthread_attr_setinheritsched - EXPLICIT - SUCCESSFUL
+Init - pthread_attr_setschedpolicy - SUCCESSFUL
+Init - pthread_attr_setschedparam - SUCCESSFUL
+Time elapsed Task_2: 0 (seconds)
+Time elapsed Task_2: 1 (seconds)
+Time elapsed Task_2: 2 (seconds)
+Time elapsed Task_2: 3 (seconds)
+Time elapsed Task_2: 4 (seconds)
+Time elapsed Task_2: 5 (seconds)
+Time elapsed Task_2: 6 (seconds)
+Time elapsed Task_2: 7 (seconds)
+Time elapsed Task_2: 8 (seconds)
+Time elapsed Task_2: 9 (seconds)
+Time elapsed Task_2: 10 (seconds)
+Task_2 - exitting
*** END OF POSIX TEST 7 ***
diff --git a/testsuites/psxtests/psx07/system.h b/testsuites/psxtests/psx07/system.h
index ab3c97b9eb..af1b9f9e5e 100644
--- a/testsuites/psxtests/psx07/system.h
+++ b/testsuites/psxtests/psx07/system.h
@@ -25,6 +25,11 @@ void *Task_1(
void *argument
);
+void *Task_2(
+ void *argument
+);
+
+
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
@@ -45,7 +50,7 @@ void *Task_1(
#endif
TEST_EXTERN pthread_t Init_id;
-TEST_EXTERN pthread_t Task_id;
+TEST_EXTERN pthread_t Task_id, Task2_id;
#undef TEST_EXTERN
diff --git a/testsuites/psxtests/psx07/task.c b/testsuites/psxtests/psx07/task.c
index 417eb5bdfc..281436f500 100644
--- a/testsuites/psxtests/psx07/task.c
+++ b/testsuites/psxtests/psx07/task.c
@@ -31,3 +31,36 @@ void *Task_1(
return NULL; /* just so the compiler thinks we returned something */
}
+
+void *Task_2(
+ void *argument
+)
+{
+ int i = 0;
+ time_t now, start;
+
+ /*
+ * Change our priority so we are running at a logically higher
+ * priority than our "ss_high_priority". This should result in
+ * our replenishment period not touching our priority.
+ */
+
+ /*
+ * Consume time so the cpu budget callout will run.
+ *
+ * DO NOT BLOCK!!!
+ */
+ start = time(&start);
+ while( i <= 10 ) {
+ do {
+ now = time(&now);
+ } while (start == now);
+ start = time(&start);
+
+ printf( "Time elapsed Task_2: %2d (seconds)\n", i++ );
+ }
+
+ puts( "Task_2 - exitting" );
+ pthread_exit( NULL );
+ return NULL;
+}