From d76a8e5c63fb87e0f5a1f4554943ffb9634f36c6 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Thu, 23 Dec 2010 13:15:24 +1300 Subject: [PATCH] yaffs Made some updates to direct/timothy_tests/mirror_tests Signed-off-by: Timothy Manning --- .../timothy_tests/mirror_tests/mirror_tests.c | 80 +++++++++++++------ .../timothy_tests/mirror_tests/mirror_tests.h | 1 + 2 files changed, 58 insertions(+), 23 deletions(-) diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.c b/direct/timothy_tests/mirror_tests/mirror_tests.c index 8c7574e..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); - 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); } diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.h b/direct/timothy_tests/mirror_tests/mirror_tests.h index cf4bb8e..31b6c14 100644 --- a/direct/timothy_tests/mirror_tests/mirror_tests.h +++ b/direct/timothy_tests/mirror_tests/mirror_tests.h @@ -24,6 +24,7 @@ #include "yaffsfs.h" #include "lib.h" #include +#include #include #include "linux_test_open.h" -- 2.30.2