From c24bee1cc0b575642cb95dd741061e29766963ff Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 25 Mar 2021 09:12:59 -0400 Subject: [PATCH 1/2] Fix #929, use test function for osal_id_t Do not initialize or compare osal_id_t directly to integers, use the provided comparison function. --- src/tests/file-api-test/file-api-test.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 7a1f7de7f..9f38d93aa 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -173,10 +173,9 @@ void TestCreatRemove(void) UtAssert_True(status == OS_SUCCESS, "status after remove max name length file = %d", (int)status); /* try creating with file name too big, should fail */ - fd = ~OS_OBJECT_ID_UNDEFINED; status = OS_OpenCreate(&fd, longfilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE); UtAssert_True(status < OS_SUCCESS, "status after create file name too long = %d", (int)status); - UtAssert_UINT32_EQ(fd, OS_OBJECT_ID_UNDEFINED); + UtAssert_True(!OS_ObjectIdDefined(fd), "fd == OS_OBJECT_ID_UNDEFINED"); /* try removing with file name too big. Should Fail */ status = OS_remove(longfilename); @@ -235,10 +234,9 @@ void TestOpenClose(void) UtAssert_True(status != OS_SUCCESS, "status after close = %d", (int)status); /* open a file that was never in the system */ - fd = ~OS_OBJECT_ID_UNDEFINED; status = OS_OpenCreate(&fd, "/drive0/FileNotHere", OS_FILE_FLAG_NONE, OS_READ_ONLY); UtAssert_True(status < OS_SUCCESS, "status after open = %d", (int)status); - UtAssert_UINT32_EQ(fd, OS_OBJECT_ID_UNDEFINED); + UtAssert_True(!OS_ObjectIdDefined(fd), "fd == OS_OBJECT_ID_UNDEFINED"); /* try removing the file from the drive to end the function */ status = OS_remove(filename); From bb0d8bd71cf43fa98f0fbd7418dd7b2106727a3c Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 31 Mar 2021 10:04:11 -0400 Subject: [PATCH 2/2] Fix #929, print object ids in test case --- src/tests/file-api-test/file-api-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/file-api-test/file-api-test.c b/src/tests/file-api-test/file-api-test.c index 9f38d93aa..a0ced207f 100644 --- a/src/tests/file-api-test/file-api-test.c +++ b/src/tests/file-api-test/file-api-test.c @@ -175,7 +175,7 @@ void TestCreatRemove(void) /* try creating with file name too big, should fail */ status = OS_OpenCreate(&fd, longfilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE); UtAssert_True(status < OS_SUCCESS, "status after create file name too long = %d", (int)status); - UtAssert_True(!OS_ObjectIdDefined(fd), "fd == OS_OBJECT_ID_UNDEFINED"); + UtAssert_True(!OS_ObjectIdDefined(fd), "fd(%lu) not defined", OS_ObjectIdToInteger(fd)); /* try removing with file name too big. Should Fail */ status = OS_remove(longfilename); @@ -236,7 +236,7 @@ void TestOpenClose(void) /* open a file that was never in the system */ status = OS_OpenCreate(&fd, "/drive0/FileNotHere", OS_FILE_FLAG_NONE, OS_READ_ONLY); UtAssert_True(status < OS_SUCCESS, "status after open = %d", (int)status); - UtAssert_True(!OS_ObjectIdDefined(fd), "fd == OS_OBJECT_ID_UNDEFINED"); + UtAssert_True(!OS_ObjectIdDefined(fd), "fd(%lu) not defined", OS_ObjectIdToInteger(fd)); /* try removing the file from the drive to end the function */ status = OS_remove(filename);