yaffs trying to delete files
[yaffs2.git] / direct / timothy_tests / EACCES_bug / yaffs_tester.c
index 408e8882dbac128f359cbe2d11b4f178162e9e49..81bacf08987b9ce2c3ed0352c62bbf1ba35953a6 100644 (file)
@@ -203,7 +203,7 @@ void test(char*yaffs_test_dir){
                                append_int_to_buffer(&message_buffer,stat.st_mode,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
                        }
                        else {
-                               add_to_buffer(&message_buffer,"file does not exists, creating file",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+                               add_to_buffer(&message_buffer,"file does not exists, creating file",MESSAGE_LEVEL_BASIC_TASKS,PRINT);
                        }
 
                        output=yaffs_open(path,O_CREAT | O_TRUNC| O_RDWR, S_IREAD | S_IWRITE);
@@ -266,3 +266,25 @@ void  generate_random_string(char *ptr){
        
 }
 
+void stat_file(char *path){
+       int output=0;
+       struct yaffs_stat stat;
+       if (yaffs_access(path,0)==0){
+               add_to_buffer(&message_buffer,"file exists, trying to stat: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+               add_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
+               output=yaffs_lstat(path,&stat);
+               yaffs_check_for_errors(output, &message_buffer,"failed to stat file","statted file");
+               //stat.st_ino,(int)stat.st_size,stat.st_mode
+               add_to_buffer(&message_buffer,"yaffs inode: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+               append_int_to_buffer(&message_buffer,stat.st_ino,MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+               append_to_buffer(&message_buffer," file size: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+               append_int_to_buffer(&message_buffer,(int)stat.st_size,MESSAGE_LEVEL_BASIC_TASKS,NPRINT);                       
+               append_to_buffer(&message_buffer," file mode: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+               append_int_to_buffer(&message_buffer,stat.st_mode,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
+       }
+       else{
+               add_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
+               append_to_buffer(&message_buffer," does not exist,could not stat",MESSAGE_LEVEL_BASIC_TASKS,PRINT);
+       }
+}
+