Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ydahhrk committed May 24, 2024
1 parent fc8a2c2 commit 4467b65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions test/cache/local_cache_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,35 @@ file_rm_rf(char const *file)
}

static int
pretend_download(struct rpki_uri *uri)
pretend_download(char const *local)
{
struct downloaded_path *dl;

if (dl_error)
return -EINVAL;
if (file_exists(uri_get_local(uri)) == 0)
if (file_exists(local) == 0)
return 0;

dl = pmalloc(sizeof(struct downloaded_path));
dl->path = pstrdup(uri_get_local(uri));
dl->path = pstrdup(local);
dl->visited = false;
SLIST_INSERT_HEAD(&downloaded, dl, hook);
return 0;
}

int
rsync_download(struct rpki_uri *uri)
rsync_download(char const *src, char const *dst, bool is_directory)
{
rsync_counter++;
return pretend_download(uri);
return pretend_download(dst);
}

int
http_download(struct rpki_uri *uri, bool *changed)
{
int error;
https_counter++;
error = pretend_download(uri);
error = pretend_download(uri_get_local(uri));
if (changed != NULL)
*changed = error ? false : true;
return error;
Expand Down
3 changes: 2 additions & 1 deletion test/rrdp_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ MOCK_ABORT_INT(cache_download, struct rpki_cache *cache, struct rpki_uri *uri,
bool *changed)
MOCK_ABORT_VOID(file_close, FILE *file)
MOCK_ABORT_INT(file_rm_rf, char const *path)
MOCK_ABORT_INT(file_write, char const *file_name, FILE **result)
MOCK_ABORT_INT(file_write, char const *file_name, char const *mode,
FILE **result)
MOCK_ABORT_INT(delete_dir_recursive_bottom_up, char const *path)
MOCK_ABORT_INT(mkdir_p, char const *path, bool include_basename)
MOCK_ABORT_VOID(fnstack_pop, void)
Expand Down

0 comments on commit 4467b65

Please sign in to comment.