!356 修复内核vfat用例

Merge pull request !356 from Far/test
This commit is contained in:
openharmony_ci 2021-07-09 08:38:39 +00:00 committed by Gitee
commit ee54cd8b7e
134 changed files with 213 additions and 266 deletions

View File

@ -81,13 +81,13 @@ group("unittest") {
} }
if (LOSCFG_USER_TEST_FS_VFAT == true) { if (LOSCFG_USER_TEST_FS_VFAT == true) {
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_LOW) {
deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest_door" ] deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_door" ]
} }
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_MIDDLE) {
deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest" ] deps += [ "fs/vfat:liteos_a_fs_vfat_unittest" ]
} }
if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) { if (LOSCFG_USER_TEST_LEVEL >= TEST_LEVEL_HIGH) {
deps += [ "fs/vfat2:liteos_a_fs_vfat_unittest_pressure" ] deps += [ "fs/vfat:liteos_a_fs_vfat_unittest_pressure" ]
} }
} }
if (LOSCFG_USER_TEST_FS_PROC == true) { if (LOSCFG_USER_TEST_FS_PROC == true) {

View File

@ -34,7 +34,7 @@ common_include_dirs = [
"//third_party/googletest/googletest/include", "//third_party/googletest/googletest/include",
"../../common/include", "../../common/include",
"//kernel/liteos_a/testsuites/unittest/fs/vfs", "//kernel/liteos_a/testsuites/unittest/fs/vfs",
"//kernel/liteos_a/testsuites/unittest/fs/vfat2", "//kernel/liteos_a/testsuites/unittest/fs/vfat",
] ]
sources_entry = [ sources_entry = [

View File

@ -33,7 +33,6 @@
#define IT_VFS_FAT_H #define IT_VFS_FAT_H
#include "osTest.h" #include "osTest.h"
#include "syslog.h"
#include "sys/uio.h" #include "sys/uio.h"
#include "utime.h" #include "utime.h"
#include <sys/types.h> #include <sys/types.h>
@ -265,6 +264,8 @@ VOID ItFsFat903(VOID);
VOID ItFsFat904(VOID); VOID ItFsFat904(VOID);
VOID ItFsFat909(VOID); VOID ItFsFat909(VOID);
#endif
#if defined(LOSCFG_USER_TEST_PRESSURE) #if defined(LOSCFG_USER_TEST_PRESSURE)
VOID ItFsFatMutipthread003(VOID); VOID ItFsFatMutipthread003(VOID);
VOID ItFsFatMutipthread004(VOID); VOID ItFsFatMutipthread004(VOID);
@ -334,5 +335,3 @@ VOID ItFsFatPerformance007(VOID);
VOID ItFsFatPerformance008(VOID); VOID ItFsFatPerformance008(VOID);
#endif #endif
#endif

View File

@ -788,26 +788,20 @@ public:
{ {
INT32 ret = 0; INT32 ret = 0;
sleep(3); // 3s sleep(3); // 3s
if (ret != 0)
perror("format sd card");
return;
ret = mkdir("/vs/", S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir("/vs/", S_IRWXU | S_IRWXG | S_IRWXO);
if (ret != 0) { if (ret != 0) {
perror("mkdir mount dir"); perror("mkdir mount dir");
return; }
ret = mkdir(FAT_MOUNT_DIR, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(FAT_MOUNT_DIR, S_IRWXU | S_IRWXG | S_IRWXO);
if (ret != 0) { if (ret != 0) {
perror("mkdir mount dir"); perror("mkdir mount dir");
return; }
g_fatFilesystem = 2;
ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, nullptr); ret = mount(FAT_DEV_PATH, FAT_MOUNT_DIR, FAT_FILESYS_TYPE, 0, nullptr);
if (ret != 0) { ASSERT_EQ(0, ret);
perror("mount sd card");
return;
}
}
}
} }
static void TearDownTestCase(void) static void TearDownTestCase(void)
{ {
@ -815,6 +809,13 @@ public:
} }
}; };
#if defined(LOSCFG_USER_TEST_SMOKE)
HWTEST_F(VfsFatTest, ItFsFat026, TestSize.Level0)
{
ItFsFat026();
}
#endif
#if defined(LOSCFG_USER_TEST_FULL) #if defined(LOSCFG_USER_TEST_FULL)
HWTEST_F(VfsFatTest, ItFsFat066, TestSize.Level0) HWTEST_F(VfsFatTest, ItFsFat066, TestSize.Level0)
{ {
@ -1146,7 +1147,8 @@ HWTEST_F(VfsFatTest, ItFsFat909, TestSize.Level0)
ItFsFat909(); // plug and unplug during writing or reading ItFsFat909(); // plug and unplug during writing or reading
} }
#endif #endif // LOSCFG_USER_TEST_FULL
#if defined(LOSCFG_USER_TEST_PRESSURE) #if defined(LOSCFG_USER_TEST_PRESSURE)
HWTEST_F(VfsFatTest, ItFsFatPressure040, TestSize.Level0) HWTEST_F(VfsFatTest, ItFsFatPressure040, TestSize.Level0)
{ {
@ -1460,11 +1462,5 @@ HWTEST_F(VfsFatTest, ItFsFatPerformance008, TestSize.Level0)
ItFsFatPerformance008(); // fix write and read for three pthread ItFsFatPerformance008(); // fix write and read for three pthread
} }
#endif #endif // LOSCFG_USER_TEST_PRESSURE
#if defined(LOSCFG_USER_TEST_SMOKE)
HWTEST_F(VfsFatTest, ItFsFat026, TestSize.Level0)
{
ItFsFat026(); // statfs Unsupport
}
#endif
} // namespace OHOS } // namespace OHOS

View File

@ -53,7 +53,7 @@ static const int CLUSTER_SIZE64 = 64;
static const int CLUSTER_SIZE128 = 128; static const int CLUSTER_SIZE128 = 128;
static const int CLUSTER_SIZE255 = 255; static const int CLUSTER_SIZE255 = 255;
static const int CLUSTER_SIZE256 = 256; static const int CLUSTER_SIZE256 = 256;
static const int SECTOR_SIZE = 128; static const int SECTOR_SIZE = 512;
static UINT32 TestCase(VOID) static UINT32 TestCase(VOID)
{ {

View File

@ -130,10 +130,6 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
FatStatfsPrintf(buf1); FatStatfsPrintf(buf1);
ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1);
ICUNIT_GOTO_EQUAL(ret, FAT_IS_ERROR, ret, EXIT1);
ret = statfs(pathname1, &buf2); ret = statfs(pathname1, &buf2);
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
FatStatfsPrintf(buf2); FatStatfsPrintf(buf2);

View File

@ -62,7 +62,7 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT); ICUNIT_GOTO_NOT_EQUAL(writebuf, NULL, writebuf, EXIT);
(void)memset_s(writebuf, size + 1, 0, size + 1); (void)memset_s(writebuf, size + 1, 0, size + 1);
ret = memset_s(writebuf, size + 1, 0x61, size); ret = memset_s(writebuf, size + 1, 0x61, size);
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, EXIT); ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO); fd = open(pathname1, O_NONBLOCK | O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRWXG | S_IRWXO);
ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1); ICUNIT_GOTO_NOT_EQUAL(fd, FAT_IS_ERROR, fd, EXIT1);

View File

@ -113,7 +113,7 @@ static UINT32 TestCase(VOID)
ret = write(g_fatFd, bufWrite, strlen(bufWrite)); ret = write(g_fatFd, bufWrite, strlen(bufWrite));
if (ret <= 0) { if (ret <= 0) {
if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write if (g_testCount < (4 * BYTES_PER_KBYTES / 8)) { // 4 * BYTES_PER_KBYTES MB/GB, 8MB per write
printf("The biggest file size is smaller than the 4GB"); printf("The biggest file size is smaller than the 4GB\n");
goto EXIT2; goto EXIT2;
} }
printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount, printf("The cycle count = :%d,the file size = :%dMB,= :%0.3lfGB\n", g_testCount,

View File

@ -62,8 +62,8 @@ static UINT32 TestCase(VOID)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0,
BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // 1M * BYTES_PER_KBYTES * 4 = 4GB for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // 256 * BYTES_PER_KBYTES * 4 = 1MB
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(pathname, S_IRWXU | S_IRWXG | S_IRWXO);

View File

@ -65,7 +65,7 @@ static UINT32 TestCase(VOID)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB // 1M
for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(pathname0, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(pathname0, S_IRWXU | S_IRWXG | S_IRWXO);

View File

@ -75,7 +75,7 @@ static UINT32 TestCase(VOID)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M for (i = 0; i < 200 * 4; i++) { // append 200 * 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(pathname1, S_IRWXU | S_IRWXG | S_IRWXO);

View File

@ -64,7 +64,7 @@ static VOID *PthreadF01(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 4; i++) { // append 4 times to 1M for (i = 0; i < 4; i++) { // append 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO);
@ -156,7 +156,7 @@ static VOID *PthreadF02(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 4; i++) { // append 4 times to 1M for (i = 0; i < 4; i++) { // append 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO);
@ -247,7 +247,7 @@ static VOID *PthreadF03(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 4; i++) { // append 4 times to 1M for (i = 0; i < 4; i++) { // append 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO);

View File

@ -50,7 +50,7 @@ static VOID *PthreadF01(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 4; i++) { // append 4 times to 1M for (i = 0; i < 4; i++) { // append 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO);
@ -139,7 +139,7 @@ static VOID *PthreadF02(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 4; i++) { // append 4 times to 1M for (i = 0; i < 4; i++) { // append 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO);
@ -228,7 +228,7 @@ static VOID *PthreadF03(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < 4; i++) { // append 4 times to 1M for (i = 0; i < 4; i++) { // append 4 times to 1M
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(bufname, S_IRWXU | S_IRWXG | S_IRWXO);

View File

@ -77,23 +77,23 @@ static UINT32 TestCase(VOID)
(void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb (void)memset_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, 0, 16 * BYTES_PER_KBYTES + 1); // 16 kb
for (j = 0; j < 16; j++) { // loop 16 times for (j = 0; j < 16; j++) { // loop 16 times
(void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb
(void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb
(void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb
(void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES, filebuf); // 16kb (void)strcat_s(bufWrite2, 16 * BYTES_PER_KBYTES + 1, filebuf); // 16kb
} }
for (i = 0; i < 4; i++) { // loop 4 times for (i = 0; i < 4; i++) { // loop 4 times
(void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb
(void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb
(void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb
(void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES, bufWrite2); // 256kb (void)strcat_s(bufWrite1, 256 * BYTES_PER_KBYTES + 1, bufWrite2); // 256kb
} }
for (i = 0; i < 5; i++) { // loop 5 times for (i = 0; i < 5; i++) { // loop 5 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 5 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);
free(bufWrite2); free(bufWrite2);

View File

@ -214,8 +214,8 @@ static VOID *PthreadF02(void *arg)
} }
for (i = 0; i < 10; i++) { // loop 10 times for (i = 0; i < 10; i++) { // loop 10 times
(void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB
(void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB (void)strcat_s(bufWrite, 10 * BYTES_PER_MBYTES + 1, bufWrite1); // 10 * BYTES_PER_MBYTES = 10MB
} }
free(bufWrite1); free(bufWrite1);
free(bufWrite2); free(bufWrite2);
@ -331,11 +331,11 @@ static UINT32 TestCase(VOID)
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2);
ret = PosixPthreadDestroy(&attr1, newThread1); ret = PosixPthreadDestroy(&attr1, newThread1);
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT1);
printf("\tg_fatFlag=:%d\t", g_fatFlag); printf("\tg_fatFlag=:%d\t", g_fatFlag);
} }
printf("\n"); printf("\n");
ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2); ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT);
dir = opendir(FAT_PATH_NAME); dir = opendir(FAT_PATH_NAME);
ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3);

View File

@ -212,6 +212,7 @@ static VOID *PthreadF02(void *arg)
(void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb
(void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb
(void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb (void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb
(void)strcat_s(bufWrite1, 10 * BYTES_PER_MBYTES + 1, bufWrite2); // 10 mb
} }
free(bufWrite4); free(bufWrite4);
@ -357,7 +358,6 @@ static UINT32 TestCase(VOID)
printf("\tg_fatFlag=:%d\t", g_fatFlag); printf("\tg_fatFlag=:%d\t", g_fatFlag);
} }
printf("\n"); printf("\n");
ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT2);
dir = opendir(FAT_PATH_NAME); dir = opendir(FAT_PATH_NAME);
ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3); ICUNIT_GOTO_NOT_EQUAL(dir, NULL, dir, EXIT3);
@ -368,6 +368,8 @@ static UINT32 TestCase(VOID)
ret = closedir(dir); ret = closedir(dir);
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT3);
ICUNIT_GOTO_EQUAL(g_fatFlag, FAT_PRESSURE_CYCLES, g_fatFlag, EXIT);
ret = rmdir(FAT_PATH_NAME); ret = rmdir(FAT_PATH_NAME);
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT);

View File

@ -75,9 +75,9 @@ static UINT32 TestCase(VOID)
for (i = 0; i < 50; i++) { // loop 50 times for (i = 0; i < 50; i++) { // loop 50 times
(void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); (void)memset_s(bufname, FAT_SHORT_ARRAY_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH);
(void)memset_s(pathname2[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_SHORT_ARRAY_LENGTH); (void)memset_s(pathname2[i], FAT_STANDARD_NAME_LENGTH, 0, FAT_STANDARD_NAME_LENGTH);
(void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i); (void)snprintf_s(bufname, FAT_SHORT_ARRAY_LENGTH, FAT_SHORT_ARRAY_LENGTH, "/test%d", i);
FatStrcat2(pathname2[i], bufname, strlen(bufname)); FatStrcat2(pathname2[i], bufname, FAT_STANDARD_NAME_LENGTH);
ret = mkdir(pathname2[i], S_IRWXU | S_IRWXG | S_IRWXO); ret = mkdir(pathname2[i], S_IRWXU | S_IRWXG | S_IRWXO);
ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2); ICUNIT_GOTO_EQUAL(ret, FAT_NO_ERROR, ret, EXIT2);

View File

@ -51,7 +51,7 @@ static VOID *PthreadF01(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
index = 0; index = 0;
@ -186,7 +186,7 @@ static VOID *PthreadF02(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
index = 0; index = 0;
@ -320,7 +320,7 @@ static VOID *PthreadF03(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
index = 0; index = 0;

View File

@ -52,7 +52,7 @@ static VOID *PthreadF01(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
printf("In %s,line %d\n", __FUNCTION__, __LINE__); printf("In %s,line %d\n", __FUNCTION__, __LINE__);
index = 0; index = 0;
@ -179,7 +179,7 @@ static VOID *PthreadF02(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
printf("In %s,line %d\n", __FUNCTION__, __LINE__); printf("In %s,line %d\n", __FUNCTION__, __LINE__);
@ -307,7 +307,7 @@ static VOID *PthreadF03(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
printf("In %s,line %d\n", __FUNCTION__, __LINE__); printf("In %s,line %d\n", __FUNCTION__, __LINE__);

View File

@ -51,7 +51,7 @@ static VOID *PthreadF01(void *arg)
printf("pthread_f01 is excecuting\n"); printf("pthread_f01 is excecuting\n");
bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1);
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb
bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2);
@ -76,8 +76,8 @@ static VOID *PthreadF01(void *arg)
} }
for (i = 0; i < 2; i++) { // loop 2 times for (i = 0; i < 2; i++) { // loop 2 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);
@ -157,7 +157,7 @@ static VOID *PthreadF02(void *arg)
printf("pthread_f02 is excecuting\n"); printf("pthread_f02 is excecuting\n");
bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1);
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb
bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2);
@ -182,8 +182,8 @@ static VOID *PthreadF02(void *arg)
} }
for (i = 0; i < 2; i++) { // loop 2 times for (i = 0; i < 2; i++) { // loop 2 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);
@ -263,7 +263,7 @@ static VOID *PthreadF03(void *arg)
printf("pthread_f03 is excecuting\n"); printf("pthread_f03 is excecuting\n");
bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1);
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb
bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2);
@ -288,8 +288,8 @@ static VOID *PthreadF03(void *arg)
} }
for (i = 0; i < 2; i++) { // loop 2 times for (i = 0; i < 2; i++) { // loop 2 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);

View File

@ -53,7 +53,7 @@ static VOID *PthreadF01(void *arg)
bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1);
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb
bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2);
@ -78,8 +78,8 @@ static VOID *PthreadF01(void *arg)
} }
for (i = 0; i < 2; i++) { // loop 2 times for (i = 0; i < 2; i++) { // loop 2 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);
@ -239,7 +239,7 @@ static VOID *PthreadF02(void *arg)
bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1);
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb
bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2);
@ -264,8 +264,8 @@ static VOID *PthreadF02(void *arg)
} }
for (i = 0; i < 2; i++) { // loop 2 times for (i = 0; i < 2; i++) { // loop 2 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);
@ -425,7 +425,7 @@ static VOID *PthreadF03(void *arg)
bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB bufWrite = (CHAR *)malloc(4 * BYTES_PER_MBYTES + 1); // 4MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1); ICUNIT_GOTO_NOT_EQUAL(bufWrite, NULL, 0, EXIT1);
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb (void)memset_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, 0, 4 * BYTES_PER_MBYTES + 1); // 4mb
bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB bufWrite1 = (CHAR *)malloc(BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2); ICUNIT_GOTO_NOT_EQUAL(bufWrite1, NULL, 0, EXIT2);
@ -450,8 +450,8 @@ static VOID *PthreadF03(void *arg)
} }
for (i = 0; i < 2; i++) { // loop 2 times for (i = 0; i < 2; i++) { // loop 2 times
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, bufWrite1); (void)strcat_s(bufWrite, 4 * BYTES_PER_MBYTES + 1, bufWrite1);
} }
free(bufWrite1); free(bufWrite1);

View File

@ -55,7 +55,7 @@ static VOID *PthreadF01(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
index = 0; index = 0;
@ -191,7 +191,7 @@ static VOID *PthreadF02(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
index = 0; index = 0;
@ -327,7 +327,7 @@ static VOID *PthreadF03(void *arg)
(void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB (void)memset_s(bufWrite, BYTES_PER_MBYTES + 1, 0, BYTES_PER_MBYTES + 1); // BYTES_PER_MBYTES = 1MB
for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb for (i = 0; i < BYTES_PER_KBYTES * 4; i++) { // loop in 4 Kb
(void)strcat_s(bufWrite, BYTES_PER_MBYTES, filebuf); (void)strcat_s(bufWrite, BYTES_PER_MBYTES + 1, filebuf);
} }
index = 0; index = 0;

Some files were not shown because too many files have changed in this diff Show More