[rtems commit] New fstest to cover RFS bitmaps - fsrfsbitmap01

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Oct 15 12:38:15 UTC 2012


On 10/01/2012 10:36 PM, Joel Sherrill wrote:
> +void nullpointer_test(void){
> +
> +  rtems_rfs_bitmap_control* control=NULL;
> +  rtems_rfs_bitmap_control  notnullcontrol;
> +  rtems_rfs_bitmap_bit	bit = 0;
> +  rtems_rfs_bitmap_bit	seed_bit = 0;
> +  int rc;
> +  bool result;
> +
> +  printf("\n Testing bitmap_map functions with NULL bitmap control " 			"pointer\n");
> +  /* Invoke all functions with NULL control */
> +  rc = rtems_rfs_bitmap_map_set(control, bit);
> +  rtems_test_assert(rc>0);
> +  rc = rtems_rfs_bitmap_map_clear(control, bit);
> +  rtems_test_assert(rc>0);
> +  rc = rtems_rfs_bitmap_map_test(control, bit, &result);
> +  rtems_test_assert(rc>0);
> +  rc = rtems_rfs_bitmap_map_set_all(control);
> +  rtems_test_assert(rc>0);
> +  rc = rtems_rfs_bitmap_map_clear_all(control);
> +  rtems_test_assert(rc>0);
> +  rc = rtems_rfs_bitmap_create_search(control);
> +  rtems_test_assert(rc>0);
> +  rc = rtems_rfs_bitmap_map_alloc(control, seed_bit, &result, &bit);
> +  rtems_test_assert(!result);
> +  /*
> +   * Invoke map_alloc with not-null pointer to control, but with
> +   * control uninitialized. It is to cover check in rtems_rfs_bitmap_load_map.
> +   * We can't check directly if it goes this path, but we will see this in
> +   * coverage
> +   */
> +  rc = rtems_rfs_bitmap_map_set(&notnullcontrol, bit);
> +  rtems_test_assert(rc > 0);		
> +}

What is the purpose of this test?  It accesses illegal memory on some targets 
(e.g. NULL pointer access).

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.





More information about the devel mailing list