git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/VFS - Better error reporting in open
[tpg/acess2.git]
/
Tools
/
NetTest_Runner
/
main.c
diff --git
a/Tools/NetTest_Runner/main.c
b/Tools/NetTest_Runner/main.c
index
0c2b6c0
..
5c175d7
100644
(file)
--- a/
Tools/NetTest_Runner/main.c
+++ b/
Tools/NetTest_Runner/main.c
@@
-23,42
+23,54
@@
int main(int argc, char *argv[])
return 1;
typedef bool t_test(void);
return 1;
typedef bool t_test(void);
- t_test *tests[] = {
- Test_ARP_Basic,
- Test_TCP_Basic,
- 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
// TODO: Move to stack.c
// TODO: Move to stack.c
- FILE *fp;
- fp = fopen("stdout.txt", "w"); fclose(fp);
- fp = fopen("stderr.txt", "w"); fclose(fp);
+ fclose( fopen("stdout.txt", "w") );
+ fclose( fopen("stderr.txt", "w") );
Net_Open(0, "/tmp/acess2net");
Net_Open(0, "/tmp/acess2net");
- for(int i = 0; tests[i]; i ++ )
+ int n_pass = 0;
+ int n_fail = 0;
+ 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});
{
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;
goto teardown;
if( Net_Receive(0, 1, &argc, 1000) == 0 )
goto teardown;
- if( tests[i]() )
- printf("%s: PASS\n", gsTestName);
+ bool result = tests[i].fcn();
+
+ printf("%s: %s\n", gsTestName, (result ? "PASS" : "FAIL"));
+ if(result)
+ n_pass ++;
else
else
-
printf("%s: FAIL\n", gsTestName)
;
+
n_fail ++
;
teardown:
Stack_Kill();
}
Net_Close(0);
unlink("/tmp/acess2net");
teardown:
Stack_Kill();
}
Net_Close(0);
unlink("/tmp/acess2net");
+ printf("--- All tests done %i pass, %i fail\n", n_pass, n_fail);
- return
0
;
+ return
n_fail
;
}
void PrintUsage(const char *ProgName)
}
void PrintUsage(const char *ProgName)
UCC
git Repository :: git.ucc.asn.au