From a6627fdb80935d68b8e7f1c4e098f8ce54894842 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 16 Sep 2014 09:30:22 -0400 Subject: Remove the legacy_test_helper and legacy_setup wrappers These wrappers went into place when the default type for our unit test functions changed from "void fn(void)" to "void fn(void *arg)". To generate this patch, I did the same hokey-pokey as before with replacing all operators used as macro arguments, then I ran a coccinelle script, then I ran perl script to fix up everything that used legacy_test_helper, then I manually removed the legacy_test_helper functions, then I ran a final perl script to put the operators back how they were. ============================== #!/usr/bin/perl -w -i -p s/==,/_X_EQ_,/g; s/!=,/_X_NE_,/g; s/<,/_X_LT_,/g; s/>,/_X_GT_,/g; s/>=,/_X_GEQ_,/g; s/<=,/_X_LEQ_,/g; -------------------- @@ identifier func =~ "test_.*$"; statement S, S2; @@ static void func ( -void +void *arg ) { ... when != S2 +(void) arg; S ... } -------------------- #!/usr/bin/perl -w -i -p s/, *legacy_test_helper, *([^,]+), *\&legacy_setup, *([^\}]+) *}/, $2, $1, NULL, NULL }/g; -------------------- #!/usr/bin/perl -w -i -p s/_X_NEQ_/!=/g; s/_X_NE_/!=/g; s/_X_EQ_/==/g; s/_X_GT_/>/g; s/_X_LT_/=/g; s/_X_LEQ_/<=/g; -------------------- --- src/test/test_pt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/test/test_pt.c') diff --git a/src/test/test_pt.c b/src/test/test_pt.c index aa616abf3e..61ade84e3a 100644 --- a/src/test/test_pt.c +++ b/src/test/test_pt.c @@ -27,13 +27,14 @@ reset_mp(managed_proxy_t *mp) } static void -test_pt_parsing(void) +test_pt_parsing(void *arg) { char line[200]; transport_t *transport = NULL; tor_addr_t test_addr; managed_proxy_t *mp = tor_malloc_zero(sizeof(managed_proxy_t)); + (void)arg; mp->conf_state = PT_PROTO_INFANT; mp->transports = smartlist_new(); @@ -187,11 +188,12 @@ test_pt_get_transport_options(void *arg) } static void -test_pt_protocol(void) +test_pt_protocol(void *arg) { char line[200]; managed_proxy_t *mp = tor_malloc_zero(sizeof(managed_proxy_t)); + (void)arg; mp->conf_state = PT_PROTO_LAUNCHED; mp->transports = smartlist_new(); mp->argv = tor_calloc(sizeof(char *), 2); @@ -529,7 +531,7 @@ test_get_pt_proxy_uri(void *arg) } #define PT_LEGACY(name) \ - { #name, legacy_test_helper, 0, &legacy_setup, test_pt_ ## name } + { #name, test_pt_ ## name , 0, NULL, NULL } struct testcase_t pt_tests[] = { PT_LEGACY(parsing), -- cgit v1.2.3-54-g00ecf