<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-07-29)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-29 Bharath Suri <bharath.s.jois@gmail.com>

        PR 1620/cpukit
        * libcsupport/src/privateenv.c: Significant clean up and rework to
        improve testability.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2535&r2=text&tr2=1.2536&diff_format=h">M</a></td><td width='1%'>1.2536</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/privateenv.c.diff?r1=text&tr1=1.14&r2=text&tr2=1.15&diff_format=h">M</a></td><td width='1%'>1.15</td><td width='100%'>cpukit/libcsupport/src/privateenv.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2535 rtems/cpukit/ChangeLog:1.2536
--- rtems/cpukit/ChangeLog:1.2535       Thu Jul 29 12:52:09 2010
+++ rtems/cpukit/ChangeLog      Thu Jul 29 17:27:12 2010
</font><font color='#997700'>@@ -1,3 +1,9 @@
</font><font color='#000088'>+2010-07-29    Bharath Suri <bharath.s.jois@gmail.com>
+
+       PR 1620/cpukit
+       * libcsupport/src/privateenv.c: Significant clean up and rework to
+       improve testability.
+
</font> 2010-07-29        Gedare Bloom <giddyup44@yahoo.com>
 
        PR 1635/cpukit

<font color='#006600'>diff -u rtems/cpukit/libcsupport/src/privateenv.c:1.14 rtems/cpukit/libcsupport/src/privateenv.c:1.15
--- rtems/cpukit/libcsupport/src/privateenv.c:1.14      Mon Jul 26 17:03:17 2010
+++ rtems/cpukit/libcsupport/src/privateenv.c   Thu Jul 29 17:27:12 2010
</font><font color='#997700'>@@ -46,15 +46,27 @@
</font> 
 rtems_status_code rtems_libio_set_private_env(void)
 {
<font color='#880000'>-  rtems_status_code      sc;
-  rtems_id               task_id;
</font><font color='#000088'>+  rtems_status_code                 sc;
+  rtems_id                          task_id;
</font>   rtems_filesystem_location_info_t  loc;
 
<font color='#880000'>-  sc=rtems_task_ident(RTEMS_SELF,0,&task_id);
-  if (sc != RTEMS_SUCCESSFUL) return sc;
</font><font color='#000088'>+  task_id = rtems_task_self();
</font> 
<font color='#880000'>-  /* Only for the first time a malloc is necesary */
-  if (rtems_current_user_env==&rtems_global_user_env) {
</font><font color='#000088'>+  /*<span style="background-color: #FF0000"> </span>
+   * Malloc is necessary whenever the current task does not
+   * have its own environment in place. This could be:
+   * a) it never had one
+   * OR
+   * b) it shared another task's environment
+   */
+
+  /*<span style="background-color: #FF0000"> </span>
+   * Bharath: I'm not sure if the check can be reduced to
+   * if( rtems_current_user_env->task_id != task_id ) {
+   */
+
+  if (rtems_current_user_env==&rtems_global_user_env ||<span style="background-color: #FF0000"> </span>
+      rtems_current_user_env->task_id != task_id ) {
</font>    rtems_user_env_t *tmp = malloc(sizeof(rtems_user_env_t));
    if (!tmp)
      return RTEMS_NO_MEMORY;
<font color='#997700'>@@ -115,34 +127,53 @@
</font>  *     while changing any of those (chdir(), chroot()).
  */
 
<font color='#880000'>-#ifndef HAVE_USERENV_REFCNT
</font> rtems_status_code rtems_libio_share_private_env(rtems_id task_id)
 {
   rtems_status_code  sc;
   rtems_user_env_t * shared_user_env;
   rtems_id           current_task_id;
 
<font color='#000088'>+  /*<span style="background-color: #FF0000"> </span>
+   * get current task id<span style="background-color: #FF0000"> </span>
+   */
</font>   current_task_id = rtems_task_self();
 
<font color='#880000'>-  if (rtems_current_user_env->task_id==current_task_id) {
-   /* kill the current user env & task_var*/
-   rtems_user_env_t  *tmp = rtems_current_user_env;
-   sc = rtems_task_variable_delete(RTEMS_SELF,(void*)&rtems_current_user_env);
-   if (sc != RTEMS_SUCCESSFUL) return sc;
-   free_user_env(tmp);
-  } else {
-    sc = rtems_task_variable_get(
-      task_id,(void*)&rtems_current_user_env, (void*)&shared_user_env );
</font><font color='#000088'>+  /*
+   * If this was an attempt to share the task with self,
+   * if somebody wanted to do it... Lets tell them, its shared
+   */
+
+  if( task_id == current_task_id )
+    return RTEMS_SUCCESSFUL;
+  /*<span style="background-color: #FF0000"> </span>
+   * Try to get the requested user environment<span style="background-color: #FF0000"> </span>
+   */
+  sc = rtems_task_variable_get(
+        task_id,
+        (void*)&rtems_current_user_env,<span style="background-color: #FF0000"> </span>
+        (void*)&shared_user_env );
+
+  /*<span style="background-color: #FF0000"> </span>
+   * If it was not successful, return the error code<span style="background-color: #FF0000"> </span>
+   */
</font>     if (sc != RTEMS_SUCCESSFUL)
<font color='#880000'>-      goto bailout;
-  }
</font><font color='#000088'>+      return sc;
</font> 
<font color='#880000'>-  /* AT THIS POINT, rtems_current_user_env is DANGLING */
</font><font color='#000088'>+    /*<span style="background-color: #FF0000"> </span>
+     * If we are here, we have the required environment to be
+     * shared with the current task
+    */
+
+    /*
+     * If we have a current environment in place, we need to<span style="background-color: #FF0000"> </span>
+     * free it, since we will be sharing the variable with the
+     * shared_user_env
+     */
</font> 
<font color='#880000'>-  sc = rtems_task_variable_add(
-    RTEMS_SELF,(void*)&rtems_current_user_env,free_user_env);
-  if (sc != RTEMS_SUCCESSFUL)
-    goto bailout;
</font><font color='#000088'>+  if (rtems_current_user_env->task_id==current_task_id) {
+    rtems_user_env_t  *tmp = rtems_current_user_env;
+    free_user_env( tmp );
+  }
</font> 
   /* the current_user_env is the same pointer that remote env */
   rtems_current_user_env = shared_user_env;
<font color='#997700'>@@ -153,10 +184,4 @@
</font> #endif
 
   return RTEMS_SUCCESSFUL;
<font color='#880000'>-
-bailout:
-  /* fallback to the global env */
-  rtems_current_user_env = &rtems_global_user_env;
-  return sc;
</font> }
<font color='#880000'>-#endif
</font></pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-29 Bharath Suri <bharath.s.jois@gmail.com>

        PR 1621/testing
        * Makefile.am, configure.ac: Improve coverage of private environment.
        * spprivenv01/.cvsignore, spprivenv01/Makefile.am, spprivenv01/init.c,
        spprivenv01/spprivenv01.doc, spprivenv01/spprivenv01.scn: New files.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/ChangeLog.diff?r1=text&tr1=1.408&r2=text&tr2=1.409&diff_format=h">M</a></td><td width='1%'>1.409</td><td width='100%'>testsuites/sptests/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/Makefile.am.diff?r1=text&tr1=1.102&r2=text&tr2=1.103&diff_format=h">M</a></td><td width='1%'>1.103</td><td width='100%'>testsuites/sptests/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/configure.ac.diff?r1=text&tr1=1.107&r2=text&tr2=1.108&diff_format=h">M</a></td><td width='1%'>1.108</td><td width='100%'>testsuites/sptests/configure.ac</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spprivenv01/.cvsignore?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spprivenv01/.cvsignore</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spprivenv01/Makefile.am?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spprivenv01/Makefile.am</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spprivenv01/init.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spprivenv01/init.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spprivenv01/spprivenv01.doc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spprivenv01/spprivenv01.doc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spprivenv01/spprivenv01.scn?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/sptests/spprivenv01/spprivenv01.scn</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/sptests/ChangeLog:1.408 rtems/testsuites/sptests/ChangeLog:1.409
--- rtems/testsuites/sptests/ChangeLog:1.408    Tue Jul 27 16:25:02 2010
+++ rtems/testsuites/sptests/ChangeLog  Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -1,3 +1,10 @@
</font><font color='#000088'>+2010-07-29    Bharath Suri <bharath.s.jois@gmail.com>
+
+       PR 1621/testing
+       * Makefile.am, configure.ac: Improve coverage of private environment.
+       * spprivenv01/.cvsignore, spprivenv01/Makefile.am, spprivenv01/init.c,
+       spprivenv01/spprivenv01.doc, spprivenv01/spprivenv01.scn: New files.
+
</font> 2010-07-27        Joel Sherrill <joel.sherrilL@OARcorp.com>
 
        * sp43/init.c, sp43/sp43.scn: Add code to exercise case where an API

<font color='#006600'>diff -u rtems/testsuites/sptests/Makefile.am:1.102 rtems/testsuites/sptests/Makefile.am:1.103
--- rtems/testsuites/sptests/Makefile.am:1.102  Mon Jul 26 10:38:40 2010
+++ rtems/testsuites/sptests/Makefile.am        Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -16,7 +16,7 @@
</font>     sp60 sp61 sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
     sp70 sp71 sp72 \
     spassoc01 spchain spclockget spcoverage spobjgetnext \
<font color='#880000'>-    spnotepad01 spprintk spsize spstkalloc spthreadq01 \
</font><font color='#000088'>+    spnotepad01 spprintk spprivenv01 spsize spstkalloc spthreadq01 \
</font>     spwatchdog spwkspace \
     sperror01 sperror02 sperror03 \
     spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \

<font color='#006600'>diff -u rtems/testsuites/sptests/configure.ac:1.107 rtems/testsuites/sptests/configure.ac:1.108
--- rtems/testsuites/sptests/configure.ac:1.107 Mon Jul 26 10:38:40 2010
+++ rtems/testsuites/sptests/configure.ac       Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -154,6 +154,7 @@
</font> spnotepad01/Makefile
 spobjgetnext/Makefile
 spprintk/Makefile
<font color='#000088'>+spprivenv01/Makefile
</font> spsize/Makefile
 spstkalloc/Makefile
 spthreadq01/Makefile

<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spprivenv01/.cvsignore:1.1
--- /dev/null   Thu Jul 29 18:10:19 2010
+++ rtems/testsuites/sptests/spprivenv01/.cvsignore     Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -0,0 +1,2 @@
</font><font color='#000088'>+Makefile
+Makefile.in
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spprivenv01/Makefile.am:1.1
--- /dev/null   Thu Jul 29 18:10:19 2010
+++ rtems/testsuites/sptests/spprivenv01/Makefile.am    Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -0,0 +1,24 @@
</font><font color='#000088'>+##
+## $Id$
+##
+
+rtems_tests_PROGRAMS = spprivenv01
+spprivenv01_SOURCES = init.c
+
+dist_rtems_tests_DATA = spprivenv01.scn
+dist_rtems_tests_DATA += spprivenv01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spprivenv01_OBJECTS) $(spprivenv01_LDADD)
+LINK_LIBS = $(spprivenv01_LDLIBS)
+
+spprivenv01$(EXEEXT): $(spprivenv01_OBJECTS) $(spprivenv01_DEPENDENCIES)
+       @rm -f spprivenv01$(EXEEXT)
+       $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spprivenv01/init.c:1.1
--- /dev/null   Thu Jul 29 18:10:19 2010
+++ rtems/testsuites/sptests/spprivenv01/init.c Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -0,0 +1,132 @@
</font><font color='#000088'>+/*
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+#include <rtems/score/heap.h>
+#include <rtems/libio_.h>
+
+extern Heap_Control  *RTEMS_Malloc_Heap;
+
+rtems_task task_routine( rtems_task_argument not_used )
+{
+  int sc = 0;
+
+  puts( "task_routine - setting up a private environment" );
+
+  sc = rtems_libio_set_private_env();
+  sleep( 1 );
+
+  rtems_task_delete( RTEMS_SELF );
+}
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int sc = 0;
+  bool status = 0;
+  void *alloc_ptr = (void *)0;
+  Heap_Information_block Info;
+  rtems_id current_task_id;
+  rtems_id task_id;
+  rtems_name another_task_name;
+
+  puts( "\n\n*** TEST USER ENVIRONMENT ROUTINE - 01 ***" );
+
+  puts( "Init - allocating most of heap -- OK" );
+  _Heap_Get_information(RTEMS_Malloc_Heap, &Info);
+  alloc_ptr = malloc( Info.Free.largest - 4 );
+  rtems_test_assert( alloc_ptr != NULL );
+
+  puts( "Init - attempt to reset env - expect RTEMS_NO_MEMORY" );
+  sc = rtems_libio_set_private_env();
+  rtems_test_assert( sc == RTEMS_NO_MEMORY );
+
+  puts( "Init - freeing the allocated memory" );
+  free( alloc_ptr );
+
+  puts( "Init - allocating most of workspace memory" );
+  status = rtems_workspace_get_information( &Info );
+  rtems_test_assert( status == true );
+  status = rtems_workspace_allocate( Info.Free.largest - 4, &alloc_ptr );
+  rtems_test_assert( status == true );
+<span style="background-color: #FF0000">  </span>
+  puts( "Init - attempt to reset env - expect RTEMS_NO_MEMORY" );
+  sc = rtems_libio_set_private_env();
+  rtems_test_assert( sc == RTEMS_NO_MEMORY );
+
+  puts( "Init - freeing the workspace memory" );
+  status = rtems_workspace_free( alloc_ptr );
+  rtems_test_assert( status == true );
+
+  puts( "Init - creating a task name and a task -- OK" );
+
+  another_task_name =<span style="background-color: #FF0000"> </span>
+    rtems_build_name( 'T','S','K','D' );
+
+  sc = rtems_task_create( another_task_name,
+                         1,
+                         RTEMS_MINIMUM_STACK_SIZE * 2,
+                         RTEMS_INTERRUPT_LEVEL(31),
+                         RTEMS_DEFAULT_ATTRIBUTES,
+                         &task_id
+                         );
+
+  puts( "Init - starting the task_routine, to set its private environment" );
+  status = rtems_task_start( task_id, task_routine, 0);
+  rtems_test_assert(status == 0);
+
+  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_INVALID_ADDRESS );
+
+  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 - 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 );
+<span style="background-color: #FF0000">  </span>
+  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( "*** END OF TEST USER ENVIRONMENT ROUTINE - 01 ***" );
+
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS             3
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spprivenv01/spprivenv01.doc:1.1
--- /dev/null   Thu Jul 29 18:10:19 2010
+++ rtems/testsuites/sptests/spprivenv01/spprivenv01.doc        Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -0,0 +1,25 @@
</font><font color='#000088'>+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2010.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+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
+
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/sptests/spprivenv01/spprivenv01.scn:1.1
--- /dev/null   Thu Jul 29 18:10:19 2010
+++ rtems/testsuites/sptests/spprivenv01/spprivenv01.scn        Thu Jul 29 17:28:51 2010
</font><font color='#997700'>@@ -0,0 +1,17 @@
</font><font color='#000088'>+*** TEST USER ENVIRONMENT ROUTINE - 01 ***
+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 - freeing the workspace memory
+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 ***
</font></pre>
<p> </p>
<a name='cs3'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-29 Bharath Suri <bharath.s.jois@gmail.com>

        PR 1633/testing
        * psximfs01/init.c, psximfs01/psximfs01.scn,
        psximfs01/psximfs01.doc: New cases to exercise
        IMFS_memfile_remove.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/ChangeLog.diff?r1=text&tr1=1.299&r2=text&tr2=1.300&diff_format=h">M</a></td><td width='1%'>1.300</td><td width='100%'>testsuites/psxtests/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs01/init.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>testsuites/psxtests/psximfs01/init.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs01/psximfs01.doc.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>testsuites/psxtests/psximfs01/psximfs01.doc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs01/psximfs01.scn.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>testsuites/psxtests/psximfs01/psximfs01.scn</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/psxtests/ChangeLog:1.299 rtems/testsuites/psxtests/ChangeLog:1.300
--- rtems/testsuites/psxtests/ChangeLog:1.299   Tue Jul 27 15:16:23 2010
+++ rtems/testsuites/psxtests/ChangeLog Thu Jul 29 17:35:35 2010
</font><font color='#997700'>@@ -1,3 +1,10 @@
</font><font color='#000088'>+2010-07-29    Bharath Suri <bharath.s.jois@gmail.com>
+
+       PR 1633/testing
+       * psximfs01/init.c, psximfs01/psximfs01.scn,
+       psximfs01/psximfs01.doc: New cases to exercise
+       IMFS_memfile_remove.
+
</font> 2010-07-27        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * psxobj01/Makefile.am, psxobj01/init.c, psxobj01/psxobj01.scn: Add

<font color='#006600'>diff -u rtems/testsuites/psxtests/psximfs01/init.c:1.3 rtems/testsuites/psxtests/psximfs01/init.c:1.4
--- rtems/testsuites/psxtests/psximfs01/init.c:1.3      Wed Jun 30 09:41:56 2010
+++ rtems/testsuites/psxtests/psximfs01/init.c  Thu Jul 29 17:35:36 2010
</font><font color='#997700'>@@ -138,6 +138,57 @@
</font>   } while (new > 0);
 }
 
<font color='#000088'>+void extend_helper(void)
+{
+  off_t position;
+  off_t new;
+  off_t sc;
+  int   rc;
+
+  position = lseek( TestFd, 0, SEEK_END );
+  printf( "Seek to end .. returned %d\n", (int) position );
+  rtems_test_assert( position == 1 );
+
+  /*<span style="background-color: #FF0000"> </span>
+   * test case to ftruncate a file to a length > its size<span style="background-color: #FF0000"> </span>
+   */
+
+  rc = ftruncate( TestFd, 2 );
+  rtems_test_assert( rc == 0 );
+
+  puts( "lseek/ftruncate loop.." );
+  new = position;
+  do {
+    sc = lseek( TestFd, new, SEEK_SET );
+    if( sc == -1 ) {
+      if( errno == ENOSPC ) {
+       break;
+      }
+      else {
+       rtems_test_assert( 0 );
+      }
+    }
+
+    rc = ftruncate( TestFd, new );
+    if ( rc != 0 ) {
+      if( errno != ENOSPC ) {
+       fprintf(
+         stderr,
+         "ERROR - at offset %d - returned %d and error=%s\n",
+         (int) new,
+         rc,
+         strerror( errno )
+        );
+      }
+      else {
+       break;
+      }
+    }
+    rtems_test_assert( rc == 0 );
+    ++new;
+  } while ( 1 );
+}
+
</font> void close_it(void)
 {
   int rc;
<font color='#997700'>@@ -147,11 +198,25 @@
</font>   rtems_test_assert( rc == 0 );
 }
 
<font color='#000088'>+void unlink_it(void)
+{
+  int rc;
+
+  puts( "unlink(" FILE_NAME ") - OK" );
+  rc = unlink( FILE_NAME );
+  rtems_test_assert( rc == 0 );
+}
+
+extern Heap_Control  *RTEMS_Malloc_Heap;
+
</font> rtems_task Init(
   rtems_task_argument argument
 )
 {
   int i;
<font color='#000088'>+  void *alloc_ptr = (void *)0;
+  Heap_Information_block Info;
+
</font>   puts( "\n\n*** TEST IMFS 01 ***" );
 
   for (i=0 ; i<sizeof(Buffer) ; i++ )
<font color='#997700'>@@ -169,8 +234,22 @@
</font>   
   open_it(false, false);
   truncate_helper();
<font color='#000088'>+
+  /*
+   * Allocate the heap, so that extend cannot be successful
+   */
+  _Heap_Get_information( RTEMS_Malloc_Heap, &Info );
+  alloc_ptr = malloc( Info.Free.largest-4 );
+
+  extend_helper();
+
+  /*<span style="background-color: #FF0000"> </span>
+   * free the allocated heap memory
+   */
+  free(alloc_ptr);
+
</font>   close_it();
<font color='#880000'>-<span style="background-color: #FF0000">  </span>
</font><font color='#000088'>+  unlink_it();
</font> 
   puts( "*** END OF TEST IMFS 01 ***" );
 

<font color='#006600'>diff -u rtems/testsuites/psxtests/psximfs01/psximfs01.doc:1.1 rtems/testsuites/psxtests/psximfs01/psximfs01.doc:1.2
--- rtems/testsuites/psxtests/psximfs01/psximfs01.doc:1.1       Mon Jun 28 13:48:25 2010
+++ rtems/testsuites/psxtests/psximfs01/psximfs01.doc   Thu Jul 29 17:35:36 2010
</font><font color='#997700'>@@ -21,6 +21,7 @@
</font>   + write
   + lseek
   + ftruncate
<font color='#000088'>+  + unlink
</font> 
 concepts:
 
<font color='#997700'>@@ -33,3 +34,5 @@
</font> 
 + This should exercise much of the singly, doubly and triply indirect
 block management code in the IMFS.
<font color='#000088'>+
++ Exercise unlink, and hence IMFS_memfile_remove
</font>
<font color='#006600'>diff -u rtems/testsuites/psxtests/psximfs01/psximfs01.scn:1.1 rtems/testsuites/psxtests/psximfs01/psximfs01.scn:1.2
--- rtems/testsuites/psxtests/psximfs01/psximfs01.scn:1.1       Mon Jun 28 13:48:25 2010
+++ rtems/testsuites/psxtests/psximfs01/psximfs01.scn   Thu Jul 29 17:35:36 2010
</font><font color='#997700'>@@ -12,5 +12,8 @@
</font> open(biggie) - OK<span style="background-color: #FF0000"> </span>
 Seek to end .. returned 1280
 lseek/ftruncate loop..
<font color='#000088'>+Seek to end .. returned 1
+lseek/ftruncate loop..
</font> close(biggie) - OK<span style="background-color: #FF0000"> </span>
<font color='#000088'>+unlink(biggie) - OK
</font> *** END OF TEST IMFS 01 ***
</pre>
<p> </p>
<a name='cs4'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-29 Bharath Suri <bharath.s.jois@gmail.com>

        PR 1642/testing
        * psximfs02/init.c, psximfs02/psximfs02.scn,
        psximfs02/psximfs02.doc, psximfs02/Makefile.am: New test added.
        * configure.ac, Makefile.am: Changes to accommodate psximfs02
        test.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/ChangeLog.diff?r1=text&tr1=1.300&r2=text&tr2=1.301&diff_format=h">M</a></td><td width='1%'>1.301</td><td width='100%'>testsuites/psxtests/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/Makefile.am.diff?r1=text&tr1=1.67&r2=text&tr2=1.68&diff_format=h">M</a></td><td width='1%'>1.68</td><td width='100%'>testsuites/psxtests/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/configure.ac.diff?r1=text&tr1=1.71&r2=text&tr2=1.72&diff_format=h">M</a></td><td width='1%'>1.72</td><td width='100%'>testsuites/psxtests/configure.ac</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs02/.cvsignore?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/psxtests/psximfs02/.cvsignore</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs02/Makefile.am?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/psxtests/psximfs02/Makefile.am</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs02/init.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/psxtests/psximfs02/init.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs02/psximfs02.doc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/psxtests/psximfs02/psximfs02.doc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/psxtests/psximfs02/psximfs02.scn?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">testsuites/psxtests/psximfs02/psximfs02.scn</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/psxtests/ChangeLog:1.300 rtems/testsuites/psxtests/ChangeLog:1.301
--- rtems/testsuites/psxtests/ChangeLog:1.300   Thu Jul 29 17:35:35 2010
+++ rtems/testsuites/psxtests/ChangeLog Thu Jul 29 17:40:49 2010
</font><font color='#997700'>@@ -1,5 +1,13 @@
</font> 2010-07-29        Bharath Suri <bharath.s.jois@gmail.com>
 
<font color='#000088'>+   PR 1642/testing
+       * psximfs02/init.c, psximfs02/psximfs02.scn,
+       psximfs02/psximfs02.doc, psximfs02/Makefile.am: New test added.
+       * configure.ac, Makefile.am: Changes to accommodate psximfs02
+       test.
+
+2010-07-29     Bharath Suri <bharath.s.jois@gmail.com>
+
</font>   PR 1633/testing
        * psximfs01/init.c, psximfs01/psximfs01.scn,
        psximfs01/psximfs01.doc: New cases to exercise

<font color='#006600'>diff -u rtems/testsuites/psxtests/Makefile.am:1.67 rtems/testsuites/psxtests/Makefile.am:1.68
--- rtems/testsuites/psxtests/Makefile.am:1.67  Tue Jul 13 16:13:12 2010
+++ rtems/testsuites/psxtests/Makefile.am       Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -20,8 +20,8 @@
</font> 
 ## File IO tests
 SUBDIRS += psxfile01 psxfile02 psxfilelock01 psxgetrusage01 psxid01 \
<font color='#880000'>-    psximfs01 psxreaddir psxstat psxmount psx13 psxchroot01 psxpasswd01 \
-    psxpasswd02 psxpipe01 psxtimes01 psxfchx01
</font><font color='#000088'>+    psximfs01 psximfs02 psxreaddir psxstat psxmount psx13 psxchroot01 \
+    psxpasswd01 psxpasswd02 psxpipe01 psxtimes01 psxfchx01
</font> 
 ## Until sys/uio.h is moved to libcsupport, we have to have networking
 ## enabled to support readv and writev.  Hopefully this is a temporary

<font color='#006600'>diff -u rtems/testsuites/psxtests/configure.ac:1.71 rtems/testsuites/psxtests/configure.ac:1.72
--- rtems/testsuites/psxtests/configure.ac:1.71 Tue Jul 13 16:13:12 2010
+++ rtems/testsuites/psxtests/configure.ac      Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -94,6 +94,7 @@
</font> psxhdrs/Makefile
 psxid01/Makefile
 psximfs01/Makefile
<font color='#000088'>+psximfs02/Makefile
</font> psxintrcritical01/Makefile
 psxitimer/Makefile
 psxkey01/Makefile

<font color='#006600'>diff -u /dev/null rtems/testsuites/psxtests/psximfs02/.cvsignore:1.1
--- /dev/null   Thu Jul 29 18:10:20 2010
+++ rtems/testsuites/psxtests/psximfs02/.cvsignore      Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -0,0 +1,2 @@
</font><font color='#000088'>+Makefile
+Makefile.in
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/psxtests/psximfs02/Makefile.am:1.1
--- /dev/null   Thu Jul 29 18:10:20 2010
+++ rtems/testsuites/psxtests/psximfs02/Makefile.am     Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -0,0 +1,24 @@
</font><font color='#000088'>+##
+## $Id$
+##
+
+rtems_tests_PROGRAMS = psximfs02
+psximfs02_SOURCES = init.c
+
+dist_rtems_tests_DATA = psximfs02.scn
+dist_rtems_tests_DATA += psximfs02.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psximfs02_OBJECTS) $(psximfs02_LDADD)
+LINK_LIBS = $(psximfs02_LDLIBS)
+
+psximfs02$(EXEEXT): $(psximfs02_OBJECTS) $(psximfs02_DEPENDENCIES)
+       @rm -f psximfs02$(EXEEXT)
+       $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/psxtests/psximfs02/init.c:1.1
--- /dev/null   Thu Jul 29 18:10:20 2010
+++ rtems/testsuites/psxtests/psximfs02/init.c  Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -0,0 +1,153 @@
</font><font color='#000088'>+/*
+ *  COPYRIGHT (c) 1989-2010.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id$
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <rtems/libio.h>
+
+extern Heap_Control  *RTEMS_Malloc_Heap;
+
+rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  int status = 0;
+  void *alloc_ptr = (void *)0;
+  Heap_Information_block Info;
+  char linkname_n[20] = {0};
+  char linkname_p[20] = {0};
+  int i;
+  struct stat stat_buf;
+
+  puts( "\n\n*** TEST IMFS 02 ***" );
+
+  puts( "Creating directory /dir00" );
+  status = mkdir( "/dir00", S_IRWXU );
+  rtems_test_assert( status == 0 );
+
+  puts( "Creating directory /dir00/dir01" );
+  status = mkdir( "/dir00/dir01", S_IRWXU );
+  rtems_test_assert( status == 0 );
+
+  puts( "Changing directory to /dir00" );
+  status = chdir( "/dir00" );
+  rtems_test_assert( status == 0 );
+
+  puts( "Creating link dir01-link0 for dir01" );
+  status = link( "dir01", "dir01-link0" );
+  rtems_test_assert( status == 0 );
+
+  for( i = 1 ; ; ++i ) {
+    sprintf( linkname_p, "dir01-link%d", i-1 );
+    sprintf( linkname_n, "dir01-link%d", i );
+    printf( "\nCreating link %s for %s\n", linkname_n, linkname_p );
+    status = link( linkname_p, linkname_n );
+    if( status != 0 ) {
+      puts("Link creation failed" );
+      break;
+    }
+  }
+
+  puts( "Creating a regular node /node, RDONLY" );
+  status = mknod( "/node", S_IFREG | S_IRUSR, 0LL );
+  rtems_test_assert( status == 0 );
+
+  puts( "Creating link /node-link for /node" );
+  status = link( "/node" , "/node-link" );
+  rtems_test_assert( status == 0 );
+
+  puts( "Opening /node-link in WRONLY mode -- expect EACCES" );
+  status = open( "/node-link", O_WRONLY );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == EACCES );
+
+  puts( "Creating a symlink /node-slink for /node" );
+  status = symlink( "/node" , "/node-slink" );
+  rtems_test_assert( status == 0 );
+
+  puts( "Opening /node-slink in WRONLY mode -- expect EACCES" );<span style="background-color: #FF0000">  </span>
+  status = open( "/node-slink", O_WRONLY );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == EACCES );
+
+  puts( "Allocate most of heap" );
+  _Heap_Get_information( RTEMS_Malloc_Heap, &Info );
+  alloc_ptr = malloc( Info.Free.largest - 150 );
+
+  puts( "Attempt to mount a fs at /dir01 -- expect ENOMEM" );
+  status = mount( NULL,
+                 "dir01",
+                 "imfs",
+                 RTEMS_FILESYSTEM_READ_WRITE,
+                 NULL );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == ENOMEM );
+
+  puts( "Freeing allocated memory" );
+  free( alloc_ptr );
+
+  puts( "Allocate most of heap" );
+  _Heap_Get_information( RTEMS_Malloc_Heap, &Info );
+  alloc_ptr = malloc( Info.Free.largest - 4 );
+
+  puts( "Changing directory to /" );
+  status = chdir( "/" );
+  rtems_test_assert( status == 0 );
+
+  puts( "Attempt to create /node-link-2 for /node -- expect ENOMEM" );
+  status = link( "/node", "/node-link-2" );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == ENOMEM );
+
+  puts( "Attempt to create /node-slink-2 for /node -- expect ENOMEM" );
+  status = symlink( "/node", "node-slink-2" );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == ENOMEM );
+
+  puts( "Freeing allocated memory" );
+  free( alloc_ptr );
+
+  puts( "Allocate most of heap" );
+  alloc_ptr = malloc( Info.Free.largest - 40 );
+
+  puts( "Attempt to create /node-slink-2 for /node -- expect ENOMEM" );
+  status = symlink( "/node", "node-slink-2" );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == ENOMEM );
+
+  puts( "Attempt to stat a hardlink -- expect ENOTSUP" );
+  status = lstat( "/node-link", &stat_buf );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == ENOTSUP );
+
+  puts( "*** END OF TEST IMFS 02 ***" );
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS                  1
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/psxtests/psximfs02/psximfs02.doc:1.1
--- /dev/null   Thu Jul 29 18:10:20 2010
+++ rtems/testsuites/psxtests/psximfs02/psximfs02.doc   Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -0,0 +1,28 @@
</font><font color='#000088'>+#
+#  $Id$
+#
+#  COPYRIGHT (c) 1989-2010.
+#  On-Line Applications Research Corporation (OAR).
+#
+#  The license and distribution terms for this file may be
+#  found in the file LICENSE in this distribution or at
+#  http://www.rtems.com/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name:  psximfs02
+
+directives:
+
+  + mkdir
+  + link
+  + mknod
+  + open
+  + symlink
+  + mount
+  + lstat
+
+concepts:
+
++ A above calls exercise the IMFS routines, mostly error paths.
</font>
<font color='#006600'>diff -u /dev/null rtems/testsuites/psxtests/psximfs02/psximfs02.scn:1.1
--- /dev/null   Thu Jul 29 18:10:20 2010
+++ rtems/testsuites/psxtests/psximfs02/psximfs02.scn   Thu Jul 29 17:40:50 2010
</font><font color='#997700'>@@ -0,0 +1,37 @@
</font><font color='#000088'>+*** TEST IMFS 02 ***
+Creating directory /dir00
+Creating directory /dir00/dir01
+Changing directory to /dir00
+Creating link dir01-link0 for dir01
+
+Creating link dir01-link1 for dir01-link0
+
+Creating link dir01-link2 for dir01-link1
+
+Creating link dir01-link3 for dir01-link2
+
+Creating link dir01-link4 for dir01-link3
+
+Creating link dir01-link5 for dir01-link4
+
+Creating link dir01-link6 for dir01-link5
+
+Creating link dir01-link7 for dir01-link6
+Link creation failed
+Creating a regular node /node, RDONLY
+Creating link /node-link for /node
+Opening /node-link in WRONLY mode -- expect EACCES
+Creating a symlink /node-slink for /node
+Opening /node-slink in WRONLY mode -- expect EACCES
+Allocate most of heap
+Attempt to mount a fs at /dir01 -- expect ENOMEM
+Freeing allocated memory
+Allocate most of heap
+Changing directory to /
+Attempt to create /node-link-2 for /node -- expect ENOMEM
+Attempt to create /node-slink-2 for /node -- expect ENOMEM
+Freeing allocated memory
+Allocate most of heap
+Attempt to create /node-slink-2 for /node -- expect ENOMEM
+Attempt to stat a hardlink -- expect ENOTSUP
+*** END OF TEST IMFS 02 ***
</font></pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>