Cleaned up tests further, in anticipation of merges with other branches

This commit is contained in:
Lorenz Meier
2013-01-12 23:26:26 +01:00
parent 8d6e0bc968
commit acbfd66e67
2 changed files with 14 additions and 8 deletions
+1 -2
View File
@@ -90,9 +90,8 @@ int test_sleep(int argc, char *argv[])
printf("\t %d 100ms sleeps\n", nsleeps); printf("\t %d 100ms sleeps\n", nsleeps);
fflush(stdout); fflush(stdout);
for (int i = 0; i < nsleeps; i++) { for (unsigned int i = 0; i < nsleeps; i++) {
usleep(100000); usleep(100000);
//printf("\ttick\n");
} }
printf("\t Sleep test successful.\n"); printf("\t Sleep test successful.\n");
+13 -6
View File
@@ -78,11 +78,10 @@ static int test_jig(int argc, char *argv[]);
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
struct { const struct {
const char *name; const char *name;
int (* fn)(int argc, char *argv[]); int (* fn)(int argc, char *argv[]);
unsigned options; unsigned options;
int passed;
#define OPT_NOHELP (1<<0) #define OPT_NOHELP (1<<0)
#define OPT_NOALLTEST (1<<1) #define OPT_NOALLTEST (1<<1)
#define OPT_NOJIGTEST (1<<2) #define OPT_NOJIGTEST (1<<2)
@@ -135,6 +134,10 @@ test_all(int argc, char *argv[])
unsigned int failcount = 0; unsigned int failcount = 0;
unsigned int testscount = 0; unsigned int testscount = 0;
/* store test results */
bool passed[(sizeof(tests) / sizeof(tests[0]))];
memset(&passed, 0, sizeof(passed));
printf("\nRunning all tests...\n\n"); printf("\nRunning all tests...\n\n");
for (i = 0; tests[i].name; i++) { for (i = 0; tests[i].name; i++) {
@@ -150,7 +153,7 @@ test_all(int argc, char *argv[])
failcount++; failcount++;
} else { } else {
tests[i].passed = 1; passed[i] = true;
printf(" [%s] \t\t\tPASS\n", tests[i].name); printf(" [%s] \t\t\tPASS\n", tests[i].name);
fflush(stdout); fflush(stdout);
} }
@@ -198,7 +201,7 @@ test_all(int argc, char *argv[])
unsigned int k; unsigned int k;
for (k = 0; k < i; k++) { for (k = 0; k < i; k++) {
if ((tests[k].passed == 0) && !(tests[k].options & OPT_NOALLTEST)) { if (!passed[k] && !(tests[k].options & OPT_NOALLTEST)) {
printf(" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n", tests[k].name, tests[k].name); printf(" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n", tests[k].name, tests[k].name);
} }
} }
@@ -247,6 +250,10 @@ int test_jig(int argc, char *argv[])
unsigned int failcount = 0; unsigned int failcount = 0;
unsigned int testscount = 0; unsigned int testscount = 0;
/* store test results */
bool passed[(sizeof(tests) / sizeof(tests[0]))];
memset(&passed, 0, sizeof(passed));
printf("\nRunning all tests...\n\n"); printf("\nRunning all tests...\n\n");
for (i = 0; tests[i].name; i++) { for (i = 0; tests[i].name; i++) {
/* Only run tests that are not excluded */ /* Only run tests that are not excluded */
@@ -259,7 +266,7 @@ int test_jig(int argc, char *argv[])
fflush(stderr); fflush(stderr);
failcount++; failcount++;
} else { } else {
tests[i].passed = 1; passed[i] = true;
printf(" [%s] \t\t\tPASS\n", tests[i].name); printf(" [%s] \t\t\tPASS\n", tests[i].name);
fflush(stdout); fflush(stdout);
} }
@@ -302,7 +309,7 @@ int test_jig(int argc, char *argv[])
unsigned int k; unsigned int k;
for (k = 0; k < i; k++) for (k = 0; k < i; k++)
{ {
if ((tests[k].passed == 0) && !(tests[k].options & OPT_NOJIGTEST)) if (!passed[k] && !(tests[k].options & OPT_NOJIGTEST))
{ {
printf(" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n", tests[k].name, tests[k].name); printf(" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n", tests[k].name, tests[k].name);
} }