X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Tools%2FNetTest_Runner%2Fmain.c;fp=Tools%2FNetTest_Runner%2Fmain.c;h=5c175d71e8d60f633478c560fc7168b5c96c71e3;hb=3186a83d890b05be6a140999bab38c604ffcd66f;hp=05b455f822b30610c2333b84a39903c068628464;hpb=17b6125504e385c169193f3c8e29ced340425979;p=tpg%2Facess2.git diff --git a/Tools/NetTest_Runner/main.c b/Tools/NetTest_Runner/main.c index 05b455f8..5c175d71 100644 --- a/Tools/NetTest_Runner/main.c +++ b/Tools/NetTest_Runner/main.c @@ -23,12 +23,16 @@ int main(int argc, char *argv[]) return 1; typedef bool t_test(void); - t_test *tests[] = { - Test_ARP_Basic, - Test_TCP_Basic, - //Test_TCP_WindowSizes, - Test_TCP_Reset, - NULL + struct { + t_test *fcn; + const char *name; + } tests[] = { + #define _(fcn) {fcn, #fcn} + _(Test_ARP_Basic), + _(Test_TCP_Basic), + //_(Test_TCP_WindowSizes), + _(Test_TCP_Reset), + {NULL,NULL} }; // Truncate the two output files @@ -40,18 +44,18 @@ int main(int argc, char *argv[]) int n_pass = 0; int n_fail = 0; - for(int i = 0; tests[i]; i ++ ) + for(int i = 0; tests[i].fcn; i ++ ) { Stack_AddDevice("/tmp/acess2net", (char[]){TEST_MAC}); Stack_AddInterface("eth0", 4, (const char[]){TEST_IP}, 24); Stack_AddRoute(4, "\0\0\0\0", 0, (const char[]){HOST_IP}); - if( Stack_Start("cmdline") ) + if( Stack_Start(tests[i].name, "cmdline") ) goto teardown; if( Net_Receive(0, 1, &argc, 1000) == 0 ) goto teardown; - bool result = tests[i](); + bool result = tests[i].fcn(); printf("%s: %s\n", gsTestName, (result ? "PASS" : "FAIL")); if(result)