TEST: exit code is number of failed tests

exit code == 0 means all tests were successful
This commit is contained in:
Ronnie Sahlberg
2012-07-11 13:07:24 +10:00
parent 5dc8c7739f
commit a684094fbd
+4 -2
View File
@@ -225,7 +225,7 @@ int main(int argc, const char *argv[])
int extra_argc = 0; int extra_argc = 0;
const char *url = NULL; const char *url = NULL;
int show_help = 0, show_usage = 0, list_tests = 0; int show_help = 0, show_usage = 0, list_tests = 0;
int res; int res, ret;
struct scsi_test *test; struct scsi_test *test;
char *testname = NULL; char *testname = NULL;
@@ -282,6 +282,7 @@ int main(int argc, const char *argv[])
exit(10); exit(10);
} }
ret = 0;
for (test = &tests[0]; test->name; test++) { for (test = &tests[0]; test->name; test++) {
if (testname != NULL && fnmatch(testname, test->name, 0)) { if (testname != NULL && fnmatch(testname, test->name, 0)) {
continue; continue;
@@ -292,10 +293,11 @@ int main(int argc, const char *argv[])
printf("TEST %s [OK]\n", test->name); printf("TEST %s [OK]\n", test->name);
} else { } else {
printf("TEST %s [FAILED]\n", test->name); printf("TEST %s [FAILED]\n", test->name);
ret++;
} }
printf("\n"); printf("\n");
} }
return 0; return ret;
} }