[tor-commits] [tor/master] Make cpuworker_queue_work function mockable.
nickm at torproject.org
nickm at torproject.org
Mon Apr 24 15:05:42 UTC 2017
commit fe584f40127c5a8fc5b6f03b0d7901c5d443824a
Author: Nick Mathewson <nickm at torproject.org>
Date: Fri Apr 14 19:23:21 2017 -0400
Make cpuworker_queue_work function mockable.
I'll be using this in the unit tests for consdiffmgr.
---
src/or/cpuworker.c | 8 ++++----
src/or/cpuworker.h | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index f79cd06..af79faf 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -480,10 +480,10 @@ queue_pending_tasks(void)
}
/** DOCDOC */
-workqueue_entry_t *
-cpuworker_queue_work(workqueue_reply_t (*fn)(void *, void *),
- void (*reply_fn)(void *),
- void *arg)
+MOCK_IMPL(workqueue_entry_t *,
+cpuworker_queue_work,(workqueue_reply_t (*fn)(void *, void *),
+ void (*reply_fn)(void *),
+ void *arg))
{
tor_assert(threadpool);
diff --git a/src/or/cpuworker.h b/src/or/cpuworker.h
index 9bc5d96..aedf2fa 100644
--- a/src/or/cpuworker.h
+++ b/src/or/cpuworker.h
@@ -16,10 +16,10 @@ void cpu_init(void);
void cpuworkers_rotate_keyinfo(void);
struct workqueue_entry_s;
enum workqueue_reply_t;
-struct workqueue_entry_s *cpuworker_queue_work(
+MOCK_DECL(struct workqueue_entry_s *, cpuworker_queue_work, (
enum workqueue_reply_t (*fn)(void *, void *),
void (*reply_fn)(void *),
- void *arg);
+ void *arg));
struct create_cell_t;
int assign_onionskin_to_cpuworker(or_circuit_t *circ,
More information about the tor-commits
mailing list