]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make cpuworker_queue_work function mockable.
authorNick Mathewson <nickm@torproject.org>
Fri, 14 Apr 2017 23:23:21 +0000 (19:23 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 24 Apr 2017 14:59:25 +0000 (10:59 -0400)
I'll be using this in the unit tests for consdiffmgr.

src/or/cpuworker.c
src/or/cpuworker.h

index f79cd067cb1508b44e8f46bdca2acd56a0188c48..af79fafaa639b0a6bef98f0f01b4564cf48de320 100644 (file)
@@ -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);
 
index 9bc5d962dd140e4ec8fb0aab1113c8cf7f36005b..aedf2fae323986088c4f37ab99b33aed1856169b 100644 (file)
@@ -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,