OpenVPN
|
#include <stdint.h>
#include <setjmp.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cmocka.h>
#include <cmocka_private.h>
Go to the source code of this file.
Data Structures | |
union | ValuePointer |
struct | ListNode |
struct | MallocBlockInfo |
struct | TestState |
struct | SymbolValue |
struct | SymbolMapValue |
struct | FuncOrderingValue |
struct | CheckIntegerRange |
struct | CheckIntegerSet |
struct | CheckMemoryData |
struct | ExceptionCodeInfo |
struct | CMUnitTestState |
Macros | |
#define | MALLOC_GUARD_SIZE 16 |
#define | MALLOC_GUARD_PATTERN 0xEF |
#define | MALLOC_ALLOC_PATTERN 0xBA |
#define | MALLOC_FREE_PATTERN 0xCD |
#define | MALLOC_ALIGNMENT sizeof(size_t) |
#define | SOURCE_LOCATION_FORMAT "%s:%u" |
#define | CMOCKA_THREAD |
#define | CMOCKA_CLOCK_GETTIME(clock_id, ts) |
#define | cm_jmp_buf jmp_buf |
POSIX has sigsetjmp/siglongjmp, while Windows only has setjmp/longjmp. More... | |
#define | cm_setjmp(env) setjmp(env) |
#define | cm_longjmp(env, val) longjmp(env, val) |
#define | declare_initialize_value_pointer_pointer(name, ptr) |
#define | declare_initialize_value_pointer_value(name, val) |
#define | cast_largest_integral_type_to_pointer(pointer_type, largest_integral_type) ((pointer_type)((ValuePointer*)&(largest_integral_type))->x.pointer) |
#define | EXCEPTION_CODE_INFO(exception_code) {exception_code, #exception_code} |
#define | malloc test_malloc |
#define | free test_free |
#define | realloc test_realloc |
#define | malloc test_malloc |
#define | free test_free |
#define | realloc test_realloc |
Typedefs | |
typedef union ValuePointer | ValuePointer |
typedef struct ListNode | ListNode |
typedef struct MallocBlockInfo | MallocBlockInfo |
typedef struct TestState | TestState |
typedef int(* | EqualityFunction) (const void *left, const void *right) |
typedef struct SymbolValue | SymbolValue |
typedef struct SymbolMapValue | SymbolMapValue |
typedef struct FuncOrderingValue | FuncOrderingValue |
typedef void(* | CleanupListValue) (const void *value, void *cleanup_value_data) |
typedef struct CheckIntegerRange | CheckIntegerRange |
typedef struct CheckIntegerSet | CheckIntegerSet |
typedef struct CheckMemoryData | CheckMemoryData |
typedef struct ExceptionCodeInfo | ExceptionCodeInfo |
Enumerations | |
enum | CMUnitTestStatus { CM_TEST_NOT_STARTED, CM_TEST_PASSED, CM_TEST_FAILED, CM_TEST_ERROR, CM_TEST_SKIPPED } |
enum | cm_printf_type { PRINTF_TEST_START, PRINTF_TEST_SUCCESS, PRINTF_TEST_FAILURE, PRINTF_TEST_ERROR, PRINTF_TEST_SKIPPED } |
Functions | |
static ListNode * | list_initialize (ListNode *const node) |
static ListNode * | list_add (ListNode *const head, ListNode *new_node) |
static ListNode * | list_add_value (ListNode *const head, const void *value, const int count) |
static ListNode * | list_remove (ListNode *const node, const CleanupListValue cleanup_value, void *const cleanup_value_data) |
static void | list_remove_free (ListNode *const node, const CleanupListValue cleanup_value, void *const cleanup_value_data) |
static int | list_empty (const ListNode *const head) |
static int | list_find (ListNode *const head, const void *value, const EqualityFunction equal_func, ListNode **output) |
static int | list_first (ListNode *const head, ListNode **output) |
static ListNode * | list_free (ListNode *const head, const CleanupListValue cleanup_value, void *const cleanup_value_data) |
static void | add_symbol_value (ListNode *const symbol_map_head, const char *const symbol_names[], const size_t number_of_symbol_names, const void *value, const int count) |
static int | get_symbol_value (ListNode *const symbol_map_head, const char *const symbol_names[], const size_t number_of_symbol_names, void **output) |
static void | free_value (const void *value, void *cleanup_value_data) |
static void | free_symbol_map_value (const void *value, void *cleanup_value_data) |
static void | remove_always_return_values (ListNode *const map_head, const size_t number_of_symbol_names) |
static int | check_for_leftover_values_list (const ListNode *head, const char *const error_message) |
static int | check_for_leftover_values (const ListNode *const map_head, const char *const error_message, const size_t number_of_symbol_names) |
static void | remove_always_return_values_from_list (ListNode *const map_head) |
Taverse a list of nodes and remove first symbol value in list that has a refcount < -1 (i.e. More... | |
static void | initialize_testing (const char *test_name) |
static void | teardown_testing (const char *test_name) |
static enum cm_message_output | cm_get_output (void) |
void | cm_print_error (const char *const format,...) CMOCKA_PRINTF_ATTRIBUTE(1 |
static void | exit_test (const int quit_application) |
void | _skip (const char *const file, const int line) |
static void | initialize_source_location (SourceLocation *const location) |
static int | source_location_is_set (const SourceLocation *const location) |
static void | set_source_location (SourceLocation *const location, const char *const file, const int line) |
static void | fail_if_leftover_values (const char *test_name) |
static int | symbol_names_match (const void *map_value, const void *symbol) |
LargestIntegralType | _mock (const char *const function, const char *const file, const int line) |
void | _function_called (const char *const function, const char *const file, const int line) |
void | _will_return (const char *const function_name, const char *const file, const int line, const LargestIntegralType value, const int count) |
void | _expect_check (const char *const function, const char *const parameter, const char *const file, const int line, const CheckParameterValue check_function, const LargestIntegralType check_data, CheckParameterEvent *const event, const int count) |
void | _expect_function_call (const char *const function_name, const char *const file, const int line, const int count) |
static int | values_equal_display_error (const LargestIntegralType left, const LargestIntegralType right) |
static int | values_not_equal_display_error (const LargestIntegralType left, const LargestIntegralType right) |
static int | value_in_set_display_error (const LargestIntegralType value, const CheckIntegerSet *const check_integer_set, const int invert) |
static int | integer_in_range_display_error (const LargestIntegralType value, const LargestIntegralType range_min, const LargestIntegralType range_max) |
static int | integer_not_in_range_display_error (const LargestIntegralType value, const LargestIntegralType range_min, const LargestIntegralType range_max) |
static int | string_equal_display_error (const char *const left, const char *const right) |
static int | string_not_equal_display_error (const char *const left, const char *const right) |
static int | memory_equal_display_error (const char *const a, const char *const b, const size_t size) |
static int | memory_not_equal_display_error (const char *const a, const char *const b, const size_t size) |
static int | check_in_set (const LargestIntegralType value, const LargestIntegralType check_value_data) |
static int | check_not_in_set (const LargestIntegralType value, const LargestIntegralType check_value_data) |
static void | expect_set (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType values[], const size_t number_of_values, const CheckParameterValue check_function, const int count) |
void | _expect_in_set (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType values[], const size_t number_of_values, const int count) |
void | _expect_not_in_set (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType values[], const size_t number_of_values, const int count) |
static int | check_in_range (const LargestIntegralType value, const LargestIntegralType check_value_data) |
static int | check_not_in_range (const LargestIntegralType value, const LargestIntegralType check_value_data) |
static void | expect_range (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType minimum, const LargestIntegralType maximum, const CheckParameterValue check_function, const int count) |
void | _expect_in_range (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType minimum, const LargestIntegralType maximum, const int count) |
void | _expect_not_in_range (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType minimum, const LargestIntegralType maximum, const int count) |
static int | check_value (const LargestIntegralType value, const LargestIntegralType check_value_data) |
void | _expect_value (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType value, const int count) |
static int | check_not_value (const LargestIntegralType value, const LargestIntegralType check_value_data) |
void | _expect_not_value (const char *const function, const char *const parameter, const char *const file, const int line, const LargestIntegralType value, const int count) |
static int | check_string (const LargestIntegralType value, const LargestIntegralType check_value_data) |
void | _expect_string (const char *const function, const char *const parameter, const char *const file, const int line, const char *string, const int count) |
static int | check_not_string (const LargestIntegralType value, const LargestIntegralType check_value_data) |
void | _expect_not_string (const char *const function, const char *const parameter, const char *const file, const int line, const char *string, const int count) |
static int | check_memory (const LargestIntegralType value, const LargestIntegralType check_value_data) |
static void | expect_memory_setup (const char *const function, const char *const parameter, const char *const file, const int line, const void *const memory, const size_t size, const CheckParameterValue check_function, const int count) |
void | _expect_memory (const char *const function, const char *const parameter, const char *const file, const int line, const void *const memory, const size_t size, const int count) |
static int | check_not_memory (const LargestIntegralType value, const LargestIntegralType check_value_data) |
void | _expect_not_memory (const char *const function, const char *const parameter, const char *const file, const int line, const void *const memory, const size_t size, const int count) |
static int | check_any (const LargestIntegralType value, const LargestIntegralType check_value_data) |
void | _expect_any (const char *const function, const char *const parameter, const char *const file, const int line, const int count) |
void | _check_expected (const char *const function_name, const char *const parameter_name, const char *file, const int line, const LargestIntegralType value) |
void | mock_assert (const int result, const char *const expression, const char *const file, const int line) |
Function to replace assert(3) in tested code. More... | |
void | _assert_true (const LargestIntegralType result, const char *const expression, const char *const file, const int line) |
void | _assert_return_code (const LargestIntegralType result, size_t rlen, const LargestIntegralType error, const char *const expression, const char *const file, const int line) |
void | _assert_int_equal (const LargestIntegralType a, const LargestIntegralType b, const char *const file, const int line) |
void | _assert_int_not_equal (const LargestIntegralType a, const LargestIntegralType b, const char *const file, const int line) |
void | _assert_string_equal (const char *const a, const char *const b, const char *const file, const int line) |
void | _assert_string_not_equal (const char *const a, const char *const b, const char *file, const int line) |
void | _assert_memory_equal (const void *const a, const void *const b, const size_t size, const char *const file, const int line) |
void | _assert_memory_not_equal (const void *const a, const void *const b, const size_t size, const char *const file, const int line) |
void | _assert_in_range (const LargestIntegralType value, const LargestIntegralType minimum, const LargestIntegralType maximum, const char *const file, const int line) |
void | _assert_not_in_range (const LargestIntegralType value, const LargestIntegralType minimum, const LargestIntegralType maximum, const char *const file, const int line) |
void | _assert_in_set (const LargestIntegralType value, const LargestIntegralType values[], const size_t number_of_values, const char *const file, const int line) |
void | _assert_not_in_set (const LargestIntegralType value, const LargestIntegralType values[], const size_t number_of_values, const char *const file, const int line) |
static ListNode * | get_allocated_blocks_list () |
static void * | libc_malloc (size_t size) |
static void | libc_free (void *ptr) |
static void * | libc_realloc (void *ptr, size_t size) |
static void | vcm_print_error (const char *const format, va_list args) CMOCKA_PRINTF_ATTRIBUTE(1 |
static void | vcm_free_error (char *err_msg) |
void * | _test_malloc (const size_t size, const char *file, const int line) |
void * | _test_calloc (const size_t number_of_elements, const size_t size, const char *file, const int line) |
void | _test_free (void *const ptr, const char *file, const int line) |
void * | _test_realloc (void *ptr, const size_t size, const char *file, const int line) |
static const ListNode * | check_point_allocated_blocks () |
static int | display_allocated_blocks (const ListNode *const check_point) |
static void | free_allocated_blocks (const ListNode *const check_point) |
static void | fail_if_blocks_allocated (const ListNode *const check_point, const char *const test_name) |
void | _fail (const char *const file, const int line) |
static LONG WINAPI | exception_filter (EXCEPTION_POINTERS *exception_pointers) |
void | vprint_message (const char *const format, va_list args) |
void | vprint_error (const char *const format, va_list args) |
void | print_message (const char *const format,...) |
void | print_error (const char *const format,...) |
static void | cmprintf_group_finish_xml (const char *group_name, size_t total_executed, size_t total_failed, size_t total_errors, size_t total_skipped, double total_runtime, struct CMUnitTestState *cm_tests) |
static void | cmprintf_group_start_standard (const size_t num_tests) |
static void | cmprintf_group_finish_standard (size_t total_executed, size_t total_passed, size_t total_failed, size_t total_errors, size_t total_skipped, struct CMUnitTestState *cm_tests) |
static void | cmprintf_standard (enum cm_printf_type type, const char *test_name, const char *error_message) |
static void | cmprintf_group_start_tap (const size_t num_tests) |
static void | cmprintf_group_finish_tap (const char *group_name, size_t total_executed, size_t total_passed, size_t total_skipped) |
static void | cmprintf_tap (enum cm_printf_type type, uint32_t test_number, const char *test_name, const char *error_message) |
static void | cmprintf_subunit (enum cm_printf_type type, const char *test_name, const char *error_message) |
static void | cmprintf_group_start (const size_t num_tests) |
static void | cmprintf_group_finish (const char *group_name, size_t total_executed, size_t total_passed, size_t total_failed, size_t total_errors, size_t total_skipped, double total_runtime, struct CMUnitTestState *cm_tests) |
static void | cmprintf (enum cm_printf_type type, size_t test_number, const char *test_name, const char *error_message) |
void | cmocka_set_message_output (enum cm_message_output output) |
Function to set the output format for a test. More... | |
static int | cmocka_run_one_test_or_fixture (const char *function_name, CMUnitTestFunction test_func, CMFixtureFunction setup_func, CMFixtureFunction teardown_func, void **const volatile state, const void *const heap_check_point) |
static int | cmocka_run_group_fixture (const char *function_name, CMFixtureFunction setup_func, CMFixtureFunction teardown_func, void **state, const void *const heap_check_point) |
static int | cmocka_run_one_tests (struct CMUnitTestState *test_state) |
int | _cmocka_run_group_tests (const char *group_name, const struct CMUnitTest *const tests, const size_t num_tests, CMFixtureFunction group_setup, CMFixtureFunction group_teardown) |
int | _run_test (const char *const function_name, const UnitTestFunction Function, void **const volatile state, const UnitTestFunctionType function_type, const void *const heap_check_point) |
int | _run_tests (const UnitTest *const tests, const size_t number_of_tests) |
int | _run_group_tests (const UnitTest *const tests, const size_t number_of_tests) |
Variables | |
static int | cm_error_message_enabled = 1 |
static CMOCKA_THREAD char * | cm_error_message |
void static CMOCKA_THREAD cm_jmp_buf | global_run_test_env |
static CMOCKA_THREAD int | global_running_test = 0 |
jmp_buf | global_expect_assert_env |
int | global_expecting_assert = 0 |
const char * | global_last_failed_assert = NULL |
static int | global_skip_test |
static CMOCKA_THREAD ListNode | global_function_result_map_head |
static CMOCKA_THREAD SourceLocation | global_last_mock_value_location |
static CMOCKA_THREAD ListNode | global_function_parameter_map_head |
static CMOCKA_THREAD SourceLocation | global_last_parameter_location |
static CMOCKA_THREAD ListNode | global_call_ordering_head |
static CMOCKA_THREAD SourceLocation | global_last_call_ordering_location |
static CMOCKA_THREAD ListNode | global_allocated_blocks |
static enum cm_message_output | global_msg_output = CM_OUTPUT_STDOUT |
static LPTOP_LEVEL_EXCEPTION_FILTER | previous_exception_filter |
static const ExceptionCodeInfo | exception_codes [] |
#define cast_largest_integral_type_to_pointer | ( | pointer_type, | |
largest_integral_type | |||
) | ((pointer_type)((ValuePointer*)&(largest_integral_type))->x.pointer) |
Definition at line 123 of file cmocka.c.
Referenced by check_in_range(), check_in_set(), check_memory(), check_not_in_range(), check_not_in_set(), check_not_memory(), check_not_string(), and check_string().
#define cm_jmp_buf jmp_buf |
#define cm_longjmp | ( | env, | |
val | |||
) | longjmp(env, val) |
Definition at line 101 of file cmocka.c.
Referenced by exit_test().
#define cm_setjmp | ( | env | ) | setjmp(env) |
Definition at line 100 of file cmocka.c.
Referenced by _run_test(), and cmocka_run_one_test_or_fixture().
#define CMOCKA_CLOCK_GETTIME | ( | clock_id, | |
ts | |||
) |
Definition at line 88 of file cmocka.c.
Referenced by cmocka_run_one_tests().
#define declare_initialize_value_pointer_pointer | ( | name, | |
ptr | |||
) |
Definition at line 109 of file cmocka.c.
Referenced by _expect_not_string(), _expect_string(), expect_memory_setup(), expect_range(), and expect_set().
#define declare_initialize_value_pointer_value | ( | name, | |
val | |||
) |
#define EXCEPTION_CODE_INFO | ( | exception_code | ) | {exception_code, #exception_code} |
#define free test_free |
Definition at line 1850 of file cmocka.c.
Referenced by _check_expected(), _mock(), _run_group_tests(), _run_tests(), _test_free(), AsyncPipeOp(), auth_set_client_reason(), auth_token_test_session_mismatch(), auth_token_test_timeout(), buffer_list_aggregate_separator(), buffer_list_file(), buffer_list_free(), buffer_list_pop(), buffer_list_reset(), buffer_overflow(), buffer_underflow(), CAPI_DATA_free(), ccs_delete_config_file(), ccs_delete_deferred_ret_file(), cert_hash_free(), check_file_access(), cipher_kt_block_size(), close_syslog(), close_tun(), command_line_free(), DllMain(), do_close_tls(), do_open_tun(), do_setenv_x509(), env_set_destroy(), establish_http_proxy_passthru(), EvaluateTUNTAPAdapters(), EVP_MD_CTX_free(), ExecCommand(), find_adapters(), fork_to_self(), fragment_free(), free_allocated_blocks(), free_buf(), free_buf_gc(), free_context(), free_context_buffers(), free_symbol_map_value(), free_value(), FreeStartupData(), FreeWaitHandles(), frequency_limit_free(), generate_auth_token(), get_addr_generic(), get_console_input_win32(), get_net_adapter_guid(), get_proxy_authenticate(), get_reg_string(), get_sig_from_man(), get_user_pass_cr(), GetBuiltinAdminGroupName(), GetStartupData(), GetTokenGroups(), group_teardown(), HandleAddressMessage(), HandleBlockDNSMessage(), HandleDNSConfigMessage(), HandleEnableDHCPMessage(), HandleRouteMessage(), hash_free(), hash_remove_fast(), hash_remove_marked(), HMAC_CTX_free(), http_proxy_close(), ifconfig_pool_entry_free(), ifconfig_pool_free(), ifconfig_pool_persist_close(), init_ssl(), InterfaceLuid(), ipset2ascii_all(), IsAuthorizedUser(), key_method_2_read(), key_state_free(), key_state_rm_auth_control_files(), key_state_rm_auth_pending_file(), libc_free(), link_socket_close(), list_remove_free(), log_entry_free_contents(), log_history_close(), log_history_free_contents(), main(), make_base64_string2(), malloc_setup_test(), man_send_cc_message(), man_settings_close(), management_close(), mbuf_free(), mbuf_free_buf(), mroute_helper_free(), msi_format_field(), msi_format_record(), msi_get_record_string(), msi_get_string(), msica_arg_seq_free(), multi_instance_dec_refcount(), multi_learn_addr(), multi_reap_free(), multi_route_del(), multi_tcp_free(), multi_uninit(), mutate_ncp_cipher_list(), my_conv(), netsh_dns_cmd(), open_null(), openvpn_execve(), openvpn_plugin_client_destructor_v1(), openvpn_plugin_close_v1(), openvpn_plugin_func_v1(), openvpn_plugin_open_v3(), openvpn_plugin_string_list_item_free(), options_string(), packet_id_free(), pattern_not_found__returns_original(), perform_operation(), plugin_common_close(), plugin_list_close(), prestate_teardown(), prng_uninit(), ProcessDeferredAction(), read_string_alloc(), reliable_free(), remove_env_item(), RemoveListItem(), replace_longer_text__multiple_times__match_all_matches_are_replaced(), replace_single_char__multiple_times__match_all_matches_are_replaced(), replace_single_char__one_time__match_is_replaced(), RSA_meth_free(), rsa_priv_enc(), RunOpenvpn(), schedule_free(), schedule_remove_entry(), set_common_name(), set_win_sys_path(), SetDNSDomain(), setenv_str_incr(), setup_sequence(), show_available_curves(), socks_proxy_close(), split_scrv1_password(), ssl_purge_auth_challenge(), StartOpenVPNGUI(), status_close(), store_proxy_authenticate(), tap_free_adapter_list(), tap_list_adapters(), tap_set_adapter_name(), teardown(), teardown_only(), test_buffer_list_teardown(), test_order_hotdog(), test_packet_id_write_teardown(), test_tls_crypt_teardown(), test_tls_crypt_v2_teardown(), tls_item_in_cipher_list(), tls_multi_free(), tls_session_free(), Undo(), uninit_win32(), waiter_process(), we_free(), we_init(), wipe_auth_token(), wmain(), wmic_nicconfig_cmd(), x509_setenv(), x_gc_free(), x_gc_freespecial(), and x_msg_va().
#define malloc test_malloc |
Definition at line 1795 of file cmocka.c.
Referenced by _expect_check(), _expect_function_call(), _run_group_tests(), _run_tests(), _test_malloc(), _will_return(), add_symbol_value(), AddListItem(), AsyncPipeOp(), buffer_list_file(), buffer_overflow(), buffer_underflow(), clone_buf(), do_setenv_x509(), env_block(), expect_memory_setup(), expect_range(), expect_set(), find_adapters(), gc_addspecial(), gc_malloc(), get_console_input_win32(), get_device_reg_property(), get_reg_string(), GetBuiltinAdminGroupName(), GetStartupData(), GetTokenGroups(), group_setup(), HandleAddressMessage(), HandleBlockDNSMessage(), HandleEnableDHCPMessage(), HandleRouteMessage(), leak_memory(), libc_malloc(), list_add_value(), malloc_teardown_test(), management_query_multiline_flatten(), management_query_multiline_flatten_newline(), msi_format_record(), msi_get_record_string(), msi_get_string(), msica_arg_seq_add_head(), msica_arg_seq_add_tail(), msica_arg_seq_join(), netsh_dns_cmd(), open_null(), openvpn_base64_encode(), prestate_setup(), prng_init(), read_string_alloc(), rsa_priv_enc(), RunOpenvpn(), setup(), setup_ok(), setup_only(), StartOpenVPNGUI(), tap_list_adapters(), tap_set_adapter_name(), UpdateWaitHandles(), utf8to16(), wmain(), wmic_nicconfig_cmd(), x509_setenv(), and x_msg_va().
#define malloc test_malloc |
#define MALLOC_ALIGNMENT sizeof(size_t) |
Definition at line 72 of file cmocka.c.
Referenced by _test_malloc().
#define MALLOC_ALLOC_PATTERN 0xBA |
Definition at line 69 of file cmocka.c.
Referenced by _test_malloc().
#define MALLOC_FREE_PATTERN 0xCD |
Definition at line 70 of file cmocka.c.
Referenced by _test_free().
#define MALLOC_GUARD_PATTERN 0xEF |
Definition at line 67 of file cmocka.c.
Referenced by _test_free(), and _test_malloc().
#define MALLOC_GUARD_SIZE 16 |
Definition at line 65 of file cmocka.c.
Referenced by _test_free(), _test_malloc(), _test_realloc(), and free_allocated_blocks().
#define realloc test_realloc |
Definition at line 1891 of file cmocka.c.
Referenced by libc_realloc(), and UpdateWaitHandles().
#define realloc test_realloc |
#define SOURCE_LOCATION_FORMAT "%s:%u" |
Definition at line 75 of file cmocka.c.
Referenced by _check_expected(), _fail(), _function_called(), _mock(), _skip(), _test_free(), check_for_leftover_values(), check_for_leftover_values_list(), and display_allocated_blocks().
typedef struct CheckIntegerRange CheckIntegerRange |
typedef struct CheckIntegerSet CheckIntegerSet |
typedef struct CheckMemoryData CheckMemoryData |
typedef void(* CleanupListValue) (const void *value, void *cleanup_value_data) |
typedef int(* EqualityFunction) (const void *left, const void *right) |
typedef struct ExceptionCodeInfo ExceptionCodeInfo |
typedef struct FuncOrderingValue FuncOrderingValue |
typedef struct MallocBlockInfo MallocBlockInfo |
typedef struct SymbolMapValue SymbolMapValue |
typedef struct SymbolValue SymbolValue |
typedef union ValuePointer ValuePointer |
enum cm_printf_type |
enum CMUnitTestStatus |
|
static |
Definition at line 625 of file cmocka.c.
References assert_non_null, assert_true, list_add_value(), list_find(), list_initialize(), malloc, SymbolMapValue::symbol_name, symbol_names_match(), SymbolMapValue::symbol_values_list_head, and ListNode::value.
Referenced by _expect_check(), and _will_return().
|
static |
Definition at line 1458 of file cmocka.c.
Referenced by _expect_any().
|
static |
Definition at line 795 of file cmocka.c.
References assert_non_null, assert_true, cm_print_error(), SourceLocation::file, SourceLocation::line, list_empty(), ListNode::next, SOURCE_LOCATION_FORMAT, SymbolMapValue::symbol_name, SymbolMapValue::symbol_values_list_head, ValuePointer::value, and ListNode::value.
Referenced by fail_if_leftover_values().
|
static |
Definition at line 771 of file cmocka.c.
References cm_print_error(), SourceLocation::file, FuncOrderingValue::function, SourceLocation::line, list_empty(), FuncOrderingValue::location, ListNode::next, SOURCE_LOCATION_FORMAT, and ListNode::value.
Referenced by fail_if_leftover_values().
|
static |
Definition at line 1249 of file cmocka.c.
References assert_non_null, cast_largest_integral_type_to_pointer, integer_in_range_display_error(), CheckIntegerRange::maximum, and CheckIntegerRange::minimum.
Referenced by _expect_in_range().
|
static |
Definition at line 1185 of file cmocka.c.
References cast_largest_integral_type_to_pointer, and value_in_set_display_error().
Referenced by _expect_in_set().
|
static |
Definition at line 1391 of file cmocka.c.
References assert_non_null, cast_largest_integral_type_to_pointer, CheckMemoryData::memory, memory_equal_display_error(), and CheckMemoryData::size.
Referenced by _expect_memory().
|
static |
Definition at line 1261 of file cmocka.c.
References assert_non_null, cast_largest_integral_type_to_pointer, integer_not_in_range_display_error(), CheckIntegerRange::maximum, and CheckIntegerRange::minimum.
Referenced by _expect_not_in_range().
|
static |
Definition at line 1194 of file cmocka.c.
References cast_largest_integral_type_to_pointer, and value_in_set_display_error().
Referenced by _expect_not_in_set().
|
static |
Definition at line 1435 of file cmocka.c.
References assert_non_null, cast_largest_integral_type_to_pointer, CheckMemoryData::memory, memory_not_equal_display_error(), and CheckMemoryData::size.
Referenced by _expect_not_memory().
|
static |
Definition at line 1370 of file cmocka.c.
References cast_largest_integral_type_to_pointer, and string_not_equal_display_error().
Referenced by _expect_not_string().
|
static |
Definition at line 1331 of file cmocka.c.
References values_not_equal_display_error().
Referenced by _expect_not_value().
|
static |
Definition at line 1894 of file cmocka.c.
References get_allocated_blocks_list(), and ListNode::prev.
Referenced by _cmocka_run_group_tests(), _run_group_tests(), _run_test(), _run_tests(), cmocka_run_one_test_or_fixture(), and cmocka_run_one_tests().
|
static |
Definition at line 1348 of file cmocka.c.
References cast_largest_integral_type_to_pointer, and string_equal_display_error().
Referenced by _expect_string().
|
static |
Definition at line 1313 of file cmocka.c.
References values_equal_display_error().
Referenced by _expect_value().
|
static |
Definition at line 2072 of file cmocka.c.
References CM_OUTPUT_STDOUT, CM_OUTPUT_SUBUNIT, CM_OUTPUT_TAP, CM_OUTPUT_XML, global_msg_output, and strcasecmp.
Referenced by _fail(), cmprintf(), cmprintf_group_finish(), and cmprintf_group_start().
void cm_print_error | ( | const char *const | format, |
... | |||
) |
Definition at line 2021 of file cmocka.c.
References cm_error_message_enabled, vcm_print_error(), and vprint_error().
Referenced by _assert_return_code(), _assert_true(), _check_expected(), _fail(), _function_called(), _mock(), _skip(), _test_free(), check_for_leftover_values(), check_for_leftover_values_list(), cmocka_run_one_tests(), display_allocated_blocks(), exception_filter(), fail_if_blocks_allocated(), get_symbol_value(), integer_in_range_display_error(), integer_not_in_range_display_error(), memory_equal_display_error(), memory_not_equal_display_error(), mock_assert(), string_equal_display_error(), string_not_equal_display_error(), value_in_set_display_error(), values_equal_display_error(), and values_not_equal_display_error().
|
static |
Definition at line 2578 of file cmocka.c.
References cmocka_run_one_test_or_fixture().
Referenced by _cmocka_run_group_tests().
|
static |
Definition at line 2489 of file cmocka.c.
References ARRAY_SIZE, check_point_allocated_blocks(), cm_setjmp, exception_filter(), fail_if_blocks_allocated(), fail_if_leftover_values(), initialize_testing(), IsDebuggerPresent(), and teardown_testing().
Referenced by cmocka_run_group_fixture(), and cmocka_run_one_tests().
|
static |
Definition at line 2605 of file cmocka.c.
References CMUnitTestState::check_point, check_point_allocated_blocks(), cm_error_message, cm_print_error(), CM_TEST_ERROR, CM_TEST_FAILED, CM_TEST_PASSED, CM_TEST_SKIPPED, CMOCKA_CLOCK_GETTIME, cmocka_run_one_test_or_fixture(), CMUnitTestState::error_message, CMUnitTest::name, CMUnitTestState::runtime, CMUnitTest::setup_func, CMUnitTestState::state, CMUnitTestState::status, CMUnitTest::teardown_func, CMUnitTestState::test, and CMUnitTest::test_func.
Referenced by _cmocka_run_group_tests().
|
static |
Definition at line 2407 of file cmocka.c.
References cm_get_output(), CM_OUTPUT_STDOUT, CM_OUTPUT_SUBUNIT, CM_OUTPUT_TAP, CM_OUTPUT_XML, cmprintf_standard(), cmprintf_subunit(), and cmprintf_tap().
Referenced by _cmocka_run_group_tests().
|
static |
Definition at line 2368 of file cmocka.c.
References cm_get_output(), CM_OUTPUT_STDOUT, CM_OUTPUT_SUBUNIT, CM_OUTPUT_TAP, CM_OUTPUT_XML, cmprintf_group_finish_standard(), cmprintf_group_finish_tap(), and cmprintf_group_finish_xml().
Referenced by _cmocka_run_group_tests().
|
static |
Definition at line 2186 of file cmocka.c.
References CM_TEST_FAILED, CM_TEST_SKIPPED, CMUnitTest::name, PRIdS, print_error(), print_message(), CMUnitTestState::status, and CMUnitTestState::test.
Referenced by cmprintf_group_finish().
|
static |
Definition at line 2259 of file cmocka.c.
References print_message(), and status.
Referenced by cmprintf_group_finish().
|
static |
Definition at line 2101 of file cmocka.c.
References CM_TEST_ERROR, CM_TEST_FAILED, CM_TEST_NOT_STARTED, CM_TEST_PASSED, CM_TEST_SKIPPED, CMUnitTestState::error_message, CMUnitTest::name, CMUnitTestState::runtime, snprintf, CMUnitTestState::status, and CMUnitTestState::test.
Referenced by cmprintf_group_finish().
|
static |
Definition at line 2348 of file cmocka.c.
References cm_get_output(), CM_OUTPUT_STDOUT, CM_OUTPUT_SUBUNIT, CM_OUTPUT_TAP, CM_OUTPUT_XML, cmprintf_group_start_standard(), and cmprintf_group_start_tap().
Referenced by _cmocka_run_group_tests().
|
static |
Definition at line 2180 of file cmocka.c.
References print_message().
Referenced by cmprintf_group_start().
|
static |
Definition at line 2254 of file cmocka.c.
References print_message().
Referenced by cmprintf_group_start().
|
static |
Definition at line 2225 of file cmocka.c.
References print_error(), print_message(), PRINTF_TEST_ERROR, PRINTF_TEST_FAILURE, PRINTF_TEST_SKIPPED, PRINTF_TEST_START, and PRINTF_TEST_SUCCESS.
Referenced by cmprintf().
|
static |
Definition at line 2322 of file cmocka.c.
References print_message(), PRINTF_TEST_ERROR, PRINTF_TEST_FAILURE, PRINTF_TEST_SKIPPED, PRINTF_TEST_START, and PRINTF_TEST_SUCCESS.
Referenced by cmprintf().
|
static |
Definition at line 2271 of file cmocka.c.
References libc_free(), msg, print_message(), PRINTF_TEST_ERROR, PRINTF_TEST_FAILURE, PRINTF_TEST_SKIPPED, PRINTF_TEST_START, and PRINTF_TEST_SUCCESS.
Referenced by cmprintf().
|
static |
Definition at line 1901 of file cmocka.c.
References assert_non_null, MallocBlockInfo::block, cm_print_error(), SourceLocation::file, get_allocated_blocks_list(), SourceLocation::line, MallocBlockInfo::location, ListNode::next, SOURCE_LOCATION_FORMAT, and ListNode::value.
Referenced by fail_if_blocks_allocated().
|
static |
Definition at line 1986 of file cmocka.c.
References ARRAY_SIZE, cm_print_error(), ExceptionCodeInfo::code, ExceptionCodeInfo::description, and exit_test().
Referenced by _run_test(), and cmocka_run_one_test_or_fixture().
|
static |
Definition at line 378 of file cmocka.c.
References cm_error_message, cm_longjmp, and print_error().
Referenced by _check_expected(), _fail(), _function_called(), _mock(), _run_group_tests(), _run_tests(), _skip(), exception_filter(), fail_if_blocks_allocated(), and fail_if_leftover_values().
|
static |
Definition at line 1404 of file cmocka.c.
References _expect_check(), assert_non_null, assert_true, declare_initialize_value_pointer_pointer, CheckMemoryData::event, malloc, CheckMemoryData::memory, and CheckMemoryData::size.
Referenced by _expect_memory(), and _expect_not_memory().
|
static |
Definition at line 1274 of file cmocka.c.
References _expect_check(), declare_initialize_value_pointer_pointer, CheckIntegerRange::event, malloc, CheckIntegerRange::maximum, and CheckIntegerRange::minimum.
Referenced by _expect_in_range(), and _expect_not_in_range().
|
static |
Definition at line 1204 of file cmocka.c.
References _expect_check(), assert_non_null, assert_true, declare_initialize_value_pointer_pointer, CheckIntegerSet::event, LargestIntegralType, malloc, CheckIntegerSet::set, and CheckIntegerSet::size_of_set.
Referenced by _expect_in_set(), and _expect_not_in_set().
|
static |
Definition at line 1944 of file cmocka.c.
References cm_print_error(), display_allocated_blocks(), exit_test(), and free_allocated_blocks().
Referenced by _cmocka_run_group_tests(), _run_group_tests(), _run_test(), _run_tests(), and cmocka_run_one_test_or_fixture().
|
static |
Definition at line 436 of file cmocka.c.
References check_for_leftover_values(), check_for_leftover_values_list(), exit_test(), remove_always_return_values(), and remove_always_return_values_from_list().
Referenced by _run_test(), and cmocka_run_one_test_or_fixture().
|
static |
Definition at line 1927 of file cmocka.c.
References assert_non_null, discard_const_p, free, get_allocated_blocks_list(), MALLOC_GUARD_SIZE, ListNode::next, and ListNode::value.
Referenced by fail_if_blocks_allocated().
|
static |
Definition at line 600 of file cmocka.c.
References assert_non_null, cast_ptr_to_largest_integral_type, free, free_value(), LargestIntegralType, list_free(), and SymbolMapValue::symbol_values_list_head.
Referenced by get_symbol_value(), and teardown_testing().
|
static |
Definition at line 592 of file cmocka.c.
References assert_non_null, and free.
Referenced by _function_called(), free_symbol_map_value(), remove_always_return_values(), remove_always_return_values_from_list(), and teardown_testing().
|
static |
Definition at line 1681 of file cmocka.c.
References global_allocated_blocks, and list_initialize().
Referenced by _test_malloc(), check_point_allocated_blocks(), display_allocated_blocks(), and free_allocated_blocks().
|
static |
Definition at line 665 of file cmocka.c.
References assert_non_null, assert_true, cm_print_error(), free_symbol_map_value(), list_empty(), list_find(), list_first(), list_remove_free(), ListNode::refcount, symbol_names_match(), SymbolMapValue::symbol_values_list_head, and ListNode::value.
Referenced by _check_expected(), and _mock().
|
static |
Definition at line 400 of file cmocka.c.
References assert_non_null, SourceLocation::file, and SourceLocation::line.
Referenced by initialize_testing(), and teardown_testing().
|
static |
Definition at line 425 of file cmocka.c.
References initialize_source_location(), and list_initialize().
Referenced by _run_test(), and cmocka_run_one_test_or_fixture().
|
static |
Definition at line 1074 of file cmocka.c.
References cm_print_error(), and PRIu64.
Referenced by _assert_in_range(), and check_in_range().
|
static |
Definition at line 1091 of file cmocka.c.
References cm_print_error(), and PRIu64.
Referenced by _assert_not_in_range(), and check_not_in_range().
|
static |
Definition at line 1697 of file cmocka.c.
References free.
Referenced by _cmocka_run_group_tests(), cmprintf_tap(), and vcm_free_error().
|
static |
Definition at line 1690 of file cmocka.c.
References malloc.
Referenced by _cmocka_run_group_tests(), and vcm_print_error().
|
static |
Definition at line 1704 of file cmocka.c.
References CMOCKA_PRINTF_ATTRIBUTE, realloc, and vcm_print_error().
Referenced by vcm_print_error().
Definition at line 503 of file cmocka.c.
References assert_non_null, ListNode::next, and ListNode::prev.
Referenced by _test_malloc(), and list_add_value().
|
static |
Definition at line 491 of file cmocka.c.
References assert_non_null, list_add(), malloc, ListNode::refcount, ValuePointer::value, and ListNode::value.
Referenced by _expect_function_call(), and add_symbol_value().
|
static |
Definition at line 555 of file cmocka.c.
References assert_non_null, and ListNode::next.
Referenced by check_for_leftover_values(), check_for_leftover_values_list(), get_symbol_value(), list_first(), list_free(), and remove_always_return_values().
|
static |
Definition at line 565 of file cmocka.c.
References assert_non_null, ListNode::next, and ListNode::value.
Referenced by add_symbol_value(), and get_symbol_value().
Definition at line 579 of file cmocka.c.
References assert_non_null, list_empty(), and ListNode::next.
Referenced by _function_called(), and get_symbol_value().
|
static |
Definition at line 543 of file cmocka.c.
References assert_non_null, list_empty(), list_remove_free(), and ListNode::next.
Referenced by free_symbol_map_value(), and teardown_testing().
Definition at line 478 of file cmocka.c.
References ListNode::next, ListNode::prev, ListNode::refcount, and ListNode::value.
Referenced by add_symbol_value(), get_allocated_blocks_list(), and initialize_testing().
|
static |
Definition at line 515 of file cmocka.c.
References assert_non_null, ListNode::next, ListNode::prev, and ListNode::value.
Referenced by _test_free(), and list_remove_free().
|
static |
Definition at line 529 of file cmocka.c.
References assert_non_null, free, and list_remove().
Referenced by _function_called(), get_symbol_value(), list_free(), remove_always_return_values(), and remove_always_return_values_from_list().
|
static |
Definition at line 1137 of file cmocka.c.
References cm_print_error(), and PRIdS.
Referenced by _assert_memory_equal(), and check_memory().
|
static |
Definition at line 1164 of file cmocka.c.
References cm_print_error(), and PRIdS.
Referenced by _assert_memory_not_equal(), and check_not_memory().
void print_error | ( | const char *const | format, |
... | |||
) |
Definition at line 2064 of file cmocka.c.
References vprint_error().
Referenced by _cmocka_run_group_tests(), _run_group_tests(), _run_tests(), cmprintf_group_finish_standard(), cmprintf_standard(), and exit_test().
void print_message | ( | const char *const | format, |
... | |||
) |
Definition at line 2056 of file cmocka.c.
References vprint_message().
Referenced by _run_group_tests(), _run_test(), _run_tests(), cmprintf_group_finish_standard(), cmprintf_group_finish_tap(), cmprintf_group_start_standard(), cmprintf_group_start_tap(), cmprintf_standard(), cmprintf_subunit(), and cmprintf_tap().
|
static |
Definition at line 738 of file cmocka.c.
References assert_non_null, assert_true, free_value(), list_empty(), list_remove_free(), ListNode::next, ListNode::refcount, SymbolMapValue::symbol_values_list_head, ValuePointer::value, and ListNode::value.
Referenced by fail_if_leftover_values().
|
static |
Taverse a list of nodes and remove first symbol value in list that has a refcount < -1 (i.e.
should always be returned and has been returned at least once).
Definition at line 718 of file cmocka.c.
References assert_non_null, free_value(), list_remove_free(), ListNode::next, and ListNode::refcount.
Referenced by fail_if_leftover_values().
|
static |
Definition at line 415 of file cmocka.c.
References assert_non_null, SourceLocation::file, and SourceLocation::line.
Referenced by _expect_check(), _expect_function_call(), _test_malloc(), and _will_return().
|
static |
Definition at line 408 of file cmocka.c.
References assert_non_null, SourceLocation::file, and SourceLocation::line.
Referenced by _check_expected(), and _mock().
|
static |
Definition at line 1108 of file cmocka.c.
References cm_print_error().
Referenced by _assert_string_equal(), and check_string().
|
static |
Definition at line 1123 of file cmocka.c.
References cm_print_error().
Referenced by _assert_string_not_equal(), and check_not_string().
|
static |
Definition at line 616 of file cmocka.c.
Referenced by add_symbol_value(), and get_symbol_value().
|
static |
Definition at line 464 of file cmocka.c.
References free_symbol_map_value(), free_value(), initialize_source_location(), and list_free().
Referenced by _run_test(), and cmocka_run_one_test_or_fixture().
|
static |
Definition at line 1038 of file cmocka.c.
References assert_non_null, cm_print_error(), LargestIntegralType, PRIu64, CheckIntegerSet::set, and CheckIntegerSet::size_of_set.
Referenced by _assert_in_set(), _assert_not_in_set(), check_in_set(), and check_not_in_set().
|
static |
Definition at line 1007 of file cmocka.c.
References cm_print_error(), and LargestIntegralTypePrintfFormat.
Referenced by _assert_int_equal(), and check_value().
|
static |
Definition at line 1020 of file cmocka.c.
References cm_print_error(), and LargestIntegralTypePrintfFormat.
Referenced by _assert_int_not_equal(), and check_not_value().
|
static |
Definition at line 1760 of file cmocka.c.
References libc_free().
Referenced by _cmocka_run_group_tests().
|
static |
Definition at line 1717 of file cmocka.c.
References cm_error_message, libc_malloc(), libc_realloc(), and vsnprintf.
Referenced by cm_print_error(), and libc_realloc().
void vprint_error | ( | const char *const | format, |
va_list | args | ||
) |
Definition at line 2045 of file cmocka.c.
References vsnprintf.
Referenced by cm_print_error(), and print_error().
void vprint_message | ( | const char *const | format, |
va_list | args | ||
) |
|
static |
Definition at line 264 of file cmocka.c.
Referenced by _cmocka_run_group_tests(), cmocka_run_one_tests(), exit_test(), and vcm_print_error().
|
static |
Definition at line 263 of file cmocka.c.
Referenced by _run_test(), and cm_print_error().
|
static |
|
static |
Definition at line 300 of file cmocka.c.
Referenced by get_allocated_blocks_list().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 302 of file cmocka.c.
Referenced by cm_get_output(), and cmocka_set_message_output().
|
static |
|
static |