ex32 plus runtests improvements
This commit is contained in:
3
lcthw-remnants-2/c-skeleton/.gitignore
vendored
3
lcthw-remnants-2/c-skeleton/.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
tests/runtests
|
||||
tests/your_library_tests
|
||||
tests/*_tests
|
||||
tests/**/*_tests
|
||||
|
@@ -20,17 +20,25 @@ int run_tests_file(char *filename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int entcount = 0;
|
||||
int rc = 0;
|
||||
int i = 0;
|
||||
int ntests = 0;
|
||||
char *testsdir = getenv("TESTS");
|
||||
char *testsdir = NULL;
|
||||
char *valgrind = getenv("VALGRIND");
|
||||
struct dirent **namelist = NULL;
|
||||
struct dirent *ep = NULL;
|
||||
|
||||
if(argc > 1) {
|
||||
testsdir = argv[1];
|
||||
}
|
||||
|
||||
if(!testsdir) {
|
||||
testsdir = getenv("TESTS");
|
||||
}
|
||||
|
||||
if(!testsdir) {
|
||||
testsdir = "./tests";
|
||||
}
|
||||
@@ -70,14 +78,19 @@ int main(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("ERROR in test %s: here's tests/tests.log\n", filename);
|
||||
printf("------\n");
|
||||
rc = system("tail tests/tests.log");
|
||||
printf("ERROR in test %s", filename);
|
||||
if(access("tests/tests.log", R_OK) == 0) {
|
||||
printf(": here's tests/tests.log\n");
|
||||
printf("------\n");
|
||||
rc = system("tail tests/tests.log");
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
printf("------\n");
|
||||
printf("Total of %d test files run.\n", ntests);
|
||||
printf("Total of %d test file%s run.\n", ntests, ntests > 1 ? "s" : "");
|
||||
|
||||
if(namelist) {
|
||||
free(namelist);
|
||||
|
Reference in New Issue
Block a user