yaffs More updates on quick tests
authorTimothy Manning <tfhmanning@gmail.com>
Sun, 7 Nov 2010 23:41:12 +0000 (12:41 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Sun, 7 Nov 2010 23:43:07 +0000 (12:43 +1300)
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
direct/timothy_tests/quick_tests/Makefile
direct/timothy_tests/quick_tests/README.txt
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.c
direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.c [deleted file]
direct/timothy_tests/quick_tests/test_yaffs_open.c
direct/timothy_tests/quick_tests/test_yaffs_unlink_ENAMETOOLONG.c
direct/timothy_tests/quick_tests/test_yaffs_unmount.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unmount.h [moved from direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.h with 77% similarity]

index 8b2b0089dee5cf3a6122728557c1f9973c4898dc..0ff1c06117b766e4028e0353cafdcaa2907c428a 100644 (file)
@@ -45,7 +45,8 @@ 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_ENOTDIR.o test_yaffs_mount_ENODEV.o \
+               test_yaffs_mount.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.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\
                test_yaffs_ftruncate.o test_yaffs_truncate.o \
index fd8c377be206cdc90d58351ef3a71ce7d4ae2eb5..7fc7d57c462c19ca781dfddae4e2173bc7e0b079 100644 (file)
@@ -8,6 +8,7 @@ the yaffs_close function has been covered by tests
 tests made
        test_yaffs_mount
        test_yaffs_mount_ENODEV
+       test_yaffs_mount_ENAMETOOLONG
        test_yaffs_access
        test_yaffs_close_EBADF
        test_yaffs_ftruncate
@@ -26,6 +27,7 @@ tests made
        test_yaffs_unlink_ENAMETOOLONG
        test_yaffs_unlink_ENOENT
        test_yaffs_unlink_ENOTDIR
+       test_yaffs_unmount
        test_yaffs_write
 
 
@@ -34,9 +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_ENAMETOOLONG
+
        test_yaffs_mount_ENOENT
        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_open_EACCES
        test_yaffs_open_ENOSPC
@@ -113,20 +118,20 @@ How to add a test
        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. 
-       
-       
        
+       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). 
 
 
-BUGS
+BUGS AND WARNINGS
+       remove the printf which prints yaffs_mounting.
        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. 
+
+       WARNING- If yaffs is unmounted then most functions return ENODIR.
        
        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.
index 9b9643ffa9a9621ab3140d8a69ae4d1fe27b36c6..8360e85ac718f91515482daaa091a515bdc0765c 100644 (file)
 #include <stdio.h>
 
 #include "test_yaffs_mount.h"
-#include "test_yaffs_mount_ENOTDIR.h"
 #include "test_yaffs_mount_ENODEV.h"
+#include "test_yaffs_mount_ENAMETOOLONG.h"
+
+#include "test_yaffs_unmount.h"
 
 #include "test_yaffs_open.h"
 #include "test_yaffs_open_EISDIR.h"
@@ -61,8 +63,10 @@ typedef struct test {
 
 test_template test_list[]={
        {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
-//     {test_yaffs_mount_ENOTDIR,test_yaffs_mount_ENOTDIR_clean,"test_yaffs_mount_ENOTDIR"},
        {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_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"},
 
        {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"},
        {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"},
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.c b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.c
new file mode 100644 (file)
index 0000000..a61d0b3
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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_mount_ENAMETOOLONG.h"
+
+
+
+
+int test_yaffs_mount_ENAMETOOLONG(void){
+       int output=0;
+       int x;
+       int error_code=0;
+       int file_name_length=1000000;
+       char file_name[file_name_length];
+
+       strcat(file_name,YAFFS_MOUNT_POINT);
+       for (x=strlen(YAFFS_MOUNT_POINT); x<file_name_length -1; x++){
+               file_name[x]='a';
+       }
+       file_name[file_name_length-2]='\0';
+       
+       //printf("file name: %s\n",file_name);
+
+
+       output=yaffs_mount(file_name);
+
+       if (output==-1){
+               error_code=yaffs_get_error();
+               if (abs(error_code)== ENAMETOOLONG){
+                       return 1;
+               }
+               else {
+                       printf("different error than expected\n");
+                       return -1;
+               }
+       }
+       else {
+               printf("non existant file opened.(which is a bad thing)\n");
+               return -1;
+       }
+       /* the program should not get here but the compiler is complaining */
+       return -1;
+}
+int test_yaffs_mount_ENAMETOOLONG_clean(void){
+       return -1;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.h b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.h
new file mode 100644 (file)
index 0000000..e83dc6b
--- /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_mount_ENAMETOOLONG_h__
+#define __test_yaffs_mount_ENAMETOOLONG_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_mount_ENAMETOOLONG(void);
+int test_yaffs_mount_ENAMETOOLONG_clean(void);
+#endif
index 58e1baffcf8044d34880ecb72abda6ed261ab23e..e0bc9f7f8d8dbed7574ef6f14bbf080bc16fcfe6 100644 (file)
@@ -11,7 +11,7 @@
  * published by the Free Software Foundation.
  */
 
-#include "test_yaffs_mount_ENOTDIR.h"
+#include "test_yaffs_mount_ENODEV.h"
 
 static int handle=0;
 int test_yaffs_mount_ENODEV(void){
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.c
deleted file mode 100644 (file)
index 5afc3a7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * YAFFS: Yet another FFS. A NAND-flash specific file system.
- *
- * Copyright (C) 2002-2010 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
- *
- * Created by Timothy Manning <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_mount_ENOTDIR.h"
-
-static int handle=0;
-int test_yaffs_mount_ENOTDIR(void){
-       int output=0;
-       int error_code=0;
-       /*printf("path %s\n",path); */
-       handle=yaffs_mount("/nonexisting_mount_point/");
-       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;
-               }
-               else {
-                       printf("different error than expected\n");
-                       return -1;
-               }
-       }
-       else if (output >=0){
-               printf("non existant directory opened.(which is a bad thing)\n");
-               return -1;
-       }
-
-}
-int test_yaffs_mount_ENOTDIR_clean(void){
-       return -1;
-}
-
index 76ed67bdb4f366891437a04761a68793e2a127bc..d7237a89cbaec6e8732c4c1a4f2bc76dcc567b07 100644 (file)
@@ -23,7 +23,6 @@ int test_yaffs_open(void){
 
 
 int test_yaffs_open_clean(void){
-       handle=0;
        if (handle >=0){
                return yaffs_close(handle);
        }
index 1803c839bb87798c6bb40530227f6c481c1524f4..c5184a5f0863e4a3ec53a8c14c7ecd1c9b0daada 100644 (file)
@@ -41,7 +41,7 @@ int test_yaffs_unlink_ENAMETOOLONG(void){
                        return -1;
                }
        }
-       else if (output >=0){
+       else {
                printf("directory unlinked opened.(which is a bad thing)\n");
                return -1;
        }
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount.c
new file mode 100644 (file)
index 0000000..b3ddba2
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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_unmount.h"
+
+int test_yaffs_unmount(void){
+       int output=0;
+       output=yaffs_unmount(YAFFS_MOUNT_POINT);
+       /*printf("output %d",output);*/
+       return output;
+}
+
+int test_yaffs_unmount_clean(void){
+       return test_yaffs_mount();
+       
+}
similarity index 77%
rename from direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.h
rename to direct/timothy_tests/quick_tests/test_yaffs_unmount.h
index 2d12fea29ef6bd660d41b89b77e6fc9e0574b286..7b0562a4d287807a73fc4201c81e8fb6124bf536 100644 (file)
  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  */
 
-#ifndef __test_yaffs_mount_ENOTDIR_h__
-#define __test_yaffs_mount_ENOTDIR_h__
+#ifndef __test_yaffs_unmount__
+#define __test_yaffs_unmount__
 
-#include "lib.h"
 #include "yaffsfs.h"
+#include "lib.h"
+#include "test_yaffs_mount.h"
 
-int test_yaffs_mount_ENOTDIR(void);
-int test_yaffs_mount_ENOTDIR_clean(void);
+int test_yaffs_unmount(void);
+int test_yaffs_unmount_clean(void);
 #endif