From da53061642d024650a28b46242c8f3c5becb8d09 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Wed, 28 Jul 2021 12:08:15 +1200 Subject: [PATCH] Fixed the return codes in is_yaffs_working_tests Signed-off-by: Timothy Manning --- .../is_yaffs_working_tests/test_1_yaffs_mount.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c b/direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c index 00a16ed..34d6583 100644 --- a/direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c +++ b/direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c @@ -34,7 +34,7 @@ int main() } else { printf("error\n yaffs failed to mount: %s\n with error code %d\n",YAFFS_MOUNT_POINT, yaffs_get_error()); - return (0); + return (-1); } //now create a file. output = yaffs_open(FILE_PATH,O_CREAT | O_RDWR, S_IREAD | S_IWRITE); @@ -42,14 +42,14 @@ int main() printf("yaffs correctly created a the file: %s\n",FILE_PATH); } else { printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH); - return (0); + return (-1); } output2 = yaffs_close(output); if (output2>=0){ printf("yaffs correctly closed the file: %s\n",FILE_PATH); } else { printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH); - return (0); + return (-1); } //unmount and remount the mount point. output = yaffs_unmount(YAFFS_MOUNT_POINT); @@ -57,14 +57,14 @@ int main() printf("yaffs correctly unmounted: %s\n",YAFFS_MOUNT_POINT); } else { printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT); - return (0); + return (-1); } output = yaffs_mount(YAFFS_MOUNT_POINT); if (output>=0){ printf("yaffs correctly mounted: %s\n",YAFFS_MOUNT_POINT); } else { printf("error\n yaffs failed to mount: %s\nerror\n",YAFFS_MOUNT_POINT); - return (0); + return (-1); } //now open the existing file. output = yaffs_open(FILE_PATH, O_RDWR, S_IREAD | S_IWRITE); @@ -72,7 +72,7 @@ int main() printf("yaffs correctly opened the file: %s\n",FILE_PATH); } else { printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH); - return (0); + return (-1); } //close the file. output2 = yaffs_close(output); @@ -80,7 +80,7 @@ int main() printf("yaffs correctly closed the file: %s\n",FILE_PATH); } else { printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH); - return (0); + return (-1); } //unmount the mount point. @@ -89,9 +89,10 @@ int main() printf("yaffs correctly unmounted: %s\n",YAFFS_MOUNT_POINT); } else { printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT); - return (0); + return (-1); } printf("test passed. yay!\n"); + return(0); } -- 2.30.2