GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FILE / V3-11-1 > file_unit_test / rhel6-64
#include <stdio.h>
#include <string.h>
#include <ZLIB/zlib.h>
#include <MSG/MSG_pubdefs.h>
#include <FBS/FBS_pubrtos.h>
#include <FILE/FILE_upl.h>
#include <FILE/FILE_upl_msg.h>
#include <file_unit_test_private.h>
#include <FILE_upl_private.h>
Functions | |
static void | file_upl_info (FILE_Upl_Info *info, const char *str) |
static void | file_upl_print (FILE_Upl_Info *info, const char *str) |
int | file_upl_test_param (void) |
int | file_upl_test_func (void) |
int | file_upl_test_err (void) |
Variables | |
unsigned short | file_upl_data_0 [] |
const unsigned int | file_upl_data_0_size |
const unsigned short | file_upl_start_0 [] |
const unsigned short | file_upl_data_0_A [] |
const unsigned short | file_upl_data_0_B [] |
const unsigned short | file_upl_data_0_C [] |
const unsigned short | file_upl_data_0_D [] |
const unsigned short | file_upl_data_0_E [] |
const unsigned short | file_upl_commit_0 [] |
unsigned short | file_upl_data_1 [] |
const unsigned int | file_upl_data_1_size |
const unsigned short | file_upl_start_1 [] |
const unsigned short | file_upl_data_1_A [] |
const unsigned short | file_upl_data_1_B [] |
const unsigned short | file_upl_data_1_C [] |
const unsigned short | file_upl_data_1_D [] |
const unsigned short | file_upl_data_1_E [] |
const unsigned short | file_upl_data_1_F [] |
const unsigned short | file_upl_data_1_G [] |
const unsigned short | file_upl_commit_1 [] |
const unsigned short | file_upl_cancel_0 [] |
const unsigned short | file_upl_start_2 [] |
const unsigned short | file_upl_start_3 [] |
const unsigned short | file_upl_data_3_A [] |
const unsigned short | file_upl_data_3_B [] |
const unsigned short | file_upl_start_4 [] |
const unsigned short | file_upl_start_5 [] |
const unsigned short | file_upl_start_6 [] |
const unsigned short | file_upl_data_6_A [] |
const unsigned short | file_upl_data_6_B [] |
const unsigned short | file_upl_data_6_C [] |
const unsigned short | file_upl_data_6_D [] |
const unsigned short | file_upl_data_6_E [] |
const unsigned short | file_upl_start_7 [] |
const unsigned short | file_upl_data_7_A [] |
const unsigned short | file_upl_data_7_B [] |
const unsigned short | file_upl_data_7_C [] |
const unsigned short | file_upl_data_7_E [] |
const unsigned short | file_upl_commit_7 [] |
const unsigned short | file_upl_start_8 [] |
const unsigned short | file_upl_cancel_1 [] |
const unsigned short | file_upl_commit_8 [] |
FILE_Upl * | file_upl_desc |
unsigned char * | file_upl_buf |
FILE_Upl | file_upl_bad_desc |
static const char * | dumpLine |
static void file_upl_info | ( | FILE_Upl_Info * | info, | |
const char * | str | |||
) | [static] |
Prints the current state of the file upload state machine.
info | The state machine public information structure. | |
str | A message to display at top of printout. |
0 | Success. | |
-1 | Failure. |
References _FILE_Upl_Info::buf_addr, dumpLine, _FILE_Upl_Info::error_code, _FILE_Upl_Info::error_count, FILE_UPL_STATE_COMMIT, FILE_UPL_STATE_ERROR, FILE_UPL_STATE_LOAD, FILE_UPL_STATE_START, _FILE_Upl_Info::id_commit, _FILE_Upl_Info::offset_current, _FILE_Upl_Info::pkt_count, _FILE_Upl_Info::size_commit, _FILE_Upl_Info::size_current, _FILE_Upl_Info::size_total, and _FILE_Upl_Info::state.
Referenced by file_upl_test_err(), and file_upl_test_func().
static void file_upl_print | ( | FILE_Upl_Info * | info, | |
const char * | str | |||
) | [static] |
Displays the data held in the file upload assembly buffer.
info | The state machine public information structure. | |
str | A message to display at top of printout. |
0 | Success. | |
-1 | Failure. |
References _FILE_Upl_Info::buf_addr, dumpLine, FILE_UPL_SIZE, and _FILE_Upl_Info::size_total.
Referenced by file_upl_test_err(), and file_upl_test_func().
int file_upl_test_err | ( | void | ) |
Tests the error handling capabilities of the file upload state machine. A number of state, sequence, and formatting errors are induced, and the appropriate reaction checked for.
0 | Success. | |
-1 | Failure. |
References _FILE_Upl_Info::buf_addr, dumpLine, _FILE_Upl_Info::error_code, _FILE_Upl_Info::error_count, file_upl_buf, file_upl_cancel_1, file_upl_commit_0, file_upl_commit_7, file_upl_commit_8, file_upl_data_0_A, file_upl_data_3_A, file_upl_data_3_B, file_upl_data_6_A, file_upl_data_6_B, file_upl_data_6_C, file_upl_data_6_D, file_upl_data_6_E, file_upl_data_7_A, file_upl_data_7_B, file_upl_data_7_C, file_upl_data_7_E, file_upl_info(), file_upl_print(), FILE_UPL_SIZE, file_upl_start_0, file_upl_start_2, file_upl_start_3, file_upl_start_4, file_upl_start_5, file_upl_start_6, file_upl_start_7, file_upl_start_8, FILE_UPL_STATE_ERROR, FILE_UPL_STATE_LOAD, FILE_UPL_STATE_START, FILE_uplCommit(), FILE_uplExit(), FILE_uplInfo(), FILE_uplInit(), FILE_uplPkt(), FILE_uplReset(), FILE_uplSetError(), _FILE_Upl_Info::id_commit, _FILE_Upl_Info::offset_current, _FILE_Upl_Info::pkt_count, _FILE_Upl_Info::size_commit, _FILE_Upl_Info::size_current, _FILE_Upl_Info::size_total, and _FILE_Upl_Info::state.
Referenced by file_unit_test().
int file_upl_test_func | ( | void | ) |
Tests the basic functionality of the file upload state machine by invoking the library using some nominal file upload packet sample data sets.
0 | Success. | |
-1 | Failure. |
References _FILE_Upl_Info::buf_addr, dumpLine, _FILE_Upl_Info::error_code, _FILE_Upl_Info::error_count, file_upl_buf, file_upl_cancel_0, file_upl_commit_0, file_upl_commit_1, file_upl_data_0, file_upl_data_0_A, file_upl_data_0_B, file_upl_data_0_C, file_upl_data_0_D, file_upl_data_0_E, file_upl_data_0_size, file_upl_data_1, file_upl_data_1_A, file_upl_data_1_B, file_upl_data_1_C, file_upl_data_1_D, file_upl_data_1_E, file_upl_data_1_F, file_upl_data_1_G, file_upl_data_1_size, file_upl_info(), file_upl_print(), FILE_UPL_SIZE, file_upl_start_0, file_upl_start_1, FILE_UPL_STATE_COMMIT, FILE_UPL_STATE_LOAD, FILE_UPL_STATE_START, FILE_uplCommit(), FILE_uplData(), FILE_uplExit(), FILE_uplInfo(), FILE_uplInit(), FILE_uplPkt(), FILE_uplReset(), FILE_uplStart(), _FILE_Upl_Info::id_commit, _FILE_Upl_Info::offset_current, _FILE_Upl_Info::pkt_count, _FILE_Upl_Info::size_commit, _FILE_Upl_Info::size_current, _FILE_Upl_Info::size_total, and _FILE_Upl_Info::state.
Referenced by file_unit_test().
int file_upl_test_param | ( | void | ) |
Performs invalid and out of range tests on parameters for file_upl library functions.
0 | Success. | |
-1 | Failure |
References dumpLine, file_upl_buf, file_upl_data_0_A, file_upl_data_0_size, FILE_UPL_SIZE, file_upl_start_0, FILE_uplCancel(), FILE_uplCommit(), FILE_uplData(), FILE_uplExit(), FILE_uplInfo(), FILE_uplInit(), FILE_uplPkt(), FILE_uplReset(), FILE_uplSetError(), and FILE_uplStart().
Referenced by file_unit_test().
dumpLine [static] |
Initial value:
"-------------------------------------------------------------------------------\n"
A bad upload object for error testing.
unsigned char* file_upl_buf |
A pointer to the file upload assembly buf.
Referenced by file_unit_test(), file_upl_test_err(), file_upl_test_func(), and file_upl_test_param().
const unsigned short file_upl_cancel_0[] |
A binary image of an upload cancel telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_cancel_1[] |
A binary image of an upload cancel telecommand packet.
CCSDS size = 10 (too small)
A binary image of an upload cancel telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_commit_0[] |
A binary image of an upload commit telecommand packet.
file ID = 0x20c1941f
A binary image of an upload commit telecommand packet.
Referenced by file_upl_test_err(), and file_upl_test_func().
const unsigned short file_upl_commit_1[] |
A binary image of an upload commit telecommand packet.
file ID = 0x49800016
A binary image of an upload commit telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_commit_7[] |
A binary image of an upload commit telecommand packet.
file ID = 0x20c1941f
A binary image of an upload commit telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_commit_8[] |
A binary image of an upload commit telecommand packet.
CCSDS size = 10 (too small)
A binary image of an upload commit telecommand packet.
Referenced by file_upl_test_err().
unsigned short file_upl_data_0[] |
A binary image of a sample file. Contained in packets file_upl_data_0_X.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_0_A[] |
A binary image of an upload data telecommand packet.
offset = 0 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err(), file_upl_test_func(), and file_upl_test_param().
const unsigned short file_upl_data_0_B[] |
A binary image of an upload data telecommand packet.
offset = 48 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_0_C[] |
A binary image of an upload data telecommand packet.
offset = 96 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_0_D[] |
A binary image of an upload data telecommand packet.
offset = 144 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_0_E[] |
A binary image of an upload data telecommand packet.
offset = 192 size = 16
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned int file_upl_data_0_size |
The size in bytes of data set file_upl_data_0.
Referenced by file_upl_test_func(), and file_upl_test_param().
unsigned short file_upl_data_1[] |
A binary image of a sample file. Contained in packets file_upl_data_1_X.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_A[] |
A binary image of an upload data telecommand packet.
offset = 0 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_B[] |
A binary image of an upload data telecommand packet.
offset = 48 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_C[] |
A binary image of an upload data telecommand packet.
offset = 96 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_D[] |
A binary image of an upload data telecommand packet.
offset = 144 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_E[] |
A binary image of an upload data telecommand packet.
offset = 192 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_F[] |
A binary image of an upload data telecommand packet.
offset = 240 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_1_G[] |
A binary image of an upload data telecommand packet.
offset = 288 size = 6
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_func().
const unsigned int file_upl_data_1_size |
The size in bytes of data set file_upl_data_1.
Referenced by file_upl_test_func().
const unsigned short file_upl_data_3_A[] |
A binary image of an upload data telecommand packet.
offset = 0 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_3_B[] |
A binary image of an upload data telecommand packet.
offset = 1000 (out of bounds) data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_6_A[] |
A binary image of an upload data telecommand packet.
offset = 0 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_6_B[] |
A binary image of an upload data telecommand packet.
offset = 48 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_6_C[] |
A binary image of an upload data telecommand packet.
offset = 96 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_6_D[] |
A binary image of an upload data telecommand packet.
offset = 144 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_6_E[] |
A binary image of an upload data telecommand packet.
offset = 192 size = 20 (out of bounds)
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_7_A[] |
A binary image of an upload data telecommand packet.
offset = 0 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_7_B[] |
A binary image of an upload data telecommand packet.
offset = 48 data size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_7_C[] |
A binary image of an upload data telecommand packet.
offset = 96 size = 48
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_data_7_E[] |
A binary image of an upload data telecommand packet.
offset = 192 size = 16
A binary image of an upload data telecommand packet.
Referenced by file_upl_test_err().
A pointer to the file upload descriptor.
const unsigned short file_upl_start_0[] |
A binary image of an upload start telecommand packet.
data pkt count = 5 file size = 208
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err(), file_upl_test_func(), and file_upl_test_param().
const unsigned short file_upl_start_1[] |
A binary image of an upload start telecommand packet.
data pkt count = 7 file size = 294
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_func().
const unsigned short file_upl_start_2[] |
A binary image of an upload start telecommand packet.
file size = 1 MB (too large)
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_start_3[] |
A binary image of an upload start telecommand packet.
data pkt count = 5 file size = 208
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_start_4[] |
A binary image of an upload start telecommand packet.
APID = 0 (not a file upload telecommand)
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_start_5[] |
A binary image of an upload start telecommand packet.
Func code = 10 (not a file upload telecommand)
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_start_6[] |
A binary image of an upload start telecommand packet.
data pkt count = 5 file size = 208
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_start_7[] |
A binary image of an upload start telecommand packet.
data pkt count = 5 file size = 208
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().
const unsigned short file_upl_start_8[] |
A binary image of an upload start telecommand packet.
CCSDS size = 4 (too small)
A binary image of an upload start telecommand packet.
Referenced by file_upl_test_err().