RTEMS 6.1-rc1
Data Structures | Macros | Typedefs | Functions | Variables

This source file contains the implementation of tests for libtftpfs. More...

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <unistd.h>
#include <rtems/tftp.h>
#include <rtems/libio.h>
#include <rtems/test.h>
#include <rtems/test-info.h>
#include <rtems/testopts.h>
#include <rtems.h>
#include "tftpfs_udp_network_fake.h"
#include "tftpfs_interactions.h"
#include "tftp_driver.h"
#include <rtems/confdefs.h>

Data Structures

struct  tftp_test_context
 

Macros

#define SERV_PORT   12345
 
#define FIRST_TIMEOUT_MILLISECONDS   400
 
#define TIMEOUT_MILLISECONDS   1000
 
#define LARGE_BLOCK_SIZE   TFTP_BLOCK_SIZE_MAX
 
#define SMALL_BLOCK_SIZE   12
 
#define SMALL_WINDOW_SIZE   4
 
#define T_no_more_interactions()
 
#define CONFIGURE_FILESYSTEM_TFTPFS
 
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS   4
 
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 
#define CONFIGURE_MAXIMUM_TASKS   1
 
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
 
#define CONFIGURE_INIT_TASK_ATTRIBUTES   RTEMS_FLOATING_POINT
 
#define CONFIGURE_INIT
 

Typedefs

typedef struct tftp_test_context tftp_test_context
 

Functions

 T_TEST_CASE (tftp_initialize_net_config)
 
 T_TEST_CASE (tftp_initialize_net_config_null)
 
 T_TEST_CASE_FIXTURE (tftp_open_null_hostname, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (tftp_open_null_filename, &fixture_rfc1350)
 
 T_TEST_CASE (tftp_open_null_tftp_handle)
 
 T_TEST_CASE_FIXTURE (tftp_open_illegal_window_size, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (tftp_open_block_size_too_small, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (tftp_open_block_size_too_large, &fixture_rfc1350)
 
 T_TEST_CASE (tftp_read_null_tftp_handle)
 
 T_TEST_CASE (tftp_read_null_buffer)
 
 T_TEST_CASE (tftp_write_null_tftp_handle)
 
 T_TEST_CASE (tftp_write_null_buffer)
 
 T_TEST_CASE (tftp_close_null)
 
 T_TEST_CASE (_Tftpfs_Parse_options_empty)
 
 T_TEST_CASE (_Tftpfs_Parse_options_null)
 
 T_TEST_CASE (_Tftpfs_Parse_options_verbose)
 
 T_TEST_CASE (_Tftpfs_Parse_options_rfc1350)
 
 T_TEST_CASE (_Tftpfs_Parse_options_blocksize)
 
 T_TEST_CASE (_Tftpfs_Parse_options_windowsize)
 
 T_TEST_CASE (_Tftpfs_Parse_options_all)
 
 T_TEST_CASE (_Tftpfs_Parse_options_surplus_comma)
 
 T_TEST_CASE (_Tftpfs_Parse_options_bad_value)
 
 T_TEST_CASE (_Tftpfs_Parse_options_illegal_option)
 
 T_TEST_CASE (_Tftpfs_Parse_options_truncated_option)
 
 T_TEST_CASE_FIXTURE (mount_with_bad_options, &fixture_mount_point)
 
 T_TEST_CASE_FIXTURE (client_open_with_NULL_config, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (client_open_with_none_default_config, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (client_write_to_file_opened_for_reading, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (client_read_to_file_opened_for_writing, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (client_write_simple_file, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (read_simple_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_tiny_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_one_block_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_stray_packets, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_one_block_file_server_error, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_one_block_file_malformed_server_error, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_one_block_close_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_close_file_immediately, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_empty_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_empty_file_looing_rrq, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_small_file_lost_packets, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_small_file_malformed_packet_1, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_small_file_malformed_packet_2, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_malformed_ack_1, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_malformed_ack_2, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_malformed_ack_3, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_block_number_0, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_illegal_opcode_1, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_two_block_file_wrong_block_numbers, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_malformed_filename, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_from_unknown_ip_address, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_not_existing_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_empty_file_packet_losts, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_tiny_file_packet_losts, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_simple_file, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_simple_file_disk_full, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_file_malformed_ack_1, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_file_malformed_ack_2, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_file_malformed_ack_3, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_file_illegal_opcode_1, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_short_file_malformed_ACK_1, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_short_file_malformed_ACK_2, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_short_file_malformed_opcode, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_short_file_bad_block_numbers, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (write_one_block_file_stray_packets, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_one_large_block, &fixture_large_blocksize)
 
 T_TEST_CASE_FIXTURE (read_too_long_file_name, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (read_file_DATA_instead_of_OACK, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (read_tiny_file_OACK_instead_of_DATA, &fixture_rfc1350)
 
 T_TEST_CASE_FIXTURE (read_file_with_default_options, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (read_file_rfc7440_scenario, &fixture_small_opt_size)
 
 T_TEST_CASE_FIXTURE (read_file_windowsize_trouble, &fixture_small_opt_size)
 
 T_TEST_CASE_FIXTURE (write_simple_file_large_blocks, &fixture_large_blocksize)
 
 T_TEST_CASE_FIXTURE (write_simple_file_default_options, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (write_file_rfc7440_scenario, &fixture_small_opt_size)
 
 T_TEST_CASE_FIXTURE (write_file_windowsize_trouble, &fixture_small_opt_size)
 
 T_TEST_CASE_FIXTURE (write_tiny_file_OACK_no_options, &fixture_large_blocksize)
 
 T_TEST_CASE_FIXTURE (read_file_fallback_to_no_options, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (read_file_useless_fallback_to_no_options, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (write_file_ACK_instead_of_OACK, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (write_file_fallback_to_no_options, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_without_null, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_without_option_value, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_with_unknown_option, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_malformed_option_value, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_with_empty_option_value, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_with_empty_option_name, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_blocksize_too_small, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_blocksize_too_large, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_windowsize_too_small, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_windowsize_too_large, &fixture_default_options)
 
 T_TEST_CASE_FIXTURE (OACK_with_surplus_option, &fixture_large_blocksize)
 

Variables

const char rtems_test_name [] = "TFTPFS"
 Each test must define a test name string.
 

Detailed Description

This source file contains the implementation of tests for libtftpfs.

The tested source files are:

Macro Definition Documentation

◆ T_no_more_interactions

#define T_no_more_interactions ( )
Value:
T_assert_true( \
"The TFTP client skiped some final network interactions." \
)
bool _Tftp_Has_no_more_interactions(void)
Have all queued interactions been processed?
Definition: tftpfs_udp_network_fake.c:154