X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Ftimothy_tests%2Fmirror_tests%2Fmirror_tests.c;h=aa9cd5bbf36be46ab30e761172a6ed56c611a25a;hp=90caf454f77df758da61de898d12f2cd5a4c372b;hb=d76a8e5c63fb87e0f5a1f4554943ffb9634f36c6;hpb=fe192b14d52d6c7d4722402686dcb553153916c3 diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.c b/direct/timothy_tests/mirror_tests/mirror_tests.c index 90caf45..aa9cd5b 100644 --- a/direct/timothy_tests/mirror_tests/mirror_tests.c +++ b/direct/timothy_tests/mirror_tests/mirror_tests.c @@ -48,11 +48,26 @@ test_temp linux_tests={ } }; +const struct option long_options[]={ + {"help", 0,NULL,'h'}, + {"yaffs_path", 1,NULL,'y'}, + {"linux_path", 1,NULL,'l'}, + {"print_level", 1,NULL,'p'}, + {"quiet", 0,NULL,'q'}, + {"number", 1,NULL,'n'}, + {"seed", 1,NULL,'s'}, + {"trace", 1,NULL,'t'}, + {"clean", 0,NULL,'c'}, + {"verbose", 0,NULL,'v'} +}; + +const char short_options[]="hy:l:p:qn:s:t:cv"; + int main(int argc, char *argv[]) { char message[100]; - int x; + // yaffs_tests.num_of_tests=(sizeof(yaffs_tests)/sizeof(test_temp)); // linux_tests.num_of_tests=(sizeof(linux_tests)/sizeof(test_temp)); @@ -79,6 +94,7 @@ void init(int argc, char *argv[]) dir[0]='\0'; int x=-1; char message[100]; + int new_option; x=(unsigned)time(NULL); sprintf(message,"seeding srand with: %d\n",x); @@ -98,8 +114,9 @@ void init(int argc, char *argv[]) strcpy(yaffs_struct.root_path,"yaffs2/test/"); - for (x=0;xd_name); print_message(7,"opened file: "); print_message(7,message); print_message(7,"\n"); } - if (NULL!=linux_current_file && + if (linux_current_file && 0!=strcmp(message,".")&& 0!=strcmp(message,"..")){ strcpy(file_name,linux_current_file->d_name); @@ -441,14 +464,14 @@ int compare_linux_and_yaffs(arg_temp *args_struct) //print remaining files for (x=0;xd_name); - sprintf(message,"unlinking file %d\n",linux_current_file->d_name); + sprintf(message,"unlinking file %s\n",file); print_message(3,message); - unlink(file); + print_message(3,"chmoding file\n"); + output=chmod(file,(S_IRUSR|S_IWUSR)); + if (output<0) { + get_error_linux(); + } + print_message(3,"unlinking file\n"); + output=unlink(file); + if (output<0) { + get_error_linux(); + } } - } + } while(linux_current_file); closedir(linux_open_dir); rmdir(linux_struct.root_path); }