From a11dd4924d16a4c3d6df13a4182f7729a1478a53 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Thu, 4 Nov 2010 14:17:27 +1300 Subject: [PATCH] yaffs Added a README file and some more tests. Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/Makefile | 3 +- direct/timothy_tests/quick_tests/README.txt | 59 ++++++++++++++++++ direct/timothy_tests/quick_tests/lib.c | 13 ++++ direct/timothy_tests/quick_tests/lib.h | 15 +++++ .../timothy_tests/quick_tests/quick_tests.c | 62 +++++-------------- .../timothy_tests/quick_tests/quick_tests.h | 53 +++++++++++++++- .../quick_tests/test_mount_yaffs.c | 15 ++++- .../quick_tests/test_mount_yaffs.h | 17 +++++ .../quick_tests/test_yaffs_access.c | 13 ++++ .../quick_tests/test_yaffs_access.h | 15 +++++ .../quick_tests/test_yaffs_close.c | 0 .../quick_tests/test_yaffs_close.h | 0 .../quick_tests/test_yaffs_close_EBADF.c | 62 +++++++++++++++++++ .../quick_tests/test_yaffs_close_EBADF.h | 24 +++++++ .../quick_tests/test_yaffs_ftruncate.c | 13 ++++ .../quick_tests/test_yaffs_ftruncate.h | 15 +++++ .../quick_tests/test_yaffs_lseek.c | 13 ++++ .../quick_tests/test_yaffs_lseek.h | 15 +++++ .../quick_tests/test_yaffs_open.c | 14 +++++ .../quick_tests/test_yaffs_open.h | 15 +++++ .../quick_tests/test_yaffs_open_EEXIST.c | 13 ++++ .../quick_tests/test_yaffs_open_EEXIST.h | 15 +++++ .../quick_tests/test_yaffs_open_EISDIR.c | 13 ++++ .../quick_tests/test_yaffs_open_EISDIR.h | 15 +++++ .../quick_tests/test_yaffs_open_ENOENT.c | 13 ++++ .../quick_tests/test_yaffs_open_ENOENT.h | 15 +++++ .../quick_tests/test_yaffs_open_ENOTDIR.c | 14 +++++ .../quick_tests/test_yaffs_open_ENOTDIR.h | 15 +++++ .../quick_tests/test_yaffs_read.c | 15 ++++- .../quick_tests/test_yaffs_read.h | 15 +++++ .../quick_tests/test_yaffs_stat.c | 13 ++++ .../quick_tests/test_yaffs_stat.h | 15 +++++ .../quick_tests/test_yaffs_truncate.c | 13 ++++ .../quick_tests/test_yaffs_truncate.h | 15 +++++ .../quick_tests/test_yaffs_unlinking.c | 13 ++++ .../quick_tests/test_yaffs_unlinking.h | 15 +++++ .../quick_tests/test_yaffs_write.c | 15 ++++- .../quick_tests/test_yaffs_write.h | 15 +++++ 38 files changed, 639 insertions(+), 54 deletions(-) create mode 100644 direct/timothy_tests/quick_tests/README.txt create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_close.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_close.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.h diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 09cdba1..a340165 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -53,7 +53,8 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_read.o \ test_yaffs_lseek.o \ test_yaffs_access.o \ - test_yaffs_stat.o + test_yaffs_stat.o \ + test_yaffs_close_EBADF.o YAFFSTESTOBJS = $(COMMONTESTOBJS) $(TESTFILES) diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt new file mode 100644 index 0000000..33b93e7 --- /dev/null +++ b/direct/timothy_tests/quick_tests/README.txt @@ -0,0 +1,59 @@ + +Made by Timothy Manning on 04/11/2010 + + + + +How to add a test + First create the test .c and .h file. + The file name and test function name should be the same. + This name should follow one of these formats: + Test_yaffs_[function of yaffs which is been tested] + Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated] + + The .c file needs to contain two functions. + The first function needs to contain the code for the main test and will return -1 on a failure and 0 or greater on a success. + The second function needs contain the code for cleaning up after the test. Cleaning up may include closing some open handles, recreating a file, ect. + This second function needs to return -1 on a failure and 0 or greater on success. + + 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 + 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. + + + + 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"}, + + Also include the test's .h file in the quick_test.h file: #include "test_yaffs_fish.h" + + The test file should now make and run. + + + + + + + PS: yaffs_fish() is a made up function for this README (in case you want to try and find this function in yaffs). + + +BUGS + Needing to include int random_seed; and int simulate_power_failure = 0; in any main program using yaffsfs.h + ENOSPC error in programs test_yaffs_open_ENOTDIR and test_yaffs_open_ENOENT. + 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/lib.c b/direct/timothy_tests/quick_tests/lib.c index e5a8859..39b0713 100644 --- a/direct/timothy_tests/quick_tests/lib.c +++ b/direct/timothy_tests/quick_tests/lib.c @@ -1,3 +1,16 @@ +/* + * 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 "lib.h" diff --git a/direct/timothy_tests/quick_tests/lib.h b/direct/timothy_tests/quick_tests/lib.h index dee3a06..e0444f7 100644 --- a/direct/timothy_tests/quick_tests/lib.h +++ b/direct/timothy_tests/quick_tests/lib.h @@ -1,3 +1,18 @@ +/* + * 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 _lib_h__ #define _lib_h__ diff --git a/direct/timothy_tests/quick_tests/quick_tests.c b/direct/timothy_tests/quick_tests/quick_tests.c index c1e86bc..bdef486 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.c +++ b/direct/timothy_tests/quick_tests/quick_tests.c @@ -1,3 +1,16 @@ +/* + * 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 "quick_tests.h" @@ -6,54 +19,11 @@ int simulate_power_failure = 0; -typedef struct test { - int (*p_function)(void); /*pointer to test function*/ - int (*p_function_clean)(void); - /*char pass_message[50]; will not need a pass message*/ - char *fail_message; /*pointer to fail message, needs to include name of test*/ -}test_template; - - -int dummy_test_pass(void){ - //printf("running dummy_test_pass\n"); - return 1; -} -void dummy_test_pass_clean(void){ - -} -int dummy_test_fail(void){ - //printf("running dummy_test_fail\n"); - return -1; -} -void dummy_test_fail_clean(void){ -} -test_template test_list[]={ - //{dummy_test_pass,dummy_test_pass_clean,"dummy_test_pass"}, - //{dummy_test_fail,dummy_test_fail_clean,"dummy_test_fail"}, - {mount_yaffs_test,mount_yaffs_test_clean,"mount_yaffs_test"}, - {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"}, - {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"}, - {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"}, - {test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"}, - {test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"}, - - {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"}, - {test_yaffs_unlinking, test_yaffs_unlinking_clean,"test_yaffs_unlinking"}, - - {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, - {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"}, - {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"}, - - - {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"}, - {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"}, - {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"} - }; -unsigned int num_of_tests_pass=0; -unsigned int num_of_tests_failed=0; -unsigned int total_number_of_tests=(sizeof(test_list)/sizeof(test_template)); +static unsigned int num_of_tests_pass=0; +static unsigned int num_of_tests_failed=0; +static unsigned int total_number_of_tests=(sizeof(test_list)/sizeof(test_template)); int main(){ int output=0; diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 8172345..2c4210e 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -1,13 +1,33 @@ +/* + * 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 __quick_tests_h__ #define __quick_tests_h__ #include #include "test_mount_yaffs.h" + #include "test_yaffs_open.h" #include "test_yaffs_open_EISDIR.h" #include "test_yaffs_open_EEXIST.h" #include "test_yaffs_open_ENOENT.h" #include "test_yaffs_open_ENOTDIR.h" + +#include "test_yaffs_close_EBADF.h" + + #include "test_yaffs_unlinking.h" #include "test_yaffs_ftruncate.h" #include "test_yaffs_truncate.h" @@ -20,11 +40,38 @@ #include "yaffs_error_converter.h" #include "lib.h" +typedef struct test { + int (*p_function)(void); /*pointer to test function*/ + int (*p_function_clean)(void); + /*char pass_message[50]; will not need a pass message*/ + char *fail_message; /*pointer to fail message, needs to include name of test*/ +}test_template; + + +test_template test_list[]={ + {mount_yaffs_test,mount_yaffs_test_clean,"mount_yaffs_test"}, + {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"}, + {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"}, + {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"}, +// {test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"}, +// {test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"}, + + {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_unlinking, test_yaffs_unlinking_clean,"test_yaffs_unlinking"}, + + {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, + {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"}, + {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"}, + + + {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"}, + {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"}, + {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"} -#define YAFFS_MOUNT_POINT "/yaffs2/" + }; void init_quick_tests(void); -int dummy_test_pass(void); -int dummy_test_fail(void); void quit_quick_tests(int exit_code); #endif diff --git a/direct/timothy_tests/quick_tests/test_mount_yaffs.c b/direct/timothy_tests/quick_tests/test_mount_yaffs.c index b74cba3..62ef790 100644 --- a/direct/timothy_tests/quick_tests/test_mount_yaffs.c +++ b/direct/timothy_tests/quick_tests/test_mount_yaffs.c @@ -1,6 +1,17 @@ +/* + * 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_mount_yaffs.h" -#include "yaffsfs.h" -#include "lib.h" int mount_yaffs_test(void){ int output=0; diff --git a/direct/timothy_tests/quick_tests/test_mount_yaffs.h b/direct/timothy_tests/quick_tests/test_mount_yaffs.h index c0fa817..89beda7 100644 --- a/direct/timothy_tests/quick_tests/test_mount_yaffs.h +++ b/direct/timothy_tests/quick_tests/test_mount_yaffs.h @@ -1,6 +1,23 @@ +/* + * 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 __mount_yaffs_test__ #define __mount_yaffs_test__ +#include "yaffsfs.h" +#include "lib.h" int mount_yaffs_test(void); int mount_yaffs_test_clean(void); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access.c b/direct/timothy_tests/quick_tests/test_yaffs_access.c index a88664f..9a00b93 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_access.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_access.c @@ -1,3 +1,16 @@ +/* + * 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.h" int test_yaffs_access(void){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access.h b/direct/timothy_tests/quick_tests/test_yaffs_access.h index 18624ea..3f9e26c 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_access.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_access.h @@ -1,3 +1,18 @@ +/* + * 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_h__ #define __test_yaffs_access_h__ #include "lib.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_close.c b/direct/timothy_tests/quick_tests/test_yaffs_close.c new file mode 100644 index 0000000..e69de29 diff --git a/direct/timothy_tests/quick_tests/test_yaffs_close.h b/direct/timothy_tests/quick_tests/test_yaffs_close.h new file mode 100644 index 0000000..e69de29 diff --git a/direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.c b/direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.c new file mode 100644 index 0000000..5036b47 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.c @@ -0,0 +1,62 @@ +/* + * 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. + */ + +/* generates a EBADF error by closing a handle twice */ + +#include "test_yaffs_open.h" + +static int handle=0; + +int test_yaffs_close_EBADF(void){ + int output=0; + int error_code=0; + handle=test_yaffs_open(); + if (handle>=0){ + output=yaffs_close(handle); + if (output>=0){ + output=yaffs_close(handle); + if (output<0){ + /*error has happened */ + error_code=yaffs_get_error(); + printf("EEXIST def %d, Error code %d\n",(- EBADF),error_code); + if (abs(error_code)== EBADF){ + return 1; + } + else { + printf("different error than expected\n"); + return -1; + } + } + else { + printf("closed the same handle twice. (which is a bad thing)\n"); + return -1; + } + } + else { + printf("failed to close the handle the firs time\n"); + return -1; + } + } + else { + printf("failed to open file\n"); + return -1; + } + +} + + +int test_yaffs_close_EBADF_clean(void){ + /* there is nothing that needs to be recreated */ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.h b/direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.h new file mode 100644 index 0000000..68ca4f8 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.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_close_EBADF_h__ +#define __test_yaffs_close_EBADF_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_close_EBADF(void); +int test_yaffs_close_EBADF_clean(void); +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c index 8e97f32..fec910d 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c @@ -1,3 +1,16 @@ +/* + * 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_ftruncate.h" static int handle=0; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.h b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.h index e555809..b3f3956 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.h @@ -1,3 +1,18 @@ +/* + * 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_ftruncate_h__ #define __test_yaffs_ftruncate_h__ #include "lib.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_lseek.c b/direct/timothy_tests/quick_tests/test_yaffs_lseek.c index 422f6db..5e063ef 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_lseek.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_lseek.c @@ -1,3 +1,16 @@ +/* + * 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_lseek.h" static int handle=0; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_lseek.h b/direct/timothy_tests/quick_tests/test_yaffs_lseek.h index d300734..d392127 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_lseek.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_lseek.h @@ -1,3 +1,18 @@ +/* + * 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_lseek_h__ #define __test_yaffs_lseek_h__ #include "lib.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open.c b/direct/timothy_tests/quick_tests/test_yaffs_open.c index 068ceea..89c7492 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_open.c @@ -1,3 +1,16 @@ +/* + * 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_open.h" static int handle=0; @@ -10,6 +23,7 @@ int test_yaffs_open(void){ int test_yaffs_open_clean(void){ + handle=0; if (handle >=0){ return yaffs_close(handle); } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open.h b/direct/timothy_tests/quick_tests/test_yaffs_open.h index e668267..d5883f4 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_open.h @@ -1,3 +1,18 @@ +/* + * 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_open_h__ #define __test_yaffs_open_h__ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.c b/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.c index bc4a9d2..7ae81a1 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.c @@ -1,3 +1,16 @@ +/* + * 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_open_EEXIST.h" static int handle=0; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.h b/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.h index 364fed9..50995f1 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.h @@ -1,3 +1,18 @@ +/* + * 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_open_EEXIST_h__ #define __test_yaffs_open_EEXIST_h__ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.c index 3c5bdae..0891aaa 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.c @@ -1,3 +1,16 @@ +/* + * 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_open_EISDIR.h" /*EISDIR is caused by trying to open a directory */ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.h index 539f2cf..3538510 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.h @@ -1,3 +1,18 @@ +/* + * 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_open_EISDIR_h__ #define __test_yaffs_open_EISDIR_h__ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.c index 8ad4f74..259f964 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.c @@ -1,3 +1,16 @@ +/* + * 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_open_ENOENT.h" static int handle=0; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.h index 160a3db..ff2663b 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.h @@ -1,3 +1,18 @@ +/* + * 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_open_ENOENT_h__ #define __test_yaffs_open_ENOENT_h__ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.c index 18081a7..4722e88 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.c @@ -1,3 +1,16 @@ +/* + * 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_open_ENOTDIR.h" static int handle=0; @@ -8,6 +21,7 @@ int test_yaffs_open_ENOTDIR(void){ handle=yaffs_open("/nonexisting_dir/foo", O_TRUNC| O_RDWR,FILE_MODE ); if (handle==-1){ error_code=yaffs_get_error(); + printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code); if (abs(error_code)==ENOTDIR){ return 1; } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.h index c38ea21..d164ea9 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.h @@ -1,3 +1,18 @@ +/* + * 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_open_ENOTDIR_h__ #define __test_yaffs_open_ENOTDIR_h__ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_read.c b/direct/timothy_tests/quick_tests/test_yaffs_read.c index bdd58cf..fcfae7b 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_read.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_read.c @@ -1,3 +1,16 @@ +/* + * 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_read.h" static int handle=0; @@ -7,7 +20,7 @@ int test_yaffs_read(void){ char text[20]="\0"; int output=0; printf("handle %d\n",handle); - if (handle>0){ + if (handle>=0){ output=yaffs_read(handle, text, FILE_TEXT_NBYTES); printf("yaffs_test_read output: %d\n",output); printf("text in file is: %s\n",text); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_read.h b/direct/timothy_tests/quick_tests/test_yaffs_read.h index ce9f5a2..b118854 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_read.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_read.h @@ -1,3 +1,18 @@ +/* + * 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_read_h__ #define __test_yaffs_read_h__ #include "lib.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat.c b/direct/timothy_tests/quick_tests/test_yaffs_stat.c index 0d972a6..d47fd29 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_stat.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat.c @@ -1,3 +1,16 @@ +/* + * 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_stat.h" int test_yaffs_stat(void){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat.h b/direct/timothy_tests/quick_tests/test_yaffs_stat.h index bf87ccb..f7e27af 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_stat.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat.h @@ -1,3 +1,18 @@ +/* + * 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_stat_h__ #define __test_yaffs_stat_h__ #include "lib.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate.c index 2f509bb..1b19bd5 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_truncate.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate.c @@ -1,3 +1,16 @@ +/* + * 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_truncate.h" static int handle=0; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate.h b/direct/timothy_tests/quick_tests/test_yaffs_truncate.h index bfd738c..5540060 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_truncate.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate.h @@ -1,3 +1,18 @@ +/* + * 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_truncate_h__ #define __test_yaffs_truncate_h__ #include "lib.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlinking.c b/direct/timothy_tests/quick_tests/test_yaffs_unlinking.c index ce06543..435cb92 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_unlinking.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlinking.c @@ -1,3 +1,16 @@ +/* + * 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_unlinking.h" int test_yaffs_unlinking(void){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlinking.h b/direct/timothy_tests/quick_tests/test_yaffs_unlinking.h index 604ae24..fcabe69 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_unlinking.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlinking.h @@ -1,3 +1,18 @@ +/* + * 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_unlinking_h__ #define __test_yaffs_unlinking_h__ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_write.c b/direct/timothy_tests/quick_tests/test_yaffs_write.c index adfd2bf..dbd17e5 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_write.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_write.c @@ -1,9 +1,22 @@ +/* + * 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_write.h" static int handle=0; int test_yaffs_write(void){ handle=test_yaffs_open(); - if (handle>0){ + if (handle>=0){ return yaffs_write(handle, FILE_TEXT, FILE_TEXT_NBYTES); } else { diff --git a/direct/timothy_tests/quick_tests/test_yaffs_write.h b/direct/timothy_tests/quick_tests/test_yaffs_write.h index dfed860..473a009 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_write.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_write.h @@ -1,3 +1,18 @@ +/* + * 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_write_h__ #define __test_yaffs_write_h__ #include "lib.h" -- 2.30.2