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_introduce.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'src/test/test_introduce.c') diff --git a/src/test/test_introduce.c b/src/test/test_introduce.c index b841a33d05..17ee01d9b8 100644 --- a/src/test/test_introduce.c +++ b/src/test/test_introduce.c @@ -394,8 +394,9 @@ make_intro_from_plaintext( */ static void -test_introduce_decrypt_v0(void) +test_introduce_decrypt_v0(void *arg) { + (void)arg; do_decrypt_test(v0_test_plaintext, sizeof(v0_test_plaintext)); } @@ -403,8 +404,9 @@ test_introduce_decrypt_v0(void) */ static void -test_introduce_decrypt_v1(void) +test_introduce_decrypt_v1(void *arg) { + (void)arg; do_decrypt_test(v1_test_plaintext, sizeof(v1_test_plaintext)); } @@ -412,8 +414,9 @@ test_introduce_decrypt_v1(void) */ static void -test_introduce_decrypt_v2(void) +test_introduce_decrypt_v2(void *arg) { + (void)arg; do_decrypt_test(v2_test_plaintext, sizeof(v2_test_plaintext)); } @@ -421,8 +424,9 @@ test_introduce_decrypt_v2(void) */ static void -test_introduce_decrypt_v3(void) +test_introduce_decrypt_v3(void *arg) { + (void)arg; do_decrypt_test( v3_no_auth_test_plaintext, sizeof(v3_no_auth_test_plaintext)); do_decrypt_test( @@ -433,8 +437,9 @@ test_introduce_decrypt_v3(void) */ static void -test_introduce_early_parse_v0(void) +test_introduce_early_parse_v0(void *arg) { + (void)arg; do_early_parse_test(v0_test_plaintext, sizeof(v0_test_plaintext)); } @@ -442,8 +447,9 @@ test_introduce_early_parse_v0(void) */ static void -test_introduce_early_parse_v1(void) +test_introduce_early_parse_v1(void *arg) { + (void)arg; do_early_parse_test(v1_test_plaintext, sizeof(v1_test_plaintext)); } @@ -451,8 +457,9 @@ test_introduce_early_parse_v1(void) */ static void -test_introduce_early_parse_v2(void) +test_introduce_early_parse_v2(void *arg) { + (void)arg; do_early_parse_test(v2_test_plaintext, sizeof(v2_test_plaintext)); } @@ -460,8 +467,9 @@ test_introduce_early_parse_v2(void) */ static void -test_introduce_early_parse_v3(void) +test_introduce_early_parse_v3(void *arg) { + (void)arg; do_early_parse_test( v3_no_auth_test_plaintext, sizeof(v3_no_auth_test_plaintext)); do_early_parse_test( @@ -472,8 +480,9 @@ test_introduce_early_parse_v3(void) */ static void -test_introduce_late_parse_v0(void) +test_introduce_late_parse_v0(void *arg) { + (void)arg; do_late_parse_test(v0_test_plaintext, sizeof(v0_test_plaintext)); } @@ -481,8 +490,9 @@ test_introduce_late_parse_v0(void) */ static void -test_introduce_late_parse_v1(void) +test_introduce_late_parse_v1(void *arg) { + (void)arg; do_late_parse_test(v1_test_plaintext, sizeof(v1_test_plaintext)); } @@ -490,8 +500,9 @@ test_introduce_late_parse_v1(void) */ static void -test_introduce_late_parse_v2(void) +test_introduce_late_parse_v2(void *arg) { + (void)arg; do_late_parse_test(v2_test_plaintext, sizeof(v2_test_plaintext)); } @@ -499,8 +510,9 @@ test_introduce_late_parse_v2(void) */ static void -test_introduce_late_parse_v3(void) +test_introduce_late_parse_v3(void *arg) { + (void)arg; do_late_parse_test( v3_no_auth_test_plaintext, sizeof(v3_no_auth_test_plaintext)); do_late_parse_test( @@ -508,7 +520,7 @@ test_introduce_late_parse_v3(void) } #define INTRODUCE_LEGACY(name) \ - { #name, legacy_test_helper, 0, &legacy_setup, test_introduce_ ## name } + { #name, test_introduce_ ## name , 0, NULL, NULL } struct testcase_t introduce_tests[] = { INTRODUCE_LEGACY(early_parse_v0), -- cgit v1.2.3-54-g00ecf