yaffs Added a README file and some more tests.
authorTimothy Manning <tfhmanning@gmail.com>
Thu, 4 Nov 2010 01:17:27 +0000 (14:17 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Thu, 4 Nov 2010 01:17:27 +0000 (14:17 +1300)
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
38 files changed:
direct/timothy_tests/quick_tests/Makefile
direct/timothy_tests/quick_tests/README.txt [new file with mode: 0644]
direct/timothy_tests/quick_tests/lib.c
direct/timothy_tests/quick_tests/lib.h
direct/timothy_tests/quick_tests/quick_tests.c
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_mount_yaffs.c
direct/timothy_tests/quick_tests/test_mount_yaffs.h
direct/timothy_tests/quick_tests/test_yaffs_access.c
direct/timothy_tests/quick_tests/test_yaffs_access.h
direct/timothy_tests/quick_tests/test_yaffs_close.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_close.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_close_EBADF.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c
direct/timothy_tests/quick_tests/test_yaffs_ftruncate.h
direct/timothy_tests/quick_tests/test_yaffs_lseek.c
direct/timothy_tests/quick_tests/test_yaffs_lseek.h
direct/timothy_tests/quick_tests/test_yaffs_open.c
direct/timothy_tests/quick_tests/test_yaffs_open.h
direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.c
direct/timothy_tests/quick_tests/test_yaffs_open_EEXIST.h
direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.c
direct/timothy_tests/quick_tests/test_yaffs_open_EISDIR.h
direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.c
direct/timothy_tests/quick_tests/test_yaffs_open_ENOENT.h
direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.c
direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.h
direct/timothy_tests/quick_tests/test_yaffs_read.c
direct/timothy_tests/quick_tests/test_yaffs_read.h
direct/timothy_tests/quick_tests/test_yaffs_stat.c
direct/timothy_tests/quick_tests/test_yaffs_stat.h
direct/timothy_tests/quick_tests/test_yaffs_truncate.c
direct/timothy_tests/quick_tests/test_yaffs_truncate.h
direct/timothy_tests/quick_tests/test_yaffs_unlinking.c
direct/timothy_tests/quick_tests/test_yaffs_unlinking.h
direct/timothy_tests/quick_tests/test_yaffs_write.c
direct/timothy_tests/quick_tests/test_yaffs_write.h

index 09cdba1b005317458b40ffc9a8c8707c33d97c99..a340165b0455eba179593eb366a3b0b1ecdcc040 100644 (file)
@@ -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 (file)
index 0000000..33b93e7
--- /dev/null
@@ -0,0 +1,59 @@
+
+Made by Timothy Manning <timothy@yaffs.net> 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.
+
+
+
+
index e5a8859d3c358992e6d6cd44c9d21a6be87b2629..39b0713384d02acf6386a61c7b8304abf50cc9bd 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"
 
 
index dee3a068ec825b186d5461d8ad8a5e92420ff3f4..e0444f7e541fda6a8e63dcbdf7185e11c1dd00d4 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index c1e86bc88f94e2869f199ad5e8e6276baab25161..bdef486e65c010b2a0cd582976c5574fd6e5cd0a 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
index 8172345b2c2d98bd097e0501f78c67d8525329fc..2c4210ee1f0a94a6fb747dc1e5910c29e3d73109 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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 <stdio.h>
 
 #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"
 #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
index b74cba3d63e39bd620c917de8162eb7fb0035042..62ef7903e5085189a1564941386da15be51691cf 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
index c0fa817b7dae62d52c6dac4b10148d5b9afe133d..89beda72bb32f1284cdebd6a4b3e3caac32c04e7 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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);
index a88664f0ecafb6aea9bc6ab7bd501a8309be3e09..9a00b9398d9bf023ece703959b9ed895a3e0a2ff 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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){
index 18624ea574d2bbb25b0576b305a5b67d182b256e..3f9e26cbe380955056cddb28862f43454e6ed3f1 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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 (file)
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 (file)
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 (file)
index 0000000..5036b47
--- /dev/null
@@ -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 <timothy@yaffs.net>
+ *
+ * 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 (file)
index 0000000..68ca4f8
--- /dev/null
@@ -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 <timothy@yaffs.net>
+ *
+ * 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
index 8e97f3229a72961e0749f89e92ff548e6c2a9b42..fec910d346d7bef5e72f1d961f2468f2215cedeb 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
index e5558098bf5c8d879673d06b2e104923bff6ed88..b3f3956c7c516c2608c297adb0cb3c489019f5c1 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"
index 422f6db9e141278014e33be76b4add1c25a7c6a9..5e063eff5c2b5c883f7d6613e7f855098481c2cb 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
index d300734679c4e4dd9749467b2196a822630d00d7..d392127c943b3aca0173f7d9db3d7105cdaf8e1e 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"
index 068ceea09cb48befa02cd0bbdb68353a920f8455..89c7492701ce8876942650b45dafdbcc1e4cfd06 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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);
        }
index e668267b93b0e562a4fe3f150e021a9a5677114b..d5883f4c573e2eda0ded420f29a136f3f99ac3b9 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index bc4a9d2211a4d414ffb569d6eaf544318eec53af..7ae81a1ac22908ce1e259a757fa1f3e8f2466b3c 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
index 364fed9cb2d8a8d2f272248e2a5c1979fbe74c47..50995f114ea49cd771f6e10f28195d9c09d4916f 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index 3c5bdaee4c6945c2bf7e25f5fe5e71a30e0551cf..0891aaa326da8317e0aeba74a5c12a5cb46c5224 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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 */
index 539f2cf94c7b98da7b7047cb8737c7eb4904cdb7..3538510e95188888a11005addf2965da7074aee9 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index 8ad4f7418e05855ff1934af688a955d385e696d1..259f96436185dd32c17c8abf3dbc916e363a42f6 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
index 160a3dbe4152c3942f6c9611a35ca2d8b59dd264..ff2663b0d4635b84c3afa6ae4b6dd32ab3587687 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index 18081a7428d777b4d72fa77dd67cb180bf301254..4722e8814eaca81e1b79446f35c9e2025d6febd5 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
                }
index c38ea21495dba6c2ccad53e1d56818911358da1a..d164ea9e34270e6e4b80106ce2b8e39b5840798c 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index bdd58cf1148fe87f781c2209506e707ca74ae875..fcfae7b22d9a44311a5e5620dd34506a5e3850b3 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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);
index ce9f5a23aa41f18f62f50df2d857dc996b0ee54a..b118854cdc028fe09701b429551a2110df4b1766 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"
index 0d972a61cfe9f3f12e6286c7ae2569329d977d1c..d47fd2912cdf79de81a98b1d47be32b78e851d12 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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){
index bf87ccb183e595a1d7404ac2c3b0e1945a82c932..f7e27afce508d043d1f514092a8a8bc3dd0433ae 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"
index 2f509bb66aed06053360342a4a7ab6db5e98e6cb..1b19bd5447fd7fd2f7c21af03cf3f461a6de36b0 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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;
 
index bfd738c0fb13dac153f44198d15b6bd0f0ab1e2f..5540060810e1d50bddeada86ea196e75eaff2591 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"
index ce06543e877a95d23eb8c5b33a31866cb9c2bfa3..435cb92648419f65b69217d7e0d872cd6e15887a 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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){
index 604ae24cfe02bd84af9ab5cae72aa11dfa44f412..fcabe69ded6285f0f8d2f160b01f73ad6183f9bb 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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__
 
index adfd2bfccbb4f550b085fecb85cb3583b5ec0b70..dbd17e592b91421c2a4b9bd7b4d296a55fda6b1e 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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 {
index dfed86053039de589b28e05e0f0ef52f54bc3597..473a009e26da37a092bcd850c74bd0510ba663dd 100644 (file)
@@ -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 <timothy@yaffs.net>
+ *
+ * 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"