Wrap memory manager macros into error generating macros which use test_errortimer_t to return an error at a certain time step. Every macro expects an test_errortimer_t as first parameter.
In case KONFIG_UNITTEST is not defined, every TEST macro calls the corresponding ALLOC_MM, RESIZE_MM, or FREE_MM macro.
MemoryErrorTestMacros | Wrap memory manager macros into error generating macros which use test_errortimer_t to return an error at a certain time step. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file MemoryErrorTestMacros. |
C-kern/ | Implementation file MemoryErrorTestMacros impl. |
Functions | |
allocate-test | |
ALLOC_ERR_MM | Allocates a new memory block with error. |
RESIZE_ERR_MM | Resizes memory block with error. |
FREE_ERR_MM | Frees memory block with error. |
test | |
unittest_test_mm_mm_test | Test <test_t> functionality. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2013 Jörg Seebohn
Header file MemoryErrorTestMacros.
Implementation file MemoryErrorTestMacros impl.
allocate-test | |
ALLOC_ERR_MM | Allocates a new memory block with error. |
RESIZE_ERR_MM | Resizes memory block with error. |
FREE_ERR_MM | Frees memory block with error. |
test | |
unittest_test_mm_mm_test | Test <test_t> functionality. |
#define ALLOC_ERR_MM( errtimer, size, mblock ) ( __extension__ ({ err = process_testerrortimer(errtimer); if (! err) err = ALLOC_MM(size, mblock); err ; }))
Allocates a new memory block with error. See also <malloc_mmimpl>. errtimer is of type test_errortimer_t.
#define RESIZE_ERR_MM( errtimer, newsize, mblock ) ( __extension__ ({ err = process_testerrortimer(errtimer); if (! err) err = RESIZE_MM(newsize, mblock); err ; }))
Resizes memory block with error. See also <mresize_mmimpl>. errtimer is of type test_errortimer_t.
#define FREE_ERR_MM( errtimer, mblock ) ( __extension__ ({ err = FREE_MM(mblock) ; if (! err) err = process_testerrortimer(errtimer) ; err ; }))
Frees memory block with error. See also <mfree_mmimpl>. errtimer is of type test_errortimer_t.
Holds a timer value and an error code.
struct test_errortimer_t
Allocates a new memory block with error.
#define ALLOC_ERR_MM( errtimer, size, mblock ) ( __extension__ ({ err = process_testerrortimer(errtimer); if (! err) err = ALLOC_MM(size, mblock); err ; }))
Resizes memory block with error.
#define RESIZE_ERR_MM( errtimer, newsize, mblock ) ( __extension__ ({ err = process_testerrortimer(errtimer); if (! err) err = RESIZE_MM(newsize, mblock); err ; }))
Frees memory block with error.
#define FREE_ERR_MM( errtimer, mblock ) ( __extension__ ({ err = FREE_MM(mblock) ; if (! err) err = process_testerrortimer(errtimer) ; err ; }))
Test test_t functionality.
int unittest_test_mm_mm_test( void )
Define this in your Makefile to include additional code for testing single components.
#define KONFIG_UNITTEST
Allocates a new memory block.
#define ALLOC_MM( size, mblock ) malloc_mm(mm_maincontext(), size, mblock)
Resizes memory block.
#define RESIZE_MM( newsize, mblock ) mresize_mm(mm_maincontext(), newsize, mblock)
Frees memory block.
#define FREE_MM( mblock ) mfree_mm(mm_maincontext(), mblock)