Changeset 24db9ba in rtems


Ignore:
Timestamp:
Jul 16, 2010, 7:19:09 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
e41e75de
Parents:
917e4b4
Message:

2010-07-17 Bharath Suri <bharath.s.jois@…>

PR 1622/testing

  • psxchroot01/test.c, psxchroot01/psxchroot01.scn: Added two test cases to completely cover chroot().
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r917e4b4 r24db9ba  
     12010-07-17      Bharath Suri <bharath.s.jois@gmail.com>
     2
     3        PR 1622/testing
     4        * psxchroot01/test.c, psxchroot01/psxchroot01.scn: Added two test
     5        cases to completely cover chroot().
     6
    172010-07-16      Sebastian Huber <Sebastian.Huber@embedded-brains.de>
    28
  • testsuites/psxtests/psxchroot01/psxchroot01.scn

    r917e4b4 r24db9ba  
    1 
    21
    32*** CHROOT01 TEST ***
     3allocate most of memory - attempt to fail chroot - expect ENOTSUP
     4freeing the allocated memory
     5chroot with bad path - expect EFAULT
    46SUCCESS on /one/one.test
    57SUCCESS on /two/two.test
  • testsuites/psxtests/psxchroot01/test.c

    r917e4b4 r24db9ba  
    1616 *  record where DIRENT_SIZE seems to be 12 bytes.
    1717 *
    18  *  COPYRIGHT (c) 1989-2009.
     18 *  COPYRIGHT (c) 1989-2010.
    1919 *  On-Line Applications Research Corporation (OAR).
    2020 *
     
    3535#include <rtems/userenv.h>
    3636#include <pmacros.h>
     37#include <rtems/score/heap.h>
    3738
    3839void touch( char *file )
     
    6465
    6566#if defined(__rtems__)
     67extern Heap_Control  *RTEMS_Malloc_Heap;
     68
    6669int test_main(void)
    6770#else
     
    7376{
    7477  int status;
    75 
     78  void *alloc_ptr = (void *)0;
     79  Heap_Information_block Info;
    7680/*
    7781 *  This test is the C equivalent of this sequence.
     
    8084#touch /one/one.test
    8185#touch /one/two/two.test
     86# an error case to ENOTSUP from chroot
     87# chroot
    8288#chroot /one
    8389#if !fileexists(/one/one.test) echo "SUCCESSFUL"
     
    102108  touch( "/one/two/two.test" );
    103109
     110  puts( "allocate most of memory - attempt to fail chroot - expect ENOTSUP" );
     111  _Heap_Get_information(RTEMS_Malloc_Heap, &Info);
     112  alloc_ptr = malloc( Info.Free.largest - 4 );
     113  rtems_test_assert( alloc_ptr != NULL );
     114
    104115  status = chroot( "/one" );
    105   rtems_test_assert(  status == 0 );
     116  rtems_test_assert( status == -1 );
     117  rtems_test_assert( errno == ENOTSUP );
     118
     119  puts( "freeing the allocated memory" );
     120  free( alloc_ptr );
     121
     122  puts( "chroot with bad path - expect EFAULT" );
     123  status = chroot( NULL );
     124  rtems_test_assert( status == -1 );
     125  rtems_test_assert( errno == EFAULT );
     126
     127  status = chroot( "/one" );
     128  rtems_test_assert( status == 0 );
    106129
    107130  status = fileexists( "/one/one.test" );
Note: See TracChangeset for help on using the changeset viewer.