[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Make things mockable for dump_desc_populate_fifo_from_directory() unit test
commit f99c9df02b6ac0c7804013bca951ecaf5744c2db
Author: Andrea Shepard <andrea@xxxxxxxxxxxxxx>
Date: Thu Jun 30 06:27:14 2016 +0000
Make things mockable for dump_desc_populate_fifo_from_directory() unit test
---
src/common/util.c | 4 ++--
src/common/util.h | 2 +-
src/or/routerparse.c | 4 ++--
src/or/routerparse.h | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/common/util.c b/src/common/util.c
index 97837f5..725e110 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3412,8 +3412,8 @@ smartlist_add_vasprintf(struct smartlist_t *sl, const char *pattern,
/** Return a new list containing the filenames in the directory <b>dirname</b>.
* Return NULL on error or if <b>dirname</b> is not a directory.
*/
-smartlist_t *
-tor_listdir(const char *dirname)
+MOCK_IMPL(smartlist_t *,
+tor_listdir, (const char *dirname))
{
smartlist_t *result;
#ifdef _WIN32
diff --git a/src/common/util.h b/src/common/util.h
index 157d25a..44f510c 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -377,7 +377,7 @@ const char *parse_config_line_from_str_verbose(const char *line,
char **key_out, char **value_out,
const char **err_out);
char *expand_filename(const char *filename);
-struct smartlist_t *tor_listdir(const char *dirname);
+MOCK_DECL(struct smartlist_t *, tor_listdir, (const char *dirname));
int path_is_relative(const char *filename);
/* Process helpers */
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index f3f003e..3436bfb 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -823,8 +823,8 @@ dump_desc_fifo_cleanup(void)
* the filename is sensibly formed and matches the file content, and either
* return a dumped_desc_t for it or remove the file and return NULL.
*/
-STATIC dumped_desc_t *
-dump_desc_populate_one_file(const char *dirname, const char *f)
+MOCK_IMPL(STATIC dumped_desc_t *,
+dump_desc_populate_one_file, (const char *dirname, const char *f))
{
dumped_desc_t *ent = NULL;
char *path = NULL, *desc = NULL;
diff --git a/src/or/routerparse.h b/src/or/routerparse.h
index 6167e51..131f158 100644
--- a/src/or/routerparse.h
+++ b/src/or/routerparse.h
@@ -107,8 +107,8 @@ STATIC int routerstatus_parse_guardfraction(const char *guardfraction_str,
networkstatus_t *vote,
vote_routerstatus_t *vote_rs,
routerstatus_t *rs);
-STATIC dumped_desc_t * dump_desc_populate_one_file(const char *dirname,
- const char *f);
+MOCK_DECL(STATIC dumped_desc_t *, dump_desc_populate_one_file,
+ (const char *dirname, const char *f));
STATIC void dump_desc(const char *desc, const char *type);
STATIC void dump_desc_fifo_cleanup(void);
#endif
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits