From 9123fa7a03b5a90b4c292d7f50c98d47413ab234 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Mon, 8 Nov 2010 14:07:58 +1300 Subject: [PATCH] yaffs Pulled the bugs section out of the README.txt and put it into current_bugs.txt Signed-off-by: Timothy Manning --- direct/timothy_tests/found_bugs.txt | 58 ------------------- direct/timothy_tests/quick_tests/Makefile | 4 +- direct/timothy_tests/quick_tests/README.txt | 43 +++++--------- .../quick_tests/current_bugs.txt | 14 +++++ .../timothy_tests/quick_tests/quick_tests.h | 8 +++ .../quick_tests/test_yaffs_access_EINVAL.c | 38 ++++++++++++ .../quick_tests/test_yaffs_access_EINVAL.h | 24 ++++++++ .../quick_tests/test_yaffs_mount_EBUSY.c | 42 ++++++++++++++ .../quick_tests/test_yaffs_mount_EBUSY.h | 24 ++++++++ .../quick_tests/test_yaffs_unlink_ENOENT.c | 14 ++--- .../quick_tests/test_yaffs_unlink_ENOENT.h | 1 + 11 files changed, 172 insertions(+), 98 deletions(-) delete mode 100644 direct/timothy_tests/found_bugs.txt create mode 100644 direct/timothy_tests/quick_tests/current_bugs.txt create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.h diff --git a/direct/timothy_tests/found_bugs.txt b/direct/timothy_tests/found_bugs.txt deleted file mode 100644 index e24443c..0000000 --- a/direct/timothy_tests/found_bugs.txt +++ /dev/null @@ -1,58 +0,0 @@ -Found bugs in yaffs - -Error code 0 bug (run out of handles) - By opening lots of files and not closing them yaffs can run out of handles. - The error code given by yaffs_get_error() returns 0. this error is not defined in yportenv.h - - -ENOENT error is generated when opening a new file with O_CREATE. - This should not be happening and has been logged as an error. - To regenerate this error remove the emfile and use the seed 1288064149 - -EACCES error - This program tries to open a new file in yaffs. The yaffs_open() function returns a -1 handle and gives an error of EACCES. - This bug only seems to happen when the emfile has a lot of files in it. - -Mkdir with slash error - Yaffs' mkdir function will not work if the path ends in a slash. - i.e. /yaffs2/new_dir/ - This is a known bug and is not likely to be fixed. - To get around this bug remove the slash on the end. - i.e. /yaffs2/new_dir - - - -BUG in yaffs caused by the program yaffs_importer.py in /direct/python/ - when the emfile is full yaffs gives these errors when trying to open a file: - -('adding path ', '/yaffs2/', ' to ', 'yaffs2/direct/basic-test/yaffs_tagscompat.o', ' resulting path: ', '/yaffs2/yaffs2/direct/basic-test/yaffs_tagscompat.o') -('creating file:', '/yaffs2/yaffs2/direct/basic-test/yaffs_tagscompat.o') -('mode', 33188) -opening file -erase block 248 -('current_handle', -1) -yaffs free space: 0 -yaffs is out of space exiting program -error with yaffs lseeking -error###################################### -('error code', -9) -error message EBADF -('length of data to be written', 25944) -('error writing file:', -1) -error###################################### -('error code', -9) -error message EBADF -('error truncating file:', -1) -error###################################### -('error code', -9) -error message EBADF -('error closing file:', -1) -error###################################### -('error code', -9) -error message EBADF -('error chmoding file:', -1) -error###################################### -('error code', -2) -error message ENOENT - - yaffs should be giving a no memory error insted of a EBADF. diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index b69ee0a..0fbfbc5 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -45,7 +45,7 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsf # yaffs_checkptrwtest.o\ TESTFILES = quick_tests.o lib.o \ - test_yaffs_mount.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.o test_yaffs_mount_ENOENT.o\ + test_yaffs_mount.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.o test_yaffs_mount_ENOENT.o test_yaffs_mount_EBUSY.o \ test_yaffs_unmount.o\ test_yaffs_open.o test_yaffs_open_ENOENT.o test_yaffs_open_ENOTDIR.o test_yaffs_open_EEXIST.o test_yaffs_open_EISDIR.o test_yaffs_open_ENAMETOOLONG.o \ test_yaffs_unlink.o test_yaffs_unlink_EISDIR.o test_yaffs_unlink_ENOENT.o test_yaffs_unlink_ENAMETOOLONG.o test_yaffs_unlink_ENOTDIR.o\ @@ -53,7 +53,7 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_write.o \ test_yaffs_read.o \ test_yaffs_lseek.o \ - test_yaffs_access.o \ + test_yaffs_access.o test_yaffs_access_EINVAL.o \ test_yaffs_stat.o \ test_yaffs_close_EBADF.o diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt index a6b984e..fbf7b60 100644 --- a/direct/timothy_tests/quick_tests/README.txt +++ b/direct/timothy_tests/quick_tests/README.txt @@ -2,14 +2,12 @@ Made by Timothy Manning on 04/11/2010 -the yaffs_open function has been covered by tests -the yaffs_close function has been covered by tests - tests made test_yaffs_mount test_yaffs_mount_ENODEV test_yaffs_mount_ENAMETOOLONG test_yaffs_mount_ENOENT + test_yaffs_mount_EBUSY //called when trying to mount a new mount point with a mount point already mounted. test_yaffs_access test_yaffs_close_EBADF test_yaffs_ftruncate @@ -28,6 +26,7 @@ tests made test_yaffs_unlink_ENAMETOOLONG test_yaffs_unlink_ENOENT test_yaffs_unlink_ENOTDIR + test_yaffs_unlink_ENOENT test_yaffs_unmount test_yaffs_write @@ -37,12 +36,12 @@ tests to add test_yaffs_mount_EINVAL //Cannot be generated with yaffs. test_yaffs_mount_ELOOP //Cannot be generated with yaffs. test_yaffs_mount_EMFILE //Cannot be generated with yaffs. - - test_yaffs_mount_ENOTDIR //Cannot be generated with yaffs. - test_yaffs_mount_EBUSY //called when trying to mount a new mount point with a mount point already mounted. - test_yaffs_unmount ->all error + test_yaffs_umount_ENODEV + test_yaffs_umount_ENAMETOOLONG + test_yaffs_umount_ENOENT + test_yaffs_umount_EBUSY test_yaffs_open_EACCES test_yaffs_open_ENOSPC @@ -53,7 +52,6 @@ tests to add test_yaffs_unlink_EACCES test_yaffs_unlink_ELOOP - test_yaffs_unlink_ENOENT test_yaffs_unlink_ENOMEM test_yaffs_access_EACCESS @@ -100,44 +98,31 @@ How to add a test The name of first function needs to be called the same as the file name (without the .c or .h) The second function's name needs be the same as the first function but with "_clean" added on the end. - So if a test is been created for the yaffs function yaffs_fish() then create these files - Test_yaffs_fish.c - Contains int test_yaffs_fish(void); int test_yaffs_fish_clean(void); - Test_yaffs_fish.h + So if a test is been created for the yaffs function yaffs_foo() then create these files + test_yaffs_foo.c + Contains int test_yaffs_foo(void); int test_yaffs_foo_clean(void); + test_yaffs_foo.h Which includes "lib.h", "yaffsfs.h" header files. Next write the test code in these files then add these files to the Makefile. - Add the name of the test files' object file (test_yaffs_fish.o ) to the TESTFILES tag around line 50 of the Makefile. - - + Add the name of the test files' object file (test_yaffs_foo.o ) to the TESTFILES tag around line 50 of the Makefile. Now add the test functions to the test_list[] array in quick_tests.h The order of the tests matters. The idea is to test each yaffs_function individualy and only using tested yaffs_components before using this new yaffs_function. This array consists of: {[test function], [the clean function], [name of the tests which will be printed when the test fails]}, - So add this line to the test_list[]: {test_yaffs_fish, test_yaffs_fish_clean, "test_yaffs_fish"}, + So add this line to the test_list[]: {test_yaffs_foo, test_yaffs_foo_clean, "test_yaffs_foo"}, - Also include the test's .h file in the quick_test.h file: #include "test_yaffs_fish.h" + Also include the test's .h file in the quick_test.h file: #include "test_yaffs_foo.h" The test file should now make and run(you may need to make clean first). - PS: yaffs_fish() is a made up function for this README (in case you want to try and find this function in yaffs). + PS: yaffs_foo() is a made up function for this README (in case you want to find this function in yaffs). -BUGS AND WARNINGS - bug with opening a file with a name of 1,000,000 char long with no errors. - bug with unlinking a file with 1,000,000 get the error ENOENT but should be geting ENAMETOOLONG. - bug with mounting a too long non-existant mount point. there are two errors here, ENOENT and ENAMETOOLONG. - bug with mounting a non-existing mount point get the error ENODEV. should be getting ENOENT. - - WARNING- If yaffs is unmounted then most functions return ENODIR. - - FIXED-remove the printf which prints yaffs_mounting. - FIXED-ENOSPC error in programs test_yaffs_open_ENOTDIR and test_yaffs_open_ENOENT. - FIXED-ENOENT been returned by yaffs_read but the handle is good and the yaffs_open function does not return an error. diff --git a/direct/timothy_tests/quick_tests/current_bugs.txt b/direct/timothy_tests/quick_tests/current_bugs.txt new file mode 100644 index 0000000..9243fd2 --- /dev/null +++ b/direct/timothy_tests/quick_tests/current_bugs.txt @@ -0,0 +1,14 @@ + +Made by Timothy Manning on 08/11/2010 + + +Current BUGS AND WARNINGS + bug with opening a file with a name of 1,000,000 char long with no errors. + bug with unlinking a file with 1,000,000 get the error ENOENT but should be geting ENAMETOOLONG. + bug with mounting a too long non-existant mount point is returning ENODEV. there are two errors here, ENOENT and ENAMETOOLONG. + bug with mounting a non-existing mount point get the error ENODEV. should be getting ENOENT. + + bug when trying to use yaffs_access on an existing file with mode 255 the error returned is EACCES it should be EINVAL(note there is no quick test file yet). + + WARNING- If yaffs is unmounted then most functions return ENODIR. + diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 429771d..18a35b1 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -21,6 +21,7 @@ #include "test_yaffs_mount_ENODEV.h" #include "test_yaffs_mount_ENAMETOOLONG.h" #include "test_yaffs_mount_ENOENT.h" +#include "test_yaffs_mount_EBUSY.h" #include "test_yaffs_unmount.h" @@ -39,13 +40,17 @@ #include "test_yaffs_unlink_ENOENT.h" #include "test_yaffs_unlink_ENAMETOOLONG.h" #include "test_yaffs_unlink_ENOTDIR.h" +#include "test_yaffs_unlink_ENOENT.h" #include "test_yaffs_ftruncate.h" #include "test_yaffs_truncate.h" #include "test_yaffs_write.h" #include "test_yaffs_read.h" #include "test_yaffs_lseek.h" + #include "test_yaffs_access.h" +#include "test_yaffs_access_EINVAL.h" + #include "test_yaffs_stat.h" #include "yaffsfs.h" #include "yaffs_error_converter.h" @@ -67,6 +72,7 @@ test_template test_list[]={ {test_yaffs_mount_ENODEV,test_yaffs_mount_ENODEV_clean,"test_yaffs_mount_ENODEV"}, {test_yaffs_mount_ENAMETOOLONG,test_yaffs_mount_ENAMETOOLONG_clean,"test_yaffs_mount_ENAMETOOLONG"}, {test_yaffs_mount_ENOENT,test_yaffs_mount_ENOENT_clean,"test_yaffs_mount_ENOENT"}, + {test_yaffs_mount_EBUSY,test_yaffs_mount_EBUSY_clean,"test_yaffs_mount_EBUSY"}, {test_yaffs_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"}, @@ -80,12 +86,14 @@ test_template test_list[]={ {test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"}, {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"}, + {test_yaffs_access_EINVAL,test_yaffs_access_EINVAL_clean,"test_yaffs_access_EINVAL"}, {test_yaffs_unlink, test_yaffs_unlink_clean,"test_yaffs_unlink"}, {test_yaffs_unlink_EISDIR,test_yaffs_unlink_EISDIR_clean,"test_yaffs_unlink_EISDIR"}, {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"}, {test_yaffs_unlink_ENAMETOOLONG,test_yaffs_unlink_ENAMETOOLONG_clean,"test_yaffs_unlink_ENAMETOOLONG"}, {test_yaffs_unlink_ENOTDIR,test_yaffs_unlink_ENOTDIR_clean,"test_yaffs_unlink_ENOTDIR"}, + {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"}, {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.c new file mode 100644 index 0000000..cec0389 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.c @@ -0,0 +1,38 @@ +/* + * 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. + */ + +#include "test_yaffs_access_EINVAL.h" + +int test_yaffs_access_EINVAL(void){ + int output=0; + int error=0; + output= yaffs_access(FILE_PATH,255); + if (output<0){ + error=yaffs_get_error(); + if ( abs(error)== EINVAL){ + return 1; + } + else { + printf("error does not match expected error\n"); + return -1; + } + } + else{ + printf("accessed an existing file with bad mode (which is a bad thing\n"); + return -1; + } +} + +int test_yaffs_access_EINVAL_clean(void){ + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.h new file mode 100644 index 0000000..b13a1a0 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_EINVAL.h @@ -0,0 +1,24 @@ +/* + * YAFFS: Yet another Flash File System . 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 Lesser General Public License version 2.1 as + * published by the Free Software Foundation. + * + * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. + */ + +#ifndef __test_yaffs__access_EINVAL_h__ +#define __test_yaffs_access_EINVAL_h__ +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" +#include "test_yaffs_lseek.h" +int test_yaffs_access_EINVAL(void); +int test_yaffs_access_EINVAL_clean(void); +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.c b/direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.c new file mode 100644 index 0000000..eb08ef2 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.c @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#include "test_yaffs_mount_EBUSY.h" + + +int test_yaffs_mount_EBUSY(void){ + int output=0; + int error_code=0; + + output=yaffs_mount(YAFFS_MOUNT_POINT); + if (output==-1){ + error_code=yaffs_get_error(); + //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code); + if (abs(error_code)==EBUSY){ + return 1; + } + else { + printf("different error than expected\n"); + return -1; + } + } + else if (output >=0){ + printf("mounted the same mount point twice.(which is a bad thing)\n"); + return -1; + } + +} +int test_yaffs_mount_EBUSY_clean(void){ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.h b/direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.h new file mode 100644 index 0000000..5c34869 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mount_EBUSY.h @@ -0,0 +1,24 @@ +/* + * YAFFS: Yet another Flash File System . 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 Lesser General Public License version 2.1 as + * published by the Free Software Foundation. + * + * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. + */ + +#ifndef __test_yaffs_mount_EBUSY_h__ +#define __test_yaffs_mount_EBUSY_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_mount_EBUSY(void); +int test_yaffs_mount_EBUSY_clean(void); +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.c index 50803e5..8821257 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.c @@ -11,9 +11,7 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_unlink_EISDIR.h" - -/*EISDIR is caused by trying to unlink a directory */ +#include "test_yaffs_unlink_ENOENT.h" static int handle=0; int test_yaffs_unlink_ENOENT(void){ @@ -23,8 +21,7 @@ int test_yaffs_unlink_ENOENT(void){ handle=yaffs_unlink("/yaffs2/non_existant_file"); if (handle==-1){ error_code=yaffs_get_error(); - //printf("ENOENT def %d, Error code %d\n", EISDIR,error_code); - if (abs(error_code)== ENOENT){ + if (abs(error_code)==ENOENT){ return 1; } else { @@ -33,15 +30,14 @@ int test_yaffs_unlink_ENOENT(void){ } } else if (output >=0){ - printf("directory unlinked opened.(which is a bad thing)\n"); + printf("non existant file unlinked.(which is a bad thing)\n"); return -1; } - /* the program should not get here but the compiler is complaining */ - return -1; + } int test_yaffs_unlink_ENOENT_clean(void){ if (handle >=0){ - return yaffs_close(handle); + return test_yaffs_open(); } else { return 1; /* the file failed to open so there is no need to close it*/ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.h index f13ca0c..ec95fd7 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT.h @@ -18,6 +18,7 @@ #include "lib.h" #include "yaffsfs.h" +#include "test_yaffs_open.h" int test_yaffs_unlink_ENOENT(void); int test_yaffs_unlink_ENOENT_clean(void); -- 2.30.2