[tor-commits] [obfsproxy/master] Silence the noisy unit test.

nickm at torproject.org nickm at torproject.org
Fri Jun 10 19:43:17 UTC 2011


commit 2d17ad70d83992a10038aaa30a85cd19df53055a
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jun 10 15:39:19 2011 -0400

    Silence the noisy unit test.
---
 src/protocols/obfs2.c     |    4 ++--
 src/test/unittest_obfs2.c |    5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/protocols/obfs2.c b/src/protocols/obfs2.c
index b24bf05..d84d3ae 100644
--- a/src/protocols/obfs2.c
+++ b/src/protocols/obfs2.c
@@ -160,7 +160,7 @@ parse_and_set_options(int n_options, char **options,
 static void
 usage(void)
 {
-  printf("You failed at creating a correct obfs2 line.\n"
+  log_warn("You failed at creating a correct obfs2 line.\n"
          "obfs2 syntax:\n"
          "\tobfs2 [obfs2_args] obfs2_opts\n"
          "\t'obfs2_opts':\n"
@@ -171,7 +171,7 @@ usage(void)
          "\t\tShared Secret ~ --shared-secret=<secret>\n"
          "\tExample:\n"
          "\tobfsproxy --dest=127.0.0.1:666 --shared-secret=himitsu "
-         "\tobfs2 server 127.0.0.1:1026\n");
+         "\tobfs2 server 127.0.0.1:1026");
 }
 
 /**
diff --git a/src/test/unittest_obfs2.c b/src/test/unittest_obfs2.c
index 1348c7d..dd51762 100644
--- a/src/test/unittest_obfs2.c
+++ b/src/test/unittest_obfs2.c
@@ -30,6 +30,9 @@ test_proto_option_parsing(void *data)
   char *options[] = {"obfs2", "--shared-secret=a", "socks", "127.0.0.1:0"};
   int n_options = 4;
 
+  /* Suppress logs for the duration of this function. */
+  log_set_method(LOG_METHOD_NULL, NULL);
+
   tt_assert(set_up_protocol(n_options, options,
                             proto_params) == 1);
 
@@ -99,6 +102,8 @@ test_proto_option_parsing(void *data)
  end:
   if (proto_params)
     free(proto_params);
+  /* Unsuspend logging */
+  log_set_method(LOG_METHOD_STDOUT, NULL);
 }
 
 /* Make sure we can successfully set up a protocol state */



More information about the tor-commits mailing list