X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=direct%2Ftest-framework%2Ftimothy_tests%2Fquick_tests%2Ftest_yaffs_rename_file_to_dir.c;h=89f7b689fc9a50e8c5e6612fc872f2571744ce27;hb=a175efe13e14f1be10ed4691cd1b8eee32abc046;hp=efc87d0f2405c031e10a5f4e284b4d1618632405;hpb=e5daa72b0083831ab762a650860687fe7d25d6b3;p=yaffs2.git diff --git a/direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_file_to_dir.c b/direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_file_to_dir.c index efc87d0..89f7b68 100644 --- a/direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_file_to_dir.c +++ b/direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_file_to_dir.c @@ -17,7 +17,10 @@ int test_yaffs_rename_file_to_dir(void) { int output=0; - + if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){ + print_message("failed to create file\n",1); + return -1; + } if (0 != yaffs_access(FILE_PATH,0)) { output = test_yaffs_open(); if (output < 0) { @@ -31,33 +34,21 @@ int test_yaffs_rename_file_to_dir(void) } } } - output = yaffs_rename( "/yaffs2/foo" , RENAME_DIR_PATH); - if (output<0){ - print_message("failed to rename a file over an empty directory\n",2); - return -1; - } else{ - return 1; - } + if (0 != yaffs_access(RENAME_DIR_PATH,0)) { + output = yaffs_mkdir(RENAME_DIR_PATH,S_IWRITE | S_IREAD); + if (output < 0) { + print_message("failed to create directory\n",2); + return -1; + } + } + return 1; } int test_yaffs_rename_file_to_dir_clean(void) { - int output = 0; - test_yaffs_open(); - if (0 == yaffs_access(RENAME_DIR_PATH,0)) { - output = yaffs_unlink(RENAME_DIR_PATH); - if (output < 0) { - print_message("failed to unlink the file\n",2); - return -1; - } - output = test_yaffs_open(); - if (output < 0) { - print_message("failed to open a new\n",2); - return -1; - } - } + return 1; }