change log for rtems (2010-07-16)

rtems-vc at rtems.org rtems-vc at rtems.org
Fri Jul 16 20:11:26 UTC 2010


 *joel*:
2010-07-17	Bharath Suri <bharath.s.jois at gmail.com>

	PR 1622/testing
	* psxchroot01/test.c, psxchroot01/psxchroot01.scn: Added two test
	cases to completely cover chroot().

M  1.296  testsuites/psxtests/ChangeLog
M    1.3  testsuites/psxtests/psxchroot01/psxchroot01.scn
M    1.9  testsuites/psxtests/psxchroot01/test.c

diff -u rtems/testsuites/psxtests/ChangeLog:1.295 rtems/testsuites/psxtests/ChangeLog:1.296
--- rtems/testsuites/psxtests/ChangeLog:1.295	Fri Jul 16 04:23:42 2010
+++ rtems/testsuites/psxtests/ChangeLog	Fri Jul 16 14:19:09 2010
@@ -1,3 +1,9 @@
+2010-07-17	Bharath Suri <bharath.s.jois at gmail.com>
+
+	PR 1622/testing
+	* psxchroot01/test.c, psxchroot01/psxchroot01.scn: Added two test
+	cases to completely cover chroot().
+
 2010-07-16	Sebastian Huber <Sebastian.Huber at embedded-brains.de>
 
 	* psxfile01/test.c: Avoid NULL pointer access.

diff -u rtems/testsuites/psxtests/psxchroot01/psxchroot01.scn:1.2 rtems/testsuites/psxtests/psxchroot01/psxchroot01.scn:1.3
--- rtems/testsuites/psxtests/psxchroot01/psxchroot01.scn:1.2	Thu Aug  9 17:02:20 2001
+++ rtems/testsuites/psxtests/psxchroot01/psxchroot01.scn	Fri Jul 16 14:19:09 2010
@@ -1,6 +1,8 @@
 
-
 *** CHROOT01 TEST ***
+allocate most of memory - attempt to fail chroot - expect ENOTSUP
+freeing the allocated memory
+chroot with bad path - expect EFAULT
 SUCCESS on /one/one.test
 SUCCESS on /two/two.test
 Reset the private environment

diff -u rtems/testsuites/psxtests/psxchroot01/test.c:1.8 rtems/testsuites/psxtests/psxchroot01/test.c:1.9
--- rtems/testsuites/psxtests/psxchroot01/test.c:1.8	Tue Dec  8 11:52:53 2009
+++ rtems/testsuites/psxtests/psxchroot01/test.c	Fri Jul 16 14:19:09 2010
@@ -15,7 +15,7 @@
  *  implementation of this appears to seek to the ((off/DIRENT_SIZE) + 1)
  *  record where DIRENT_SIZE seems to be 12 bytes.
  *
- *  COPYRIGHT (c) 1989-2009.
+ *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
@@ -34,6 +34,7 @@
 #include <rtems/libio.h>
 #include <rtems/userenv.h>
 #include <pmacros.h>
+#include <rtems/score/heap.h>
 
 void touch( char *file )
 {
@@ -63,6 +64,8 @@
 }
 
 #if defined(__rtems__)
+extern Heap_Control  *RTEMS_Malloc_Heap;
+
 int test_main(void)
 #else
 int main(
@@ -72,13 +75,16 @@
 #endif
 {
   int status;
-
+  void *alloc_ptr = (void *)0;
+  Heap_Information_block Info;
 /*
  *  This test is the C equivalent of this sequence.
 #mkdir /one
 #mkdir /one/one
 #touch /one/one.test
 #touch /one/two/two.test
+# an error case to ENOTSUP from chroot
+# chroot
 #chroot /one
 #if !fileexists(/one/one.test) echo "SUCCESSFUL"
 #if fileexists(/two/two.test) echo "SUCCESSFUL"
@@ -101,8 +107,25 @@
   touch( "/one/one.test" );
   touch( "/one/two/two.test" );
 
+  puts( "allocate most of memory - attempt to fail chroot - expect ENOTSUP" );
+  _Heap_Get_information(RTEMS_Malloc_Heap, &Info);
+  alloc_ptr = malloc( Info.Free.largest - 4 );
+  rtems_test_assert( alloc_ptr != NULL );
+
   status = chroot( "/one" );
-  rtems_test_assert(  status == 0 );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == ENOTSUP );
+
+  puts( "freeing the allocated memory" );
+  free( alloc_ptr );
+
+  puts( "chroot with bad path - expect EFAULT" );
+  status = chroot( NULL );
+  rtems_test_assert( status == -1 );
+  rtems_test_assert( errno == EFAULT );
+
+  status = chroot( "/one" );
+  rtems_test_assert( status == 0 );
 
   status = fileexists( "/one/one.test" );
   printf( "%s on /one/one.test\n", (!status) ? "SUCCESS" : "FAILURE" );



--

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/20100716/6e4879a9/attachment.html>


More information about the vc mailing list