X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fdev%2Fyaffs_tester.c;h=5f1ebcf5f278e3512de6a3743e0c2a9a1bf185d5;hb=baabf1227755653121fcd9e6139636ff9245e2c4;hp=f87498c030782c02a1c1e1d0e07f51489c88f0e1;hpb=0f588711ff1dc901d07f79e3f8ca64137da81602;p=yaffs2.git diff --git a/direct/timothy_tests/dev/yaffs_tester.c b/direct/timothy_tests/dev/yaffs_tester.c index f87498c..5f1ebcf 100644 --- a/direct/timothy_tests/dev/yaffs_tester.c +++ b/direct/timothy_tests/dev/yaffs_tester.c @@ -27,6 +27,12 @@ int simulate_power_failure = 0; buffer message_buffer; /*create message_buffer */ +struct handle_regster{ + int handle[MAX_NUMBER_OF_OPENED_HANDLES]; + char path[MAX_NUMBER_OF_OPENED_HANDLES][100]; + int number_of_open_handles; +}; + int main(int argc, char *argv[]){ char yaffs_test_dir[] ="/yaffs2/test_dir"; /*the path to the directory where all of the testing will take place*/ @@ -153,28 +159,115 @@ void join_paths(char *path1,char *path2,char *new_path ){ } } - +void open_file(); +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); + } +} void test(char*yaffs_test_dir){ - char output=0; + struct yaffs_stat stat; + int output=0; char name[MAX_FILE_NAME_SIZE+3 ]="apple\0"; char path[MAX_FILE_NAME_SIZE]; + struct handle_regster open_handles_array; + //int handle_pointers[MAX_NUMBER_OF_OPENED_HANDLES]; + //int number_of_opened_handles=0; + int x=0; join_paths(yaffs_test_dir,name,path); + + open_handles_array.number_of_open_handles=0; + for (x=0;x2 ; x++)