![]() |
RTEMS 6.1-rc1
|
This test suite provides a tests for libtftpfs. More...
Files | |
| file | init.c |
| This source file contains the implementation of tests for libtftpfs. | |
| file | tftpfs_interactions.c |
| This source file contains the implementation of network interaction functions related to the UDP network fake for tftpfs testing. | |
| file | tftpfs_interactions.h |
| This header file provides functions used to implement network interactions of the UDP network fake for tftpfs tests. | |
| file | tftpfs_udp_network_fake.c |
| This source file contains the implementation of UDP network fake functions related to tftpfs testing. | |
| file | tftpfs_udp_network_fake.h |
| This header file provides interfaces and functions used to implement the UDP network fake for tftpfs tests. | |
Data Structures | |
| struct | Tftp_Action |
| struct | Tftp_Interaction |
| struct | Tftp_Packet |
Typedefs | |
| typedef enum Tftp_Action_kind | Tftp_Action_kind |
| typedef struct Tftp_Action | Tftp_Action |
| typedef bool(* | Tftp_Interaction_fn) (Tftp_Action *act, void *data) |
| Carry out interactions with TFTP client. More... | |
| typedef struct Tftp_Interaction | Tftp_Interaction |
| typedef enum Tftp_Opcode | Tftp_Opcode |
| typedef enum Tftp_Error_code | Tftp_Error_code |
| typedef struct Tftp_Packet | Tftp_Packet |
Functions | |
| void | _Tftp_Add_interaction_socket (int domain, int type, int protocol, int result) |
| void | _Tftp_Add_interaction_close (int fd, int result) |
| void | _Tftp_Add_interaction_bind (int fd, int family, int result) |
| void | _Tftp_Add_interaction_send_rrq (int fd, const char *filename, uint16_t dest_port, const char *dest_addr_str, uint16_t block_size, uint16_t window_size, bool result) |
| void | _Tftp_Add_interaction_send_wrq (int fd, const char *filename, uint16_t dest_port, const char *dest_addr_str, uint16_t block_size, uint16_t window_size, bool result) |
| void | _Tftp_Add_interaction_send_ack (int fd, uint16_t block_num, uint16_t dest_port, const char *dest_addr_str, bool result) |
| void | _Tftp_Add_interaction_send_data (int fd, uint16_t block_num, size_t start, size_t len, uint8_t(*get_data)(size_t pos), uint16_t dest_port, const char *dest_addr_str, bool result) |
| void | _Tftp_Add_interaction_send_error (int fd, uint16_t error_code, uint16_t dest_port, const char *dest_addr_str, bool result) |
| void | _Tftp_Add_interaction_recv_data (int fd, uint32_t timeout_ms, uint16_t src_port, const char *src_addr_str, uint16_t block_num, size_t start, size_t len, uint8_t(*get_data)(size_t pos), bool result) |
| void | _Tftp_Add_interaction_recv_ack (int fd, uint32_t timeout_ms, uint16_t src_port, const char *src_addr_str, uint16_t block_num, bool result) |
| void | _Tftp_Add_interaction_recv_oack (int fd, uint32_t timeout_ms, uint16_t src_port, const char *src_addr_str, const char *options, size_t options_size, bool result) |
| void | _Tftp_Add_interaction_recv_error (int fd, uint32_t timeout_ms, uint16_t src_port, const char *src_addr_str, uint16_t error_code, const char *err_msg, bool result) |
| void | _Tftp_Add_interaction_recv_raw (int fd, uint32_t timeout_ms, uint16_t src_port, const char *src_addr_str, size_t len, const uint8_t *bytes, bool result) |
| void | _Tftp_Add_interaction_recv_nothing (int fd, uint32_t timeout_ms) |
| void | _Tftp_Reset (void) |
| Initialize and free the singleton control object. More... | |
| void * | _Tftp_Append_interaction (Tftp_Action_kind kind, Tftp_Interaction_fn fn, size_t size) |
| Create an interaction and append it to the sequence of expected interactions. More... | |
| bool | _Tftp_Has_no_more_interactions (void) |
| Have all queued interactions been processed? More... | |
| const char * | _Tftp_Get_error_str (uint16_t error_code) |
| Provides a human readable description for an error code from an TFTP error packet. More... | |
This test suite provides a tests for libtftpfs.
There are some additional files relevant for the TFTP test suite:
spec/build/testsuites/fstests/grp.ymlspec/build/testsuites/fstests/tftpfs.ymlDoxygenINPUT the test suite is included to be processed by the Doxygen documentation generator.See also the RTEMS Filesystem Design Guide Chapter Trivial FTP Client Filesystem.
| typedef bool(* Tftp_Interaction_fn) (Tftp_Action *act, void *data) |
Carry out interactions with TFTP client.
Tftp_Interaction_fn() is called to
act)act)The function should not call T_assert_*() but use T_*(). Otherwise, it is unlikely that the test can terminate the client in teardown().
| [in,out] | act | The actual arguments provided by the TFTP client to the network function. Moreover, storage to store the results to be returned to the TFTP client. |
| data | Arbitrary data area allocated when the interaction is created by _Tftp_Append_interaction() |
| true | if the client behaved as expected. |
| false | if the test shall fail. |
| void * _Tftp_Append_interaction | ( | Tftp_Action_kind | kind, |
| Tftp_Interaction_fn | fn, | ||
| size_t | size | ||
| ) |
Create an interaction and append it to the sequence of expected interactions.
This allocates memory for an interaction and additional specific data for the function fn() parameter data. The interaction is initialized and appended at the end of the sequence of expected interactions. If an error occurs a T_assert_*() macro is called. Hence, this function never returns NULL.
| kind | Defines which interaction is expected. Note that it cannot happen that fn is called for a different network function. |
| fn | A function which is called to handle the interaction. See Tftp_Interaction_fn() |
| size | The size of a memory area which is given to fn() as data argument when it is invoked. This can be used to provide private data to the function. |
size. The same pointer will be provided to fn as argument data when invoked. | const char * _Tftp_Get_error_str | ( | uint16_t | error_code | ) |
Provides a human readable description for an error code from an TFTP error packet.
| error_code | The error code from the TFTP error packet in host byte order. |
| bool _Tftp_Has_no_more_interactions | ( | void | ) |
Have all queued interactions been processed?
At the end of a test, it should be checked whether all queued interactions have been consumed by the TFTP client.
| true | All queued interactions have been processed. |
| false | At least one queued interactions has not yet been processed. |
| void _Tftp_Reset | ( | void | ) |
Initialize and free the singleton control object.
Invoke _Tftp_Reset() in setup() and teardown() of the test.