change log for rtems (2010-07-29)
rtems-vc at rtems.org
rtems-vc at rtems.org
Thu Jul 29 23:10:20 UTC 2010
*joel*:
2010-07-29 Bharath Suri <bharath.s.jois at gmail.com>
PR 1620/cpukit
* libcsupport/src/privateenv.c: Significant clean up and rework to
improve testability.
M 1.2536 cpukit/ChangeLog
M 1.15 cpukit/libcsupport/src/privateenv.c
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
@@ -1,3 +1,9 @@
+2010-07-29 Bharath Suri <bharath.s.jois at gmail.com>
+
+ PR 1620/cpukit
+ * libcsupport/src/privateenv.c: Significant clean up and rework to
+ improve testability.
+
2010-07-29 Gedare Bloom <giddyup44 at yahoo.com>
PR 1635/cpukit
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
@@ -46,15 +46,27 @@
rtems_status_code rtems_libio_set_private_env(void)
{
- rtems_status_code sc;
- rtems_id task_id;
+ rtems_status_code sc;
+ rtems_id task_id;
rtems_filesystem_location_info_t loc;
- sc=rtems_task_ident(RTEMS_SELF,0,&task_id);
- if (sc != RTEMS_SUCCESSFUL) return sc;
+ task_id = rtems_task_self();
- /* Only for the first time a malloc is necesary */
- if (rtems_current_user_env==&rtems_global_user_env) {
+ /*
+ * 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
+ */
+
+ /*
+ * 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 ||
+ rtems_current_user_env->task_id != task_id ) {
rtems_user_env_t *tmp = malloc(sizeof(rtems_user_env_t));
if (!tmp)
return RTEMS_NO_MEMORY;
@@ -115,34 +127,53 @@
* while changing any of those (chdir(), chroot()).
*/
-#ifndef HAVE_USERENV_REFCNT
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;
+ /*
+ * get current task id
+ */
current_task_id = rtems_task_self();
- 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 );
+ /*
+ * 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;
+ /*
+ * Try to get the requested user environment
+ */
+ sc = rtems_task_variable_get(
+ task_id,
+ (void*)&rtems_current_user_env,
+ (void*)&shared_user_env );
+
+ /*
+ * If it was not successful, return the error code
+ */
if (sc != RTEMS_SUCCESSFUL)
- goto bailout;
- }
+ return sc;
- /* AT THIS POINT, rtems_current_user_env is DANGLING */
+ /*
+ * 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
+ * free it, since we will be sharing the variable with the
+ * shared_user_env
+ */
- sc = rtems_task_variable_add(
- RTEMS_SELF,(void*)&rtems_current_user_env,free_user_env);
- if (sc != RTEMS_SUCCESSFUL)
- goto bailout;
+ if (rtems_current_user_env->task_id==current_task_id) {
+ rtems_user_env_t *tmp = rtems_current_user_env;
+ free_user_env( tmp );
+ }
/* the current_user_env is the same pointer that remote env */
rtems_current_user_env = shared_user_env;
@@ -153,10 +184,4 @@
#endif
return RTEMS_SUCCESSFUL;
-
-bailout:
- /* fallback to the global env */
- rtems_current_user_env = &rtems_global_user_env;
- return sc;
}
-#endif
*joel*:
2010-07-29 Bharath Suri <bharath.s.jois at 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.
M 1.409 testsuites/sptests/ChangeLog
M 1.103 testsuites/sptests/Makefile.am
M 1.108 testsuites/sptests/configure.ac
A 1.1 testsuites/sptests/spprivenv01/.cvsignore
A 1.1 testsuites/sptests/spprivenv01/Makefile.am
A 1.1 testsuites/sptests/spprivenv01/init.c
A 1.1 testsuites/sptests/spprivenv01/spprivenv01.doc
A 1.1 testsuites/sptests/spprivenv01/spprivenv01.scn
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
@@ -1,3 +1,10 @@
+2010-07-29 Bharath Suri <bharath.s.jois at 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.
+
2010-07-27 Joel Sherrill <joel.sherrilL at OARcorp.com>
* sp43/init.c, sp43/sp43.scn: Add code to exercise case where an API
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
@@ -16,7 +16,7 @@
sp60 sp61 sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
sp70 sp71 sp72 \
spassoc01 spchain spclockget spcoverage spobjgetnext \
- spnotepad01 spprintk spsize spstkalloc spthreadq01 \
+ spnotepad01 spprintk spprivenv01 spsize spstkalloc spthreadq01 \
spwatchdog spwkspace \
sperror01 sperror02 sperror03 \
spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
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
@@ -154,6 +154,7 @@
spnotepad01/Makefile
spobjgetnext/Makefile
spprintk/Makefile
+spprivenv01/Makefile
spsize/Makefile
spstkalloc/Makefile
spthreadq01/Makefile
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
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
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
@@ -0,0 +1,24 @@
+##
+## $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 at .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
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
@@ -0,0 +1,132 @@
+/*
+ * 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 );
+
+ 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 =
+ 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 );
+
+ 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 */
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
@@ -0,0 +1,25 @@
+#
+# $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
+
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
@@ -0,0 +1,17 @@
+*** 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 ***
*joel*:
2010-07-29 Bharath Suri <bharath.s.jois at gmail.com>
PR 1633/testing
* psximfs01/init.c, psximfs01/psximfs01.scn,
psximfs01/psximfs01.doc: New cases to exercise
IMFS_memfile_remove.
M 1.300 testsuites/psxtests/ChangeLog
M 1.4 testsuites/psxtests/psximfs01/init.c
M 1.2 testsuites/psxtests/psximfs01/psximfs01.doc
M 1.2 testsuites/psxtests/psximfs01/psximfs01.scn
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
@@ -1,3 +1,10 @@
+2010-07-29 Bharath Suri <bharath.s.jois at gmail.com>
+
+ PR 1633/testing
+ * psximfs01/init.c, psximfs01/psximfs01.scn,
+ psximfs01/psximfs01.doc: New cases to exercise
+ IMFS_memfile_remove.
+
2010-07-27 Joel Sherrill <joel.sherrill at oarcorp.com>
* psxobj01/Makefile.am, psxobj01/init.c, psxobj01/psxobj01.scn: Add
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
@@ -138,6 +138,57 @@
} while (new > 0);
}
+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 );
+
+ /*
+ * test case to ftruncate a file to a length > its size
+ */
+
+ 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 );
+}
+
void close_it(void)
{
int rc;
@@ -147,11 +198,25 @@
rtems_test_assert( rc == 0 );
}
+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;
+
rtems_task Init(
rtems_task_argument argument
)
{
int i;
+ void *alloc_ptr = (void *)0;
+ Heap_Information_block Info;
+
puts( "\n\n*** TEST IMFS 01 ***" );
for (i=0 ; i<sizeof(Buffer) ; i++ )
@@ -169,8 +234,22 @@
open_it(false, false);
truncate_helper();
+
+ /*
+ * 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();
+
+ /*
+ * free the allocated heap memory
+ */
+ free(alloc_ptr);
+
close_it();
-
+ unlink_it();
puts( "*** END OF TEST IMFS 01 ***" );
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
@@ -21,6 +21,7 @@
+ write
+ lseek
+ ftruncate
+ + unlink
concepts:
@@ -33,3 +34,5 @@
+ This should exercise much of the singly, doubly and triply indirect
block management code in the IMFS.
+
++ Exercise unlink, and hence IMFS_memfile_remove
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
@@ -12,5 +12,8 @@
open(biggie) - OK
Seek to end .. returned 1280
lseek/ftruncate loop..
+Seek to end .. returned 1
+lseek/ftruncate loop..
close(biggie) - OK
+unlink(biggie) - OK
*** END OF TEST IMFS 01 ***
*joel*:
2010-07-29 Bharath Suri <bharath.s.jois at 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.
M 1.301 testsuites/psxtests/ChangeLog
M 1.68 testsuites/psxtests/Makefile.am
M 1.72 testsuites/psxtests/configure.ac
A 1.1 testsuites/psxtests/psximfs02/.cvsignore
A 1.1 testsuites/psxtests/psximfs02/Makefile.am
A 1.1 testsuites/psxtests/psximfs02/init.c
A 1.1 testsuites/psxtests/psximfs02/psximfs02.doc
A 1.1 testsuites/psxtests/psximfs02/psximfs02.scn
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
@@ -1,5 +1,13 @@
2010-07-29 Bharath Suri <bharath.s.jois at 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.
+
+2010-07-29 Bharath Suri <bharath.s.jois at gmail.com>
+
PR 1633/testing
* psximfs01/init.c, psximfs01/psximfs01.scn,
psximfs01/psximfs01.doc: New cases to exercise
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
@@ -20,8 +20,8 @@
## File IO tests
SUBDIRS += psxfile01 psxfile02 psxfilelock01 psxgetrusage01 psxid01 \
- psximfs01 psxreaddir psxstat psxmount psx13 psxchroot01 psxpasswd01 \
- psxpasswd02 psxpipe01 psxtimes01 psxfchx01
+ psximfs01 psximfs02 psxreaddir psxstat psxmount psx13 psxchroot01 \
+ psxpasswd01 psxpasswd02 psxpipe01 psxtimes01 psxfchx01
## Until sys/uio.h is moved to libcsupport, we have to have networking
## enabled to support readv and writev. Hopefully this is a temporary
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
@@ -94,6 +94,7 @@
psxhdrs/Makefile
psxid01/Makefile
psximfs01/Makefile
+psximfs02/Makefile
psxintrcritical01/Makefile
psxitimer/Makefile
psxkey01/Makefile
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
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
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
@@ -0,0 +1,24 @@
+##
+## $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 at .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
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
@@ -0,0 +1,153 @@
+/*
+ * 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" );
+ 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 */
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
@@ -0,0 +1,28 @@
+#
+# $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.
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
@@ -0,0 +1,37 @@
+*** 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 ***
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100729/eb09a4c6/attachment-0001.html>
More information about the vc
mailing list