This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit a4ceb82d67051cb9a37f268051cc3bb17ebbeb7d
Author: Michal Lenc <michall...@seznam.cz>
AuthorDate: Tue Oct 17 22:57:43 2023 +0200

    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 <michall...@seznam.cz>
---
 testing/fstest/fstest_main.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/testing/fstest/fstest_main.c b/testing/fstest/fstest_main.c
index 0acb2c6ca..9c57caedb 100644
--- a/testing/fstest/fstest_main.c
+++ b/testing/fstest/fstest_main.c
@@ -89,6 +89,10 @@ struct fstest_ctx_s
   struct mallinfo mmprevious;
   struct mallinfo mmafter;
 };
+
+static int tests_ok = 0;
+static int tests_err = 0;
+
 /****************************************************************************
  * Private Functions
  ****************************************************************************/
@@ -968,6 +972,8 @@ int main(int argc, FAR char *argv[])
   int loop_num;
   int option;
 
+  tests_ok = tests_err = 0;
+
   ctx = malloc(sizeof(struct fstest_ctx_s));
   if (ctx == NULL)
     {
@@ -1101,6 +1107,7 @@ int main(int argc, FAR char *argv[])
       ret = fstest_delfiles(ctx);
       if (ret < 0)
         {
+          tests_err += 1;
           printf("ERROR: Failed to delete files\n");
           printf("  Number of files: %d\n", ctx->nfiles);
           printf("  Number deleted:  %d\n", ctx->ndeleted);
@@ -1109,6 +1116,7 @@ int main(int argc, FAR char *argv[])
         }
       else
         {
+          tests_ok += 1;
           printf("Deleted some files\n");
           printf("  Number of files: %d\n", ctx->nfiles);
           printf("  Number deleted:  %d\n", ctx->ndeleted);
@@ -1128,6 +1136,7 @@ int main(int argc, FAR char *argv[])
       ret = fstest_verifyfs(ctx);
       if (ret < 0)
         {
+          tests_err += 1;
           printf("ERROR: Failed to verify files\n");
           printf("  Number of files: %d\n", ctx->nfiles);
           printf("  Number deleted:  %d\n", ctx->ndeleted);
@@ -1136,6 +1145,7 @@ int main(int argc, FAR char *argv[])
         }
       else
         {
+          tests_ok += 1;
 #if CONFIG_TESTING_FSTEST_VERBOSE != 0
           printf("Verified!\n");
           printf("  Number of files: %d\n", ctx->nfiles);
@@ -1148,19 +1158,19 @@ int main(int argc, FAR char *argv[])
       ret = statfs(ctx->mountdir, &buf);
       if (ret < 0)
         {
-           printf("ERROR: statfs failed: %d\n", errno);
-           free(ctx);
-           exit(ret);
+          printf("ERROR: statfs failed: %d\n", errno);
+          free(ctx);
+          exit(ret);
         }
       else
         {
-           printf("File System:\n");
-           printf("  Block Size:      %lu\n", (unsigned long)buf.f_bsize);
-           printf("  No. Blocks:      %lu\n", (unsigned long)buf.f_blocks);
-           printf("  Free Blocks:     %ld\n", (long)buf.f_bfree);
-           printf("  Avail. Blocks:   %ld\n", (long)buf.f_bavail);
-           printf("  No. File Nodes:  %ld\n", (long)buf.f_files);
-           printf("  Free File Nodes: %ld\n", (long)buf.f_ffree);
+          printf("File System:\n");
+          printf("  Block Size:      %lu\n", (unsigned long)buf.f_bsize);
+          printf("  No. Blocks:      %lu\n", (unsigned long)buf.f_blocks);
+          printf("  Free Blocks:     %ld\n", (long)buf.f_bfree);
+          printf("  Avail. Blocks:   %ld\n", (long)buf.f_bavail);
+          printf("  No. File Nodes:  %ld\n", (long)buf.f_files);
+          printf("  Free File Nodes: %ld\n", (long)buf.f_ffree);
         }
 
       /* Perform garbage collection, integrity checks */
@@ -1183,6 +1193,9 @@ int main(int argc, FAR char *argv[])
   free(ctx->files);
   free(ctx);
 
+  printf("File system tests done... OK: %d, FAILED: %d\n", tests_ok,
+                                                           tests_err);
+
 #ifdef CONFIG_TESTING_FSTEST_POWEROFF
   /* Power down. This is useful when used with the simulator and gcov,
    * as the graceful shutdown allows for the generation of the .gcda files.

Reply via email to