diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-16 09:30:22 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-16 09:30:22 -0400 |
commit | a6627fdb80935d68b8e7f1c4e098f8ce54894842 (patch) | |
tree | 0fd6bff96ab59e4fbed48e54dd27d77eb82d8c28 /src/test/test_pt.c | |
parent | c72a94ea1c51b53aa174f82da11cdbc8a99b3c40 (diff) | |
download | tor-a6627fdb80935d68b8e7f1c4e098f8ce54894842.tar.gz tor-a6627fdb80935d68b8e7f1c4e098f8ce54894842.zip |
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_GEQ_/>=/g;
s/_X_LEQ_/<=/g;
--------------------
Diffstat (limited to 'src/test/test_pt.c')
-rw-r--r-- | src/test/test_pt.c | 8 |
1 files changed, 5 insertions, 3 deletions
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), |