GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> MEM / V5-8-2 > mem_unit_test / mv2304
#include <string.h>
#include <MEM/MEM.h>
#include <MEM/MEM_dump.h>
#include <MEM/MEM_map.h>
#include <MEM/MEM_msgs.h>
#include <MSG/MSG_pubdefs.h>
#include <mem_unit_test.h>
Classes | |
struct | _mem_DumpInfo |
Dump unit test information. More... | |
Typedefs | |
typedef struct _mem_DumpInfo | mem_DumpInfo |
Typedef for _mem_DumpInfo. | |
Functions | |
static int | mem_dumpInit_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Start the Memory Dump interface and verify the results. | |
static int | mem_dumpGetInfo_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Get and verify information about a dump. | |
static int | mem_dumpGetContext_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Get a dump context and verify the results. | |
static int | mem_dumpReleaseContext_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Release a dump context and verify the results. | |
static int | mem_dumpMapInit_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Start the Memory Map interface and verify the results. | |
static int | mem_dumpMapAddEntry_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Add an entry to the Memory Map and verify the results. | |
void | mem_SetRegsSubFunction (double f1, double f2, double f3, double f4, double f5, double f6, double f7, double f8) |
Set some registers to known values. | |
void | mem_SetRegs (test_Test_Descriptor *td_p, mem_DumpInfo *info_p) |
Set some registers to known values. | |
static int | mem_dumpStart_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Start a dump and verify the results. | |
static int | mem_dumpGetData_wrap (test_Test_Descriptor *td_p, int id, mem_DumpInfo *info_p) |
Get a chunk of dump data and verify the results. | |
void | mem_DumpParam_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Test for Memory Dump bad parameter handling. | |
void | mem_DumpContext_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for Memory Dump context operations. | |
void | mem_DumpMemory_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for nominal Memory Dump operations. | |
void | mem_DumpWrap_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for wrapped Memory Dump operation. | |
void | mem_DumpRegSet_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for CPU register Memory Dump operation. | |
void | mem_DumpPCI_test (test_Test_Descriptor *td_p, const unsigned int bit_mask) |
Unit test for PCI configuration dump. |
CVS $Id: mem_test_dump.c,v 1.8 2011/03/29 01:58:52 apw Exp $
Test the operation of the MEM dump functions.
void mem_DumpContext_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for Memory Dump context operations.
Verify the handling of Memory Dump context 'get', 'release', and 'info' operations.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::act_info, DIM, _test_Test_Descriptor::exec, _mem_DumpInfo::exp_info, _mem_DumpInfo::exp_info_status, _mem_DumpInfo::exp_status, _test_Test_Descriptor::fail, _mem_DumpInfo::handle, _mem_DumpInfo::handle_p, _mem_DumpInfo::info_p, mem_dumpGetContext_wrap(), mem_dumpGetInfo_wrap(), mem_dumpInit_wrap(), mem_dumpReleaseContext_wrap(), _MEM_DumpInfo::status, test_Pop_State(), and test_Push_State().
Referenced by mem_unit_test_func().
int mem_dumpGetContext_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | info_p | |||
) | [static] |
Get a dump context and verify the results.
Wrapper for the MEM_dumpGetContext() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_status, _mem_DumpInfo::handle_p, MEM_dumpGetContext(), mem_dumpGetInfo_wrap(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpContext_test(), mem_DumpMemory_test(), mem_DumpParam_test(), mem_DumpRegSet_test(), and mem_DumpWrap_test().
int mem_dumpGetData_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | info_p | |||
) | [static] |
Get a chunk of dump data and verify the results.
Wrapper for the MEM_dumpGetData() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::addr_p, _mem_DumpInfo::bytes_p, _mem_DumpInfo::chunkSize, _mem_DumpInfo::dest_p, _mem_DumpInfo::dumpSize, _mem_DumpInfo::exp_addr, _mem_DumpInfo::exp_bytes, _mem_DumpInfo::exp_status, _mem_DumpInfo::handle, MEM_dumpGetData(), mem_dumpGetInfo_wrap(), _mem_DumpInfo::name, _mem_DumpInfo::progress, test_Pop_State(), test_Push_State(), test_Show_Dump_Progress(), test_Show_Msg_OK(), test_Status_Compare(), and test_Value32_Compare().
Referenced by mem_DumpMemory_test(), mem_DumpParam_test(), mem_DumpRegSet_test(), and mem_DumpWrap_test().
int mem_dumpGetInfo_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | info_p | |||
) | [static] |
Get and verify information about a dump.
Wrapper for the MEM_dumpGetInfo() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_info, _mem_DumpInfo::exp_info_status, _mem_DumpInfo::handle, _mem_DumpInfo::info_p, MEM_dumpGetInfo(), test_DumpInfo_Compare(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpContext_test(), mem_dumpGetContext_wrap(), mem_dumpGetData_wrap(), mem_DumpParam_test(), and mem_dumpStart_wrap().
int mem_dumpInit_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | info_p | |||
) | [static] |
Start the Memory Dump interface and verify the results.
Wrapper for the MEM_dumpInit() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to memory dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_status, MEM_dumpInit(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpContext_test(), mem_DumpMemory_test(), mem_DumpParam_test(), mem_DumpRegSet_test(), and mem_DumpWrap_test().
int mem_dumpMapAddEntry_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | 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 dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_status, _mem_DumpInfo::map_access_flags, _mem_DumpInfo::map_num_bytes, _mem_DumpInfo::map_read_cb, _mem_DumpInfo::map_start_addr, _mem_DumpInfo::map_write_cb, MEM_mapAddEntry(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpMemory_test(), and mem_DumpWrap_test().
int mem_dumpMapInit_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | 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 dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_status, MEM_mapInit(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpMemory_test(), and mem_DumpWrap_test().
void mem_DumpMemory_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for nominal Memory Dump operations.
This test runs two simultaneous dumps (to test re-entrant interfaces). A local memory buffer is targeted for the dump. This data is dumped to the "dest" members of the mem_DumpInfo structures used to control the dumps. Two dumps are run (firstDump and secondDump). The target memory of these dumps overlap.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::act_addr, _mem_DumpInfo::act_bytes, _mem_DumpInfo::act_info, _mem_DumpInfo::addr_p, _mem_DumpInfo::bytes_p, _mem_DumpInfo::chunkSize, _MEM_DumpInfo::current_addr, _mem_DumpInfo::dest, _mem_DumpInfo::dest_p, _mem_DumpInfo::dumpSize, _test_Test_Descriptor::exec, _mem_DumpInfo::exp_addr, _mem_DumpInfo::exp_bytes, _mem_DumpInfo::exp_dest, _mem_DumpInfo::exp_info, _mem_DumpInfo::exp_info_status, _mem_DumpInfo::exp_status, _test_Test_Descriptor::fail, _mem_DumpInfo::handle, _mem_DumpInfo::handle_p, _mem_DumpInfo::info_p, _mem_DumpInfo::map_access_flags, _mem_DumpInfo::map_num_bytes, _mem_DumpInfo::map_read_cb, _mem_DumpInfo::map_start_addr, _mem_DumpInfo::map_write_cb, _MEM_DumpInfo::md, _mem_DumpInfo::md_p, MEM_CreateDescriptor(), mem_dumpGetContext_wrap(), mem_dumpGetData_wrap(), mem_dumpInit_wrap(), mem_dumpMapAddEntry_wrap(), mem_dumpMapInit_wrap(), mem_dumpReleaseContext_wrap(), mem_dumpStart_wrap(), MEM_MAP_ACCESS_READ_32, MEM_mapRWGeneric(), _mem_DumpInfo::name, _mem_DumpInfo::progress, _mem_DumpInfo::start, _MEM_DumpInfo::status, test_Memory_Compare(), test_Pop_State(), test_PrnFill32(), test_Push_State(), _mem_DumpInfo::totalSize, and _MEM_DumpInfo::wrapped.
Referenced by mem_unit_test_func().
void mem_DumpParam_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Test for Memory Dump bad parameter handling.
Verify the handling of bad parameters by the Memory Dump functions.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::act_addr, _mem_DumpInfo::act_bytes, _mem_DumpInfo::act_info, _mem_DumpInfo::addr_p, _mem_DumpInfo::bytes_p, _mem_DumpInfo::dest, _mem_DumpInfo::dest_p, _test_Test_Descriptor::exec, _mem_DumpInfo::exp_addr, _mem_DumpInfo::exp_bytes, _mem_DumpInfo::exp_info, _mem_DumpInfo::exp_info_status, _mem_DumpInfo::exp_status, _test_Test_Descriptor::fail, _mem_DumpInfo::handle, _mem_DumpInfo::handle_p, _mem_DumpInfo::info_p, _MEM_DumpInfo::md, _mem_DumpInfo::md_p, mem_dumpGetContext_wrap(), mem_dumpGetData_wrap(), mem_dumpGetInfo_wrap(), mem_dumpInit_wrap(), mem_dumpReleaseContext_wrap(), mem_dumpStart_wrap(), _mem_DumpInfo::name, _MEM_DumpInfo::status, test_Pop_State(), and test_Push_State().
Referenced by mem_unit_test_func().
void mem_DumpPCI_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for PCI configuration dump.
Run unit test for PCI configuration memory dumps. Test the nominal dump operations, no extensive error handling done in this test.
The following features are tested:
The following features are assumed to work:
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _test_Test_Descriptor::exec, _test_Test_Descriptor::fail, MEM_CreateDescriptor(), MEM_dumpGetContext(), MEM_dumpInit(), MEM_dumpReleaseContext(), test_Memory_Compare(), test_Pop_State(), test_Push_State(), and test_Status_Compare().
void mem_DumpRegSet_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for CPU register Memory Dump operation.
This test runs a dump of the CPU registers. A local memory buffer is targeted for the dump. This data is dumped to the "dest" member of the mem_DumpInfo structure used to control the dump.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::act_addr, _mem_DumpInfo::act_bytes, _mem_DumpInfo::act_info, _mem_DumpInfo::addr_p, _mem_DumpInfo::bytes_p, _mem_DumpInfo::chunkSize, _MEM_DumpInfo::current_addr, _mem_DumpInfo::dest, _mem_DumpInfo::dest_p, _mem_DumpInfo::dumpSize, _test_Test_Descriptor::exec, _mem_DumpInfo::exp_addr, _mem_DumpInfo::exp_bytes, _mem_DumpInfo::exp_dest, _mem_DumpInfo::exp_info, _mem_DumpInfo::exp_info_status, _mem_DumpInfo::exp_mask, _mem_DumpInfo::exp_status, _test_Test_Descriptor::fail, _mem_DumpInfo::handle, _mem_DumpInfo::handle_p, _mem_DumpInfo::info_p, _MEM_DumpInfo::md, _mem_DumpInfo::md_p, MEM_CreateDescriptor(), mem_dumpGetContext_wrap(), mem_dumpGetData_wrap(), mem_dumpInit_wrap(), mem_dumpReleaseContext_wrap(), mem_dumpStart_wrap(), MEM_REGISTER_SET_BYTES, _mem_DumpInfo::name, _mem_DumpInfo::progress, _mem_DumpInfo::start, _MEM_DumpInfo::status, test_Memory_Compare(), test_Pop_State(), test_Push_State(), _mem_DumpInfo::totalSize, and _MEM_DumpInfo::wrapped.
Referenced by mem_unit_test_func().
int mem_dumpReleaseContext_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | info_p | |||
) | [static] |
Release a dump context and verify the results.
Wrapper for the MEM_dumpReleaseContext() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_status, _mem_DumpInfo::handle, MEM_dumpReleaseContext(), test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpContext_test(), mem_DumpMemory_test(), mem_DumpParam_test(), mem_DumpRegSet_test(), and mem_DumpWrap_test().
int mem_dumpStart_wrap | ( | test_Test_Descriptor * | td_p, | |
int | id, | |||
mem_DumpInfo * | info_p | |||
) | [static] |
Start a dump and verify the results.
Wrapper for the MEM_StartDump() function that validates the results.
td_p | Pointer to test descriptor. | |
id | ID to use for user messages. | |
info_p | Pointer to dump test info. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::exp_status, _mem_DumpInfo::handle, _mem_DumpInfo::md_p, mem_dumpGetInfo_wrap(), MEM_dumpStart(), mem_SetRegs(), _MEM_Descriptor::memmap, test_Pop_State(), test_Push_State(), test_Show_Msg_OK(), and test_Status_Compare().
Referenced by mem_DumpMemory_test(), mem_DumpParam_test(), mem_DumpRegSet_test(), and mem_DumpWrap_test().
void mem_DumpWrap_test | ( | test_Test_Descriptor * | td_p, | |
const unsigned int | bit_mask | |||
) |
Unit test for wrapped Memory Dump operation.
This test runs a single dump that wraps the source buffer a number of times. A local memory buffer is targeted for the dump. This data is dumped to the "dest" member of the mem_DumpInfo structure used to control the dump.
td_p | Pointer to test descriptor. | |
bit_mask | Bitmask ID for this subtest. |
0 | Success. | |
-1 | Failure. |
References _mem_DumpInfo::act_addr, _mem_DumpInfo::act_bytes, _mem_DumpInfo::act_info, _mem_DumpInfo::addr_p, _mem_DumpInfo::bytes_p, _mem_DumpInfo::chunkSize, _MEM_DumpInfo::current_addr, _mem_DumpInfo::dest, _mem_DumpInfo::dest_p, _mem_DumpInfo::dumpSize, _test_Test_Descriptor::exec, _mem_DumpInfo::exp_addr, _mem_DumpInfo::exp_bytes, _mem_DumpInfo::exp_dest, _mem_DumpInfo::exp_info, _mem_DumpInfo::exp_info_status, _mem_DumpInfo::exp_status, _test_Test_Descriptor::fail, _mem_DumpInfo::handle, _mem_DumpInfo::handle_p, _mem_DumpInfo::info_p, _mem_DumpInfo::map_access_flags, _mem_DumpInfo::map_num_bytes, _mem_DumpInfo::map_read_cb, _mem_DumpInfo::map_start_addr, _mem_DumpInfo::map_write_cb, _MEM_DumpInfo::md, _mem_DumpInfo::md_p, MEM_CreateDescriptor(), mem_dumpGetContext_wrap(), mem_dumpGetData_wrap(), mem_dumpInit_wrap(), mem_dumpMapAddEntry_wrap(), mem_dumpMapInit_wrap(), mem_dumpReleaseContext_wrap(), mem_dumpStart_wrap(), MEM_MAP_ACCESS_READ_32, MEM_mapRWGeneric(), _mem_DumpInfo::name, _mem_DumpInfo::progress, _mem_DumpInfo::start, _MEM_DumpInfo::status, test_Memory_Compare(), test_Pop_State(), test_PrnFill32(), test_Push_State(), _mem_DumpInfo::totalSize, and _MEM_DumpInfo::wrapped.
Referenced by mem_unit_test_func().
void mem_SetRegs | ( | test_Test_Descriptor * | td_p, | |
mem_DumpInfo * | info_p | |||
) |
Set some registers to known values.
Using assumptions about how the compiler uses registers, set some of them to known values.
td_p | Pointer to test descriptor. | |
info_p | Pointer to memory dump test info. |
References _mem_DumpInfo::exp_dest, _mem_DumpInfo::exp_mask, MEM_REGISTER_SET_BYTES, and mem_SetRegsSubFunction().
Referenced by mem_dumpStart_wrap().
void mem_SetRegsSubFunction | ( | double | f1, | |
double | f2, | |||
double | f3, | |||
double | f4, | |||
double | f5, | |||
double | f6, | |||
double | f7, | |||
double | f8 | |||
) |
Set some registers to known values.
f1 | floating-point value. | |
f2 | floating-point value. | |
f3 | floating-point value. | |
f4 | floating-point value. | |
f5 | floating-point value. | |
f6 | floating-point value. | |
f7 | floating-point value. | |
f8 | floating-point value. |
Referenced by mem_SetRegs().