GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / dev > mem_unit_test / linux-gcc
#include <MEM/MEM.h>
#include <MEM/MEM_map.h>
#include <MEM/MEM_msgs.h>
#include <mempriv.h>
#include <mem_unit_test.h>
Classes | |
struct | _mem_MapInfo |
Memory map test information. More... | |
Defines | |
#define | mem_ACCESS_NAME(__d__) |
Convert a memory access type to a text string. | |
Typedefs | |
typedef struct _mem_MapInfo | mem_MapInfo |
Typedef for _mem_MapInfo. | |
Functions | |
static int | mem_mapInit_wrap (test_Test_Descriptor *td_p, int id, mem_MapInfo *info_p) |
Start the Memory Map interface and verify the results. | |
static int | mem_mapAddEntry_wrap (test_Test_Descriptor *td_p, int id, mem_MapInfo *info_p) |
Add an entry to the Memory Map and verify the results. | |
void | mem_MapBuild_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Test memory map table construction. | |
void | mem_ValidateMemoryRange_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test of Mem_ValidateMemoryRange(). | |
Variables | |
struct { | |
const char * testName | |
MEM_Memmap map | |
MEM_mapAccessType access | |
caddr_t sa | |
size_t bytes | |
unsigned int expect | |
} | mem_ValMemRangeTestData [] |
Memory range test data. |
CVS $Id: mem_test_map.c,v 1.5 2011/03/29 01:58:52 apw Exp $
Test the operation of the memory map functions.
#define mem_ACCESS_NAME | ( | __d__ | ) |
Value:
( ((__d__) == MEM_MAP_ACCESS_READ_32) ? "READ_32" : \ ( ((__d__) == MEM_MAP_ACCESS_WRITE_32) ? "WRITE_32" : \ ( ((__d__) == MEM_MAP_ACCESS_READ_16) ? "READ_16" : \ ( ((__d__) == MEM_MAP_ACCESS_WRITE_16) ? "WRITE_16" : \ ( ((__d__) == MEM_MAP_ACCESS_READ_8) ? "READ_8" : \ ( ((__d__) == MEM_MAP_ACCESS_WRITE_8) ? "WRITE_8" : \ ( ((__d__) == MEM_MAP_ACCESS_READ_ANY) ? "READ_ANY" : \ ( ((__d__) == MEM_MAP_ACCESS_WRITE_ANY) ? "WRITE_ANY" : \ ( ((__d__) == MEM_MAP_ACCESS_32) ? "ANY_32" : \ ( ((__d__) == MEM_MAP_ACCESS_16) ? "ANY_16" : \ ( ((__d__) == MEM_MAP_ACCESS_8) ? "ANY_8" : \ ( ((__d__) == MEM_MAP_ACCESS_ANY) ? "ANY" : \ "UNKNOWN" ))))))))))))
Referenced by mem_ValidateMemoryRange_test().
int mem_mapAddEntry_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_MapInfo * | info_p | |||
) | [static] |
Add an entry to the Memory Map and verify the results.
Wrapper for the MEM_mapAddEntry() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to memory map test info. |
0 | Success. | |
-1 | Failure. |
References _mem_MapInfo::access_flags, _mem_MapInfo::exp_status, MEM_mapAddEntry(), _mem_MapInfo::num_bytes, _mem_MapInfo::read_cb, _mem_MapInfo::start_addr, test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), test_Status_Compare(), and _mem_MapInfo::write_cb.
Referenced by mem_MapBuild_test().
void mem_MapBuild_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Test memory map table construction.
Verify the functions that build memory maps.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
References _mem_MapInfo::access_flags, _test_Test_Descriptor::exec, _mem_MapInfo::exp_status, _test_Test_Descriptor::fail, mem_mapAddEntry_wrap(), mem_mapInit_wrap(), MEM_mapRWGeneric(), _mem_MapInfo::num_bytes, _mem_MapInfo::read_cb, _mem_MapInfo::start_addr, test_Pop_State(), test_Push_State(), and _mem_MapInfo::write_cb.
Referenced by mem_unit_test_func().
int mem_mapInit_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_MapInfo * | info_p | |||
) | [static] |
Start the Memory Map interface and verify the results.
Wrapper for the MEM_mapInit() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to memory map test info. |
0 | Success. | |
-1 | Failure. |
References _mem_MapInfo::exp_status, MEM_mapInit(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_MapBuild_test().
void mem_ValidateMemoryRange_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test of Mem_ValidateMemoryRange().
Run unit test for Mem_ValidateMemoryRange(). Driven by the table of unit tests defined in mem_ValMemRangeTestData.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
References DIM, _test_Test_Descriptor::exec, _test_Test_Descriptor::fail, mem_ACCESS_NAME, MEM_CreateDescriptor(), MEM_MAP_NAME, Mem_ValidateMemoryRange(), mem_ValMemRangeTestData, test_Pop_State(), test_Push_State(), test_Show_Item(), test_Show_Msg_OK(), and test_Status_Compare().
Memory range test data.
Each item in this table contains a test case for the Mem_ValidateMemoryRange() function.
Referenced by mem_ValidateMemoryRange_test().