[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Don't initialize the process module manually in tests.



commit bc836d559dce5756f8ad2150d2351220ba7610f2
Author: Alexander Færøy <ahf@xxxxxxxxxxxxxx>
Date:   Thu Dec 20 17:03:50 2018 +0100

    Don't initialize the process module manually in tests.
    
    It's not longer needed for us to initialize the process module in tests.
    
    See: https://bugs.torproject.org/28847
---
 src/test/test_process.c      | 27 ---------------------------
 src/test/test_process_slow.c |  8 --------
 src/test/test_pt.c           |  9 ---------
 3 files changed, 44 deletions(-)

diff --git a/src/test/test_process.c b/src/test/test_process.c
index 9b62862f0..27c9935e0 100644
--- a/src/test/test_process.c
+++ b/src/test/test_process.c
@@ -142,8 +142,6 @@ static void
 test_default_values(void *arg)
 {
   (void)arg;
-  process_init();
-
   process_t *process = process_new("/path/to/nothing");
 
   /* We are not running by default. */
@@ -171,14 +169,12 @@ test_default_values(void *arg)
 
  done:
   process_free(process);
-  process_free_all();
 }
 
 static void
 test_environment(void *arg)
 {
   (void)arg;
-  process_init();
 
   process_t *process = process_new("");
   process_environment_t *env = NULL;
@@ -221,7 +217,6 @@ test_environment(void *arg)
  done:
   process_environment_free(env);
   process_free(process);
-  process_free_all();
 }
 
 static void
@@ -249,7 +244,6 @@ static void
 test_line_protocol_simple(void *arg)
 {
   (void)arg;
-  process_init();
 
   process_data_t *process_data = process_data_new();
 
@@ -289,7 +283,6 @@ test_line_protocol_simple(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 
   UNMOCK(process_read_stdout);
   UNMOCK(process_read_stderr);
@@ -299,7 +292,6 @@ static void
 test_line_protocol_multi(void *arg)
 {
   (void)arg;
-  process_init();
 
   process_data_t *process_data = process_data_new();
 
@@ -349,7 +341,6 @@ test_line_protocol_multi(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 
   UNMOCK(process_read_stdout);
   UNMOCK(process_read_stderr);
@@ -359,7 +350,6 @@ static void
 test_line_protocol_partial(void *arg)
 {
   (void)arg;
-  process_init();
 
   process_data_t *process_data = process_data_new();
 
@@ -431,7 +421,6 @@ test_line_protocol_partial(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 
   UNMOCK(process_read_stdout);
   UNMOCK(process_read_stderr);
@@ -441,7 +430,6 @@ static void
 test_raw_protocol_simple(void *arg)
 {
   (void)arg;
-  process_init();
 
   process_data_t *process_data = process_data_new();
 
@@ -499,7 +487,6 @@ test_raw_protocol_simple(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 
   UNMOCK(process_read_stdout);
   UNMOCK(process_read_stderr);
@@ -510,8 +497,6 @@ test_write_simple(void *arg)
 {
   (void)arg;
 
-  process_init();
-
   process_data_t *process_data = process_data_new();
 
   process_t *process = process_new("");
@@ -530,7 +515,6 @@ test_write_simple(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 
   UNMOCK(process_write_stdin);
 }
@@ -540,8 +524,6 @@ test_exit_simple(void *arg)
 {
   (void)arg;
 
-  process_init();
-
   process_data_t *process_data = process_data_new();
 
   process_t *process = process_new("");
@@ -566,14 +548,12 @@ test_exit_simple(void *arg)
   process_set_data(process, process_data);
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 }
 
 static void
 test_argv_simple(void *arg)
 {
   (void)arg;
-  process_init();
 
   process_t *process = process_new("/bin/cat");
   char **argv = NULL;
@@ -600,7 +580,6 @@ test_argv_simple(void *arg)
  done:
   tor_free(argv);
   process_free(process);
-  process_free_all();
 }
 
 static void
@@ -608,8 +587,6 @@ test_unix(void *arg)
 {
   (void)arg;
 #ifndef _WIN32
-  process_init();
-
   process_t *process = process_new("");
 
   /* On Unix all processes should have a Unix process handle. */
@@ -617,7 +594,6 @@ test_unix(void *arg)
 
  done:
   process_free(process);
-  process_free_all();
 #endif
 }
 
@@ -626,8 +602,6 @@ test_win32(void *arg)
 {
   (void)arg;
 #ifdef _WIN32
-  process_init();
-
   process_t *process = process_new("");
   char *joined_argv = NULL;
 
@@ -675,7 +649,6 @@ test_win32(void *arg)
  done:
   tor_free(joined_argv);
   process_free(process);
-  process_free_all();
 #endif
 }
 
diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c
index a1f99bff0..845662bde 100644
--- a/src/test/test_process_slow.c
+++ b/src/test/test_process_slow.c
@@ -203,9 +203,6 @@ test_callbacks(void *arg)
   filename = TEST_PROCESS;
 #endif
 
-  /* Initialize Process subsystem. */
-  process_init();
-
   /* Process callback data. */
   process_data_t *process_data = process_data_new();
 
@@ -285,7 +282,6 @@ test_callbacks(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 }
 
 static void
@@ -300,9 +296,6 @@ test_callbacks_terminate(void *arg)
   filename = TEST_PROCESS;
 #endif
 
-  /* Initialize Process subsystem. */
-  process_init();
-
   /* Process callback data. */
   process_data_t *process_data = process_data_new();
 
@@ -332,7 +325,6 @@ test_callbacks_terminate(void *arg)
  done:
   process_data_free(process_data);
   process_free(process);
-  process_free_all();
 }
 
 struct testcase_t slow_process_tests[] = {
diff --git a/src/test/test_pt.c b/src/test/test_pt.c
index 8fcdd5c1e..c8b9d1882 100644
--- a/src/test/test_pt.c
+++ b/src/test/test_pt.c
@@ -151,8 +151,6 @@ test_pt_get_transport_options(void *arg)
   config_line_t *cl = NULL;
   (void)arg;
 
-  process_init();
-
   execve_args = tor_malloc(sizeof(char*)*2);
   execve_args[0] = tor_strdup("cheeseshop");
   execve_args[1] = NULL;
@@ -192,7 +190,6 @@ test_pt_get_transport_options(void *arg)
   config_free_lines(cl);
   managed_proxy_destroy(mp, 0);
   smartlist_free(transport_list);
-  process_free_all();
 }
 
 static void
@@ -256,8 +253,6 @@ test_pt_get_extrainfo_string(void *arg)
   char *s = NULL;
   (void) arg;
 
-  process_init();
-
   argv1 = tor_malloc_zero(sizeof(char*)*3);
   argv1[0] = tor_strdup("ewige");
   argv1[1] = tor_strdup("Blumenkraft");
@@ -291,7 +286,6 @@ test_pt_get_extrainfo_string(void *arg)
   smartlist_free(t1);
   smartlist_free(t2);
   tor_free(s);
-  process_free_all();
 }
 
 static int
@@ -347,8 +341,6 @@ test_pt_configure_proxy(void *arg)
   managed_proxy_t *mp = NULL;
   (void) arg;
 
-  process_init();
-
   dummy_state = tor_malloc_zero(sizeof(or_state_t));
 
   MOCK(process_read_stdout, process_read_stdout_replacement);
@@ -463,7 +455,6 @@ test_pt_configure_proxy(void *arg)
   tor_free(mp->argv[0]);
   tor_free(mp->argv);
   tor_free(mp);
-  process_free_all();
 }
 
 /* Test the get_pt_proxy_uri() function. */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits