X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Ftest-framework%2Funit_tests%2Fis_yaffs_working_tests%2Ftest_1_yaffs_mount.c;fp=direct%2Ftest-framework%2Ftimothy_tests%2Fis_yaffs_working_tests%2Ftest_1_yaffs_mount.c;h=34d658315333be6d2d04a5f473398aaca9fe041f;hp=0d908b11cf04cb3d890e0ff2eba6455891ce3c68;hb=e12e51da5815d80399ec8f5b0da69c7cd7a0f42e;hpb=ebc54da9e29be1de79d77c72c0d8eb91833c641b diff --git a/direct/test-framework/timothy_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 similarity index 69% rename from direct/test-framework/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c rename to direct/test-framework/unit_tests/is_yaffs_working_tests/test_1_yaffs_mount.c index 0d908b1..34d6583 100644 --- a/direct/test-framework/timothy_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 @@ -12,8 +12,8 @@ #include "yaffsfs.h" -#define YAFFS_MOUNT_POINT "/yaffs2/" -#define FILE_PATH "/yaffs2/foo.txt" +#define YAFFS_MOUNT_POINT "/yflash2/" +#define FILE_PATH "/yflash2/foo.txt" int random_seed; int simulate_power_failure = 0; @@ -30,67 +30,69 @@ int main() output = yaffs_mount(YAFFS_MOUNT_POINT); if (output>=0){ - printf("yaffs mounted: %s\n",YAFFS_MOUNT_POINT); + 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); + printf("error\n yaffs failed to mount: %s\n with error code %d\n",YAFFS_MOUNT_POINT, yaffs_get_error()); + + return (-1); } //now create a file. output = yaffs_open(FILE_PATH,O_CREAT | O_RDWR, S_IREAD | S_IWRITE); if (output>=0){ - printf("file created: %s\n",FILE_PATH); + 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("file closed: %s\n",FILE_PATH); + 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); if (output>=0){ - printf("yaffs unmounted: %s\n",YAFFS_MOUNT_POINT); + 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 mounted: %s\n",YAFFS_MOUNT_POINT); + 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); if (output>=0){ - printf("file created: %s\n",FILE_PATH); + 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); if (output2>=0){ - printf("file closed: %s\n",FILE_PATH); + 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. output = yaffs_unmount(YAFFS_MOUNT_POINT); if (output>=0){ - printf("yaffs unmounted: %s\n",YAFFS_MOUNT_POINT); + 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); }