X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fstress_tester%2Fyaffs_tester.c;fp=direct%2Ftimothy_tests%2Fdev%2Fyaffs_tester.c;h=86dcf4675cb4a143f4f68ffddfae019f37476190;hb=121c055437f23d9d6bc7b57d36ecf128b447013f;hp=65d2d174479756fe4e00a8e0b90d84d29806a592;hpb=d7388fb75a13610d14d0afc397f826bd44c972e1;p=yaffs2.git diff --git a/direct/timothy_tests/dev/yaffs_tester.c b/direct/timothy_tests/stress_tester/yaffs_tester.c similarity index 96% rename from direct/timothy_tests/dev/yaffs_tester.c rename to direct/timothy_tests/stress_tester/yaffs_tester.c index 65d2d17..86dcf46 100644 --- a/direct/timothy_tests/dev/yaffs_tester.c +++ b/direct/timothy_tests/stress_tester/yaffs_tester.c @@ -171,7 +171,7 @@ void open_random_file(char *yaffs_test_dir, handle_regster *P_open_handles_array { generate_random_string(name,MAX_FILE_NAME_SIZE); printf("before %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path)); - join_paths(yaffs_test_dir,name,path);//bug###################### here + join_paths(yaffs_test_dir,name,path); printf("after %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path)); add_to_buffer(&message_buffer,"trying to open file: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT); append_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS,PRINT); @@ -202,7 +202,7 @@ void open_random_file(char *yaffs_test_dir, handle_regster *P_open_handles_array P_open_handles_array->number_of_open_handles++; } - else close_random_file(P_open_handles_array); + else close_random_file(P_open_handles_array); } @@ -271,11 +271,17 @@ void close_random_file(handle_regster *P_open_handles_array){ int x=0; int output=0; int start=0; + printf("trying to clear handle"); if (P_open_handles_array->number_of_open_handles>0){ start=rand() % (MAX_NUMBER_OF_OPENED_HANDLES-1); - for (x=start;P_open_handles_array->handle[x] !=-3 &&(x+1>start ||xstart ||xMAX_NUMBER_OF_OPENED_HANDLES-1) x=0; + if (x>MAX_NUMBER_OF_OPENED_HANDLES-1) x=0; + if (P_open_handles_array->handle[x] !=-3 ){ + //the handle is open, so try to close it. + break; + } } if (P_open_handles_array->handle[x]!=-3) @@ -341,14 +347,17 @@ void test(char*yaffs_test_dir){ open_handles_array.path[x][0]='\0'; } + while(1) { + x=rand() % 3; + printf("running test: %d",x); switch(x){ case 0 :open_random_file(yaffs_test_dir,&open_handles_array);break; - //case 1 :write_to_random_file(&open_handles_array);break; - case 2 :close_random_file(&open_handles_array);break; - case 3 :truncate_random_file(&open_handles_array);break; + case 3 :write_to_random_file(&open_handles_array);break; +// case 1 :close_random_file(&open_handles_array);break; + case 2 :truncate_random_file(&open_handles_array);break; } } }