testing/fstest: add number of correct/incorrect tests

Verbose output for CI testing with OK and FAILED number of tests.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc 2023-10-17 22:57:43 +02:00 committed by Alan Carvalho de Assis
parent cd1d855a71
commit a4ceb82d67

View File

@ -89,6 +89,10 @@ struct fstest_ctx_s
struct mallinfo mmprevious; struct mallinfo mmprevious;
struct mallinfo mmafter; struct mallinfo mmafter;
}; };
static int tests_ok = 0;
static int tests_err = 0;
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@ -968,6 +972,8 @@ int main(int argc, FAR char *argv[])
int loop_num; int loop_num;
int option; int option;
tests_ok = tests_err = 0;
ctx = malloc(sizeof(struct fstest_ctx_s)); ctx = malloc(sizeof(struct fstest_ctx_s));
if (ctx == NULL) if (ctx == NULL)
{ {
@ -1101,6 +1107,7 @@ int main(int argc, FAR char *argv[])
ret = fstest_delfiles(ctx); ret = fstest_delfiles(ctx);
if (ret < 0) if (ret < 0)
{ {
tests_err += 1;
printf("ERROR: Failed to delete files\n"); printf("ERROR: Failed to delete files\n");
printf(" Number of files: %d\n", ctx->nfiles); printf(" Number of files: %d\n", ctx->nfiles);
printf(" Number deleted: %d\n", ctx->ndeleted); printf(" Number deleted: %d\n", ctx->ndeleted);
@ -1109,6 +1116,7 @@ int main(int argc, FAR char *argv[])
} }
else else
{ {
tests_ok += 1;
printf("Deleted some files\n"); printf("Deleted some files\n");
printf(" Number of files: %d\n", ctx->nfiles); printf(" Number of files: %d\n", ctx->nfiles);
printf(" Number deleted: %d\n", ctx->ndeleted); printf(" Number deleted: %d\n", ctx->ndeleted);
@ -1128,6 +1136,7 @@ int main(int argc, FAR char *argv[])
ret = fstest_verifyfs(ctx); ret = fstest_verifyfs(ctx);
if (ret < 0) if (ret < 0)
{ {
tests_err += 1;
printf("ERROR: Failed to verify files\n"); printf("ERROR: Failed to verify files\n");
printf(" Number of files: %d\n", ctx->nfiles); printf(" Number of files: %d\n", ctx->nfiles);
printf(" Number deleted: %d\n", ctx->ndeleted); printf(" Number deleted: %d\n", ctx->ndeleted);
@ -1136,6 +1145,7 @@ int main(int argc, FAR char *argv[])
} }
else else
{ {
tests_ok += 1;
#if CONFIG_TESTING_FSTEST_VERBOSE != 0 #if CONFIG_TESTING_FSTEST_VERBOSE != 0
printf("Verified!\n"); printf("Verified!\n");
printf(" Number of files: %d\n", ctx->nfiles); printf(" Number of files: %d\n", ctx->nfiles);
@ -1183,6 +1193,9 @@ int main(int argc, FAR char *argv[])
free(ctx->files); free(ctx->files);
free(ctx); free(ctx);
printf("File system tests done... OK: %d, FAILED: %d\n", tests_ok,
tests_err);
#ifdef CONFIG_TESTING_FSTEST_POWEROFF #ifdef CONFIG_TESTING_FSTEST_POWEROFF
/* Power down. This is useful when used with the simulator and gcov, /* Power down. This is useful when used with the simulator and gcov,
* as the graceful shutdown allows for the generation of the .gcda files. * as the graceful shutdown allows for the generation of the .gcda files.