]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Prepare some mock functions to test #9288.
authorGeorge Kadianakis <desnacked@riseup.net>
Mon, 29 Jul 2013 13:46:57 +0000 (15:46 +0200)
committerNick Mathewson <nickm@torproject.org>
Wed, 31 Jul 2013 17:34:16 +0000 (13:34 -0400)
src/common/util.c
src/common/util.h

index d9913dda45cc70936ec2be78a38a876105cabdcf..a8867b691d867fd729ba217d0f011f2f6e8d08af 100644 (file)
@@ -3969,9 +3969,9 @@ tor_spawn_background(const char *const filename, const char **argv,
  *  <b>process_handle</b>.
  *  If <b>also_terminate_process</b> is true, also terminate the
  *  process of the process handle. */
-void
-tor_process_handle_destroy(process_handle_t *process_handle,
-                           int also_terminate_process)
+MOCK_IMPL(void,
+tor_process_handle_destroy,(process_handle_t *process_handle,
+                            int also_terminate_process))
 {
   if (!process_handle)
     return;
@@ -4570,8 +4570,8 @@ log_from_handle(HANDLE *pipe, int severity)
 /** Return a smartlist containing lines outputted from
  *  <b>handle</b>. Return NULL on error, and set
  *  <b>stream_status_out</b> appropriately. */
-smartlist_t *
-tor_get_lines_from_handle(FILE *handle, enum stream_status *stream_status_out)
+MOCK_IMPL(smartlist_t *,
+tor_get_lines_from_handle,(FILE *handle, enum stream_status *stream_status_out))
 {
   enum stream_status stream_status;
   char stdout_buf[400];
index ad75266587d3a59316eba898f94332cdde33ad31..505ef23bd27b2fb501e6f59ff55415a310c4c0b7 100644 (file)
@@ -491,18 +491,21 @@ FILE *tor_process_get_stdout_pipe(process_handle_t *process_handle);
 #endif
 
 #ifdef _WIN32
-struct smartlist_t *
-tor_get_lines_from_handle(HANDLE *handle,
-                          enum stream_status *stream_status);
+MOCK_DECL(struct smartlist_t *,
+tor_get_lines_from_handle,(HANDLE *handle,
+                           enum stream_status *stream_status));
 #else
-struct smartlist_t *
-tor_get_lines_from_handle(FILE *handle,
-                          enum stream_status *stream_status);
+MOCK_DECL(struct smartlist_t *,
+tor_get_lines_from_handle,(FILE *handle,
+                           enum stream_status *stream_status));
 #endif
 
-int tor_terminate_process(process_handle_t *process_handle);
-void tor_process_handle_destroy(process_handle_t *process_handle,
-                                int also_terminate_process);
+int
+tor_terminate_process(process_handle_t *process_handle);
+
+MOCK_DECL(void,
+tor_process_handle_destroy,(process_handle_t *process_handle,
+                            int also_terminate_process));
 
 /* ===== Insecure rng */
 typedef struct tor_weak_rng_t {