You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/11/27 13:11:12 UTC

[incubator-nuttx-apps] 02/06: testing/fstest: Compare the file name directly

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

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

commit 1187351144783b649d6c2d12159ca02d8ac9531e
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Nov 9 01:47:07 2021 +0800

    testing/fstest: Compare the file name directly
    
    and remove crc of file name
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 testing/fstest/fstest_main.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/testing/fstest/fstest_main.c b/testing/fstest/fstest_main.c
index 215be83..c8d7cc6 100644
--- a/testing/fstest/fstest_main.c
+++ b/testing/fstest/fstest_main.c
@@ -91,7 +91,6 @@ struct fstest_filedesc_s
   bool failed;
   size_t len;
   uint32_t crc;
-  uint32_t hash;
 };
 
 /****************************************************************************
@@ -201,9 +200,8 @@ static bool fstest_checkexist(FAR struct fstest_filedesc_s *file)
 
   for (i = 0; i < CONFIG_TESTING_FSTEST_MAXOPEN; i++)
     {
-      if (!g_files[i].deleted &&
-          &g_files[i] != file &&
-          g_files[i].hash == file->hash)
+      if (!g_files[i].deleted && &g_files[i] != file &&
+          strcmp(g_files[i].name, file->name) == 0)
         {
           ret = true;
           break;
@@ -251,8 +249,6 @@ static inline void fstest_randname(FAR struct fstest_filedesc_s *file)
         }
 
       file->name[alloclen] = '\0';
-      file->hash = crc32((const uint8_t *)file->name + dirlen,
-                         alloclen - dirlen);
     }
   while (fstest_checkexist(file));
 }