diff options
author | Christian Mauderer <Christian.Mauderer@embedded-brains.de> | 2014-03-27 14:23:20 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-27 14:50:36 +0100 |
commit | 7d5c27e308632cce2052eb2aaf6a601aa0b5bc17 (patch) | |
tree | 26f46ffbd8fe4cb4523aec6b978d6532120393b9 /testsuites/sptests/spprivenv01 | |
parent | 89aa1ec87da68b8a6cff2233552a739173e676a4 (diff) |
privateenv: Remove sharing of user environment between threads.
Diffstat (limited to 'testsuites/sptests/spprivenv01')
-rw-r--r-- | testsuites/sptests/spprivenv01/init.c | 40 | ||||
-rw-r--r-- | testsuites/sptests/spprivenv01/spprivenv01.doc | 5 | ||||
-rw-r--r-- | testsuites/sptests/spprivenv01/spprivenv01.scn | 15 |
3 files changed, 23 insertions, 37 deletions
diff --git a/testsuites/sptests/spprivenv01/init.c b/testsuites/sptests/spprivenv01/init.c index f60bcef816..a670085f80 100644 --- a/testsuites/sptests/spprivenv01/init.c +++ b/testsuites/sptests/spprivenv01/init.c @@ -31,6 +31,9 @@ rtems_task task_routine(rtems_task_argument not_used) sc = rtems_libio_set_private_env(); directive_failed( sc, "set private env" ); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + rtems_test_assert( rtems_current_user_env != &rtems_global_user_env ); + sleep( 1 ); rtems_task_delete( RTEMS_SELF ); @@ -42,9 +45,9 @@ rtems_task Init( { rtems_status_code sc; void *opaque; - rtems_id current_task_id; rtems_id task_id; rtems_name another_task_name; + rtems_user_env_t *current_env; TEST_BEGIN(); @@ -68,6 +71,12 @@ rtems_task Init( puts( "Init - freeing the workspace memory" ); rtems_workspace_greedy_free( opaque ); + puts( "Init - Attempt to get a private environment" ); + sc = rtems_libio_set_private_env(); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + current_env = rtems_current_user_env; + rtems_test_assert( current_env != &rtems_global_user_env ); + puts( "Init - creating a task name and a task -- OK" ); another_task_name = @@ -85,33 +94,14 @@ rtems_task Init( sc = rtems_task_start( task_id, task_routine, 0); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - puts( "Init - attempt to share the env with another task -- Expect error" ); - sc = rtems_libio_share_private_env( task_id ); - rtems_test_assert( sc == RTEMS_UNSATISFIED ); - sleep( 1 ); - puts( "Init - attempt to share the env with another task -- OK" ); - sc = rtems_libio_share_private_env( task_id ); - rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert( rtems_current_user_env->task_id == task_id ); - - puts( "Init - Get current task id" ); - current_task_id = rtems_task_self(); + puts( "Init - Check current private environment. Should be same as before." ); + rtems_test_assert( rtems_current_user_env == current_env ); - puts( "Init - Attempt to reset current task's environment" ); - sc = rtems_libio_set_private_env(); - rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert( rtems_current_user_env->task_id == current_task_id ); - - puts( "Init - attempt to share the env with another task -- OK" ); - sc = rtems_libio_share_private_env( task_id ); - rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - rtems_test_assert( rtems_current_user_env->task_id == task_id ); - - puts( "Init - attempt to share with self -- OK" ); - sc = rtems_libio_share_private_env( task_id ); - rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + puts( "Init - Reset to global environment" ); + rtems_libio_use_global_env(); + rtems_test_assert( rtems_current_user_env == &rtems_global_user_env ); TEST_END(); diff --git a/testsuites/sptests/spprivenv01/spprivenv01.doc b/testsuites/sptests/spprivenv01/spprivenv01.doc index cb5c1bc45a..71ed4264ed 100644 --- a/testsuites/sptests/spprivenv01/spprivenv01.doc +++ b/testsuites/sptests/spprivenv01/spprivenv01.doc @@ -13,10 +13,9 @@ test set name: spprivenv01 directives: + rtems_libio_set_private_env - + rtems_libio_share_private_env concepts: -+ Exercise the routines at privateenv.c, which reset/share a task's -private environment ++ Exercise the routines at privateenv.c, which reset a task's private +environment diff --git a/testsuites/sptests/spprivenv01/spprivenv01.scn b/testsuites/sptests/spprivenv01/spprivenv01.scn index b95832ced2..1b71be185b 100644 --- a/testsuites/sptests/spprivenv01/spprivenv01.scn +++ b/testsuites/sptests/spprivenv01/spprivenv01.scn @@ -1,17 +1,14 @@ -*** TEST USER ENVIRONMENT ROUTINE - 01 *** +*** BEGIN OF TEST SPPRIVENV 1 *** Init - allocating most of heap -- OK Init - attempt to reset env - expect RTEMS_NO_MEMORY Init - freeing the allocated memory Init - allocating most of workspace memory -Init - attempt to reset env - expect RTEMS_NO_MEMORY +Init - attempt to reset env - expect RTEMS_TOO_MANY Init - freeing the workspace memory +Init - Attempt to get a private environment Init - creating a task name and a task -- OK Init - starting the task_routine, to set its private environment -Init - attempt to share the env with another task -- Expect error task_routine - setting up a private environment -Init - attempt to share the env with another task -- OK -Init - Get current task id -Init - Attempt to reset current task's environment -Init - attempt to share the env with another task -- OK -Init - attempt to share with self -- OK -*** END OF TEST USER ENVIRONMENT ROUTINE - 01 *** +Init - Check current private environment. Should be same as before. +Init - Reset to global environment +*** END OF TEST SPPRIVENV 1 *** |