X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=direct%2Ftimothy_tests%2FEACCES_bug%2Fyaffs_tester.c;fp=direct%2Ftimothy_tests%2FEACCES_bug%2Fyaffs_tester.c;h=0000000000000000000000000000000000000000;hb=46e033c6f38fd704e51b0846c39cfa21c187759a;hp=81bacf08987b9ce2c3ed0352c62bbf1ba35953a6;hpb=39ff22ba81750ff4bf74329641795776dd0a1da2;p=yaffs2.git diff --git a/direct/timothy_tests/EACCES_bug/yaffs_tester.c b/direct/timothy_tests/EACCES_bug/yaffs_tester.c deleted file mode 100644 index 81bacf0..0000000 --- a/direct/timothy_tests/EACCES_bug/yaffs_tester.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * YAFFS: Yet another FFS. A NAND-flash specific file system. - * - * Copyright (C) 2002-2010 Aleph One Ltd. - * for Toby Churchill Ltd and Brightstar Engineering - * - * Created by Timothy Manning - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/* - * yaffs_tester.c designed to stress test yaffs2 direct. - */ - - -#include "yaffs_tester.h" - - - -int random_seed; -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*/ - char yaffs_mount_dir[]="/yaffs2/"; /*the path to the mount point which yaffs will mount*/ - - init(yaffs_test_dir,yaffs_mount_dir,argc,argv); - test(yaffs_test_dir); - yaffs_unmount(yaffs_mount_dir); - return 0; -} - - - -void init(char *yaffs_test_dir,char *yaffs_mount_dir,int argc, char *argv[]){ - char output=0; - int x=0; - int seed=-1; - FILE *log_handle; - /*these variables are already set to zero, but it is better not to take chances*/ - message_buffer.head=0; - message_buffer.tail=0; - - - log_handle=fopen(LOG_FILE,"w"); - if (log_handle!=NULL){ - fputs("log file for yaffs tester\n",log_handle); - fclose(log_handle); - } - add_to_buffer(&message_buffer,"welcome to the yaffs tester",MESSAGE_LEVEL_BASIC_TASKS,PRINT);/* print boot up message*/ - yaffs_start_up(); - yaffs_mount(yaffs_mount_dir); - for (x=0;x2 ; x++) - { - //printf("x=%d\n",x); - /* keep generating a charecter until the charecter is legal*/ - while((letter=='\0' )||(letter=='/')||(letter=='\\')){ - letter=(rand() % 126-32)+32; /*generate a number between 32 and 126 and uses it as a charecter (letter) */ - } - ptr[x]=letter; - //printf("charecter generated is %c\n",ptr[x]); - } - ptr[x+1]='\0'; /*adds NULL charecter to turn it into a string*/ - -} - -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); - } -} -