GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > MEM / V3-1-0

Constituent: mem_unit_test     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

mem_unit_test.c File Reference

Test the MEM package. More...

#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include "MSG/MSG_pubdefs.h"
#include "MSG/MSG_printProc.h"
#include "PBS/PBS.h"
#include "PBS/TASK.h"
#include "MEM/MEM.h"
#include "MEM/MEM_msgs.h"
#include "mempriv.h"
#include "mem_test_desc.h"
#include "mem_test_dump.h"
#include "mem_test_load.h"
#include "mem_test_map.h"
#include "mem_unit_test.h"

Include dependency graph for mem_unit_test.c:

Include dependency graph

Functions

void show_banner (const char *desc_1, const char *desc_2)
 Display a message as a banner.

void show_at_level (const int level, const char *item_1, const char *item_2)
 Display text with indentation.

void test_Push_State (test_Test_Descriptor *td_p, const char *desc, const int index)
 Enter a new test state.

void test_Pop_State (test_Test_Descriptor *td_p)
 Return for a test state.

void show_desc_stack (const test_Test_Descriptor *td_p)
 Display the current state decription stack.

unsigned int start_message_system (void)
 Start the messaging system.

unsigned int stop_message_system (void)
 Stop the messaging system.

void test_Show (const test_Test_Descriptor *td_p, const int level, const char *item_1, const char *item_2)
 Display text with indentation.

void test_Show_Msg_OK (const test_Test_Descriptor *td_p)
 Indicate that the next error message is expected.

int test_Status_Compare (const test_Test_Descriptor *td_p, const unsigned int expect, const unsigned int actual, const char *func)
 Check a status value returned from a MEM library function.

int test_Value32_Compare (const test_Test_Descriptor *td_p, const unsigned int expect, const unsigned int actual, const char *desc)
 Check a 32-bit value.

int test_Descriptor_Compare (const test_Test_Descriptor *td_p, const MEM_Descriptor *expect, const MEM_Descriptor *actual, const char *desc)
 Verify the contents of a memory descriptor.

int test_LoadInfo_Compare (const test_Test_Descriptor *td_p, const MEM_LoadInfo *expect, MEM_LoadInfo *actual)
 Verify the contents of a MEM_LoadInfo object.

int test_DumpInfo_Compare (const test_Test_Descriptor *td_p, const MEM_DumpInfo *expect, MEM_DumpInfo *actual)
 Verify the contents of a MEM_DumpInfo object.

int test_Memory_Compare (const test_Test_Descriptor *td_p, const void *expect_p, const void *actual_p, const void *mask_p, const size_t num_bytes)
 Verify the contents of a buffer in memory.

void test_Show_Item (const test_Test_Descriptor *td_p, const char *name, const char *fmt, const char *str_param, const unsigned int int_param)
 Display an item of data.

void test_Show_Dump_Progress (const test_Test_Descriptor *td_p, const char *name, const size_t chunk_size, const caddr_t addr, const size_t progress, const size_t full_size)
 Display dump progress.

void test_PrnFill32 (void *startAddr, const unsigned long nWords)
 PRN fill.

unsigned long test_PrnVerify32 (const void *startAddr, const unsigned long nWords, unsigned long *firstFailure, unsigned long *expect, unsigned long *found)
 PRN verify.

int mem_unit_test ()
 The unit test entry point.

int main (void)
 The application entry point for the sun-gcc version of the test.


Detailed Description

Test the MEM package.

  CVS $Id: mem_unit_test.c,v 1.9 2004/10/26 14:50:47 dmay Exp $
  

Test the constituents of the MEM package. Included in this file is the test 'main', which configures the test environment, invokes individual subtests, and reports status. The actual subtests are contained in separate source files.

This file also includes some support functions that can be used by the subtests to compare actual and expected values, and to display various types of information and status. By passing all user output through these support functions, the output mechanism can be modified without affecting the subtest source code (e.g. changing printf to fprintf).


Function Documentation

int main void   ) 
 

The application entry point for the sun-gcc version of the test.

Return values:
0 Success.
-1 Failure.

Here is the call graph for this function:

int mem_unit_test  ) 
 

The unit test entry point.

Configures the test environment, runs the various subtests, collects the status values, and displays the results.

Return values:
0 Success.
-1 Failure.

Here is the call graph for this function:

void show_at_level const int  level,
const char *  item_1,
const char *  item_2
[static]
 

Display text with indentation.

Display text with indentation appropriate for the specified test state level.

Parameters:
level Test state level.
item_1 First text string to display.
item_2 Second text string to display.
Returns:
Nothing.

void show_banner const char *  desc_1,
const char *  desc_2
[static]
 

Display a message as a banner.

Parameters:
desc_1 First text string to display.
desc_2 Second text string to display.
Returns:
Nothing.

void show_desc_stack const test_Test_Descriptor td_p  )  [static]
 

Display the current state decription stack.

Display all the state descriptions on the test's state stack.

Parameters:
td_p Pointer to test descriptor.
Returns:
Nothing.

Here is the call graph for this function:

unsigned int start_message_system void   )  [static]
 

Start the messaging system.

Returns:
A MEM MSG value.

unsigned int stop_message_system void   )  [static]
 

Stop the messaging system.

Returns:
A MEM MSG value.

int test_Descriptor_Compare const test_Test_Descriptor td_p,
const MEM_Descriptor expect,
const MEM_Descriptor actual,
const char *  desc
 

Verify the contents of a memory descriptor.

This function verifies the contents of a memory descriptor and reports an error if the values are not as expected.

Parameters:
td_p Pointer to test descriptor.
expect Pointer to a memory descriptor with the expected values.
actual Pointer to the memory descriptor to verify.
desc Text description of the descriptor.
Return values:
0 Descriptor values are correct.
-1 One or more elements of the descriptor are incorrect.

Here is the call graph for this function:

int test_DumpInfo_Compare const test_Test_Descriptor td_p,
const MEM_DumpInfo expect,
MEM_DumpInfo actual
 

Verify the contents of a MEM_DumpInfo object.

This function verifies the contents of a MEM_DumpInfo object and reports an error if the values are not as expected.

Parameters:
td_p Pointer to test descriptor.
expect Pointer to a MEM_DumpInfo object with the expected values.
actual Pointer to the MEM_DumpInfo object to verify.
Return values:
0 MEM_DumpInfo values are correct.
-1 One or more elements of the MEM_DumpInfo object are incorrect.

Here is the call graph for this function:

int test_LoadInfo_Compare const test_Test_Descriptor td_p,
const MEM_LoadInfo expect,
MEM_LoadInfo actual
 

Verify the contents of a MEM_LoadInfo object.

This function verifies the contents of a MEM_LoadInfo object and reports an error if the values are not as expected.

Parameters:
td_p Pointer to test descriptor.
expect Pointer to a MEM_LoadInfo object with the expected values.
actual Pointer to the MEM_LoadInfo object to verify.
Return values:
0 MEM_LoadInfo values are correct.
-1 One or more elements of the MEM_LoadInfo object are incorrect.

Here is the call graph for this function:

int test_Memory_Compare const test_Test_Descriptor td_p,
const void *  expect_p,
const void *  actual_p,
const void *  mask_p,
const size_t  num_bytes
 

Verify the contents of a buffer in memory.

This function verifies the contents of a memory buffer and reports an error if the values are not as expected. An optional mask can be used to indicate which bits should be verified.

Parameters:
td_p Pointer to test descriptor.
expect_p Pointer to a memory buffer with the expected values.
actual_p Pointer to the memory buffer to verify.
mask_p Pointer to a memory buffer of mask values.
num_bytes Number of bytes to verify within the buffer.
Return values:
0 Buffer values are correct.
-1 One or more values within the buffer are incorrect.

Here is the call graph for this function:

void test_Pop_State test_Test_Descriptor td_p  ) 
 

Return for a test state.

Pop a test state description from a test's state stack.

Parameters:
td_p Pointer to test descriptor.
Returns:
Nothing.

Here is the call graph for this function:

void test_PrnFill32 void *  startAddr,
const unsigned long  nWords
 

PRN fill.

Fills a buffer in memory with a pseudo-random sequence of numbers.

The PRN is based on this polynomial: 8 7 5 3 h(x) = x + x + x + x + 1

Parameters:
startAddr (input) Pointer to start of 32-bit aligned memory buffer.
nWords (input) Number of 32-bit words to fill.

unsigned long test_PrnVerify32 const void *  startAddr,
const unsigned long  nWords,
unsigned long *  firstFailure,
unsigned long *  expect,
unsigned long *  found
 

PRN verify.

Verifies a pseudo-random sequence of numbers and reports number of errors found and details about the first error.

The PRN is based on this polynomial: 8 7 5 3 h(x) = x + x + x + x + 1

Parameters:
startAddr (input) Pointer to start of 32-bit aligned sequence.
nWords (input) Number of 32-bit words to verify.
firstFailure (output) 32-bit offset of first failure.
expect (output) Data expected at first failure.
found (output) Actual data found at first failure.
Return values:
Number of errors found.

void test_Push_State test_Test_Descriptor td_p,
const char *  desc,
const int  index
 

Enter a new test state.

Push a new test state description onto a test's state stack. This state stack provides a trace of the execution of the test.

Parameters:
td_p Pointer to test descriptor.
desc Description of the new state.
index Generic index value.
Returns:
Nothing.

Here is the call graph for this function:

void test_Show const test_Test_Descriptor td_p,
const int  level,
const char *  item_1,
const char *  item_2
 

Display text with indentation.

Display text with indentation appropriate for the specified level.

Parameters:
td_p Pointer to test descriptor.
level Indentation level.
item_1 First text string to display.
item_2 Second text string to display.
Returns:
Nothing.

Here is the call graph for this function:

void test_Show_Dump_Progress const test_Test_Descriptor td_p,
const char *  name,
const size_t  chunk_size,
const caddr_t  addr,
const size_t  progress,
const size_t  full_size
 

Display dump progress.

This function displays the progress of a dump.

Parameters:
td_p Pointer to test descriptor.
name Name of the dump.
chunk_size Number of bytes dumped in last chunk.
addr Starting address of last chunk.
progress Number of bytes dumped so far.
full_size Full size of the dump, in bytes.
Returns:
Nothing.

Here is the call graph for this function:

void test_Show_Item const test_Test_Descriptor td_p,
const char *  name,
const char *  fmt,
const char *  str_param,
const unsigned int  int_param
 

Display an item of data.

This function displays an item of data in a predefined format.

Parameters:
td_p Pointer to test descriptor.
name Name of the item.
fmt Format string to display the item's value.
str_param First parameter (string) for fmt string.
int_param Second parameter (uint) for fmt string.
Returns:
Nothing.

Here is the call graph for this function:

void test_Show_Msg_OK const test_Test_Descriptor td_p  ) 
 

Indicate that the next error message is expected.

Display text that indicates that the next error message is expected.

Parameters:
td_p Pointer to test descriptor.
Returns:
Nothing.

Here is the call graph for this function:

int test_Status_Compare const test_Test_Descriptor td_p,
const unsigned int  expect,
const unsigned int  actual,
const char *  func
 

Check a status value returned from a MEM library function.

Compare actual and expected status values returned from a MEM library function and display a message if they differ.

Parameters:
td_p Pointer to test descriptor.
expect Expected value.
actual Actual value.
func Name of the MEM library function that returned the status.
Return values:
0 Actual value == Expected value
-1 Actual value != Expected value.

Here is the call graph for this function:

int test_Value32_Compare const test_Test_Descriptor td_p,
const unsigned int  expect,
const unsigned int  actual,
const char *  desc
 

Check a 32-bit value.

Compare actual and expected 32-bit values and display a message if they differ.

Parameters:
td_p Pointer to test descriptor.
expect Expected value.
actual Actual value.
desc Description of the value.
Return values:
0 Actual value == Expected value.
-1 Actual value != Expected value.

Here is the call graph for this function:


Generated on Mon Dec 13 07:37:04 2004 by doxygen 1.3.3