You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
1.6 KiB
87 lines
1.6 KiB
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <setjmp.h>
|
|
|
|
#include <cmocka.h>
|
|
|
|
#include <ftl.h>
|
|
|
|
int __wrap_is_group_erased(struct ftl_map *map, uint32_t group)
|
|
{
|
|
check_expected_ptr(map);
|
|
check_expected(group);
|
|
|
|
return mock_type(int);
|
|
}
|
|
|
|
int __wrap_find_block(struct ftl_map *map, struct ftl_page_group *group,
|
|
uint32_t *where, uint32_t block)
|
|
{
|
|
struct ftl_page_group *ret_group;
|
|
|
|
check_expected_ptr(map);
|
|
check_expected(block);
|
|
|
|
ret_group = mock_type(struct ftl_page_group *);
|
|
|
|
if (ret_group)
|
|
memcpy(group, ret_group, sizeof *group);
|
|
|
|
*where = mock_type(uint32_t);
|
|
|
|
return mock_type(int);
|
|
}
|
|
|
|
int __wrap_prepare_head(struct ftl_map *map)
|
|
{
|
|
(void)map;
|
|
|
|
return mock_type(int);
|
|
}
|
|
|
|
int __wrap_read_page_desc(struct ftl_map *map,
|
|
struct ftl_page_desc *page_desc, uint32_t upage)
|
|
{
|
|
check_expected_ptr(map);
|
|
check_expected(upage);
|
|
|
|
memcpy(page_desc, mock_type(struct ftl_page_desc *), sizeof *page_desc);
|
|
|
|
return mock_type(int);
|
|
}
|
|
|
|
int __wrap_write_page_desc(struct ftl_map *map,
|
|
struct ftl_page_desc *page_desc)
|
|
{
|
|
check_expected_ptr(map);
|
|
check_expected_ptr(page_desc);
|
|
|
|
return mock_type(int);
|
|
}
|
|
|
|
int __wrap_trace_path(struct ftl_map *map, struct ftl_page_desc *new_page_desc,
|
|
uint32_t *page, uint32_t va)
|
|
{
|
|
struct ftl_page_desc *ret_page_desc;
|
|
uint32_t ret_page;
|
|
|
|
check_expected_ptr(map);
|
|
check_expected_ptr(new_page_desc);
|
|
check_expected_ptr(page);
|
|
check_expected(va);
|
|
|
|
ret_page_desc = mock_type(struct ftl_page_desc *);
|
|
|
|
if (new_page_desc)
|
|
memcpy(new_page_desc, ret_page_desc, sizeof *new_page_desc);
|
|
|
|
ret_page = mock_type(uint32_t);
|
|
|
|
if (page)
|
|
*page = ret_page;
|
|
|
|
return mock_type(int);
|
|
}
|
|
|