X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fquick_tests%2Ftest_yaffs_read_EINVAL.c;h=873f0127171a4d46f8112faefcd432e56c3afd20;hp=e3ce96667c53ac0113d892cb88f4ee3752c9515e;hb=137f935f6d622bffdef2fece0c5194e85f5174e9;hpb=6356b32783a8ec97b09f7090c3d10c8b88ea32e5 diff --git a/direct/timothy_tests/quick_tests/test_yaffs_read_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_read_EINVAL.c index e3ce966..873f012 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_read_EINVAL.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_read_EINVAL.c @@ -19,8 +19,8 @@ static char *file_name = NULL; int test_yaffs_read_EINVAL(void) { int error_code = 0; - handle=test_yaffs_open(); - char text[2000000]="\0"; + handle=yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE); + char text[2000000]; int output=0; if (handle<0){ @@ -59,7 +59,29 @@ int test_yaffs_read_EINVAL_clean(void) { int output=0; if (handle>=0){ - output=test_yaffs_read_EINVAL_init_clean(); + if(file_name){ + free(file_name); + file_name = NULL; + } + + + output= yaffs_truncate(FILE_PATH,FILE_SIZE ); + if (output>=0){ + output=test_yaffs_write(); + if (output<0){ + print_message("failed to write to file\n",2); + return -1; + } else { + output=test_yaffs_write_clean(); + if (output<0){ + print_message("failed to clean the write_to_file function\n",2); + } + } + } else { + print_message("failed to truncate file\n",2); + return -1; + } + if(output>=0){ output=yaffs_close(handle); if (output>=0){ @@ -74,6 +96,7 @@ int test_yaffs_read_EINVAL_clean(void) } } else { print_message("no open handle\n",2); + return -1; } } @@ -90,7 +113,7 @@ int test_yaffs_read_EINVAL_init(void) return -1; } - strcat(file_name,YAFFS_MOUNT_POINT); + strcpy(file_name,YAFFS_MOUNT_POINT); for (x=strlen(YAFFS_MOUNT_POINT); x=0){ - output=test_yaffs_write(); - if (output>=0){ - return 1; - } else { - print_message("failed to write to file\n",2); - return -1; - } - } else { - print_message("failed to truncate file\n",2); - return -1; - } - -}