yaffs Added some new tests to quick tests.
authorTimothy Manning <tfhmanning@gmail.com>
Mon, 8 Nov 2010 00:05:40 +0000 (13:05 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Mon, 8 Nov 2010 00:05:40 +0000 (13:05 +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
direct/timothy_tests/quick_tests/test_yaffs_mount_ENAMETOOLONG.h
direct/timothy_tests/quick_tests/test_yaffs_mount_ENOENT.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_mount_ENOENT.h [new file with mode: 0644]

index 0ff1c06117b766e4028e0353cafdcaa2907c428a..b69ee0a11d16e54d4173a87d66f1669b7617dd7b 100644 (file)
@@ -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.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.o test_yaffs_mount_ENOENT.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\
index 7fc7d57c462c19ca781dfddae4e2173bc7e0b079..a6b984e3d929372315d2b317820827da00e3a340 100644 (file)
@@ -9,6 +9,7 @@ tests made
        test_yaffs_mount
        test_yaffs_mount_ENODEV
        test_yaffs_mount_ENAMETOOLONG
+       test_yaffs_mount_ENOENT
        test_yaffs_access
        test_yaffs_close_EBADF
        test_yaffs_ftruncate
@@ -37,7 +38,7 @@ tests to add
        test_yaffs_mount_ELOOP          //Cannot be generated with yaffs.
        test_yaffs_mount_EMFILE         //Cannot be generated with yaffs.
 
-       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.
 
@@ -127,12 +128,14 @@ How to add a test
 
 
 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. 
+       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.
 
index 8360e85ac718f91515482daaa091a515bdc0765c..429771d6c2fd8da9c737aa77086d5679a1d7710d 100644 (file)
@@ -20,6 +20,7 @@
 #include "test_yaffs_mount.h"
 #include "test_yaffs_mount_ENODEV.h"
 #include "test_yaffs_mount_ENAMETOOLONG.h"
+#include "test_yaffs_mount_ENOENT.h"
 
 #include "test_yaffs_unmount.h"
 
@@ -65,6 +66,7 @@ test_template test_list[]={
        {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
        {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_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"},
 
index a61d0b3212c7a043d21e35d724749fdd47b7d8a9..99102c9f6eca8533e4a44b9d60f7643e382f8599 100644 (file)
@@ -23,6 +23,13 @@ int test_yaffs_mount_ENAMETOOLONG(void){
        int file_name_length=1000000;
        char file_name[file_name_length];
 
+       /* if a second file system is mounted then yaffs will return EBUSY. so first unmount yaffs */
+       output=test_yaffs_unmount();
+       if (output<0){
+               printf("yaffs failed to unmount\n");
+               return -1;
+       } 
+
        strcat(file_name,YAFFS_MOUNT_POINT);
        for (x=strlen(YAFFS_MOUNT_POINT); x<file_name_length -1; x++){
                file_name[x]='a';
@@ -45,13 +52,13 @@ int test_yaffs_mount_ENAMETOOLONG(void){
                }
        }
        else {
-               printf("non existant file opened.(which is a bad thing)\n");
+               printf("mounted a too long mount point name.(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;
+       return test_yaffs_mount();
 }
 
index e83dc6bef73d190b327ca692e7ee54f9fbc534e8..746fc487deb153ada2864923c86a5a342dbc836b 100644 (file)
@@ -18,6 +18,9 @@
 
 #include "lib.h"
 #include "yaffsfs.h"
+#include "test_yaffs_mount.h"
+#include "test_yaffs_unmount.h"
+
 
 int test_yaffs_mount_ENAMETOOLONG(void);
 int test_yaffs_mount_ENAMETOOLONG_clean(void);
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOENT.c
new file mode 100644 (file)
index 0000000..061a13f
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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_ENOENT.h"
+
+
+int test_yaffs_mount_ENOENT(void){
+       int output=0;
+       int error_code=0;
+       /*printf("path %s\n",path); */
+       
+       
+       /* if a second file system is mounted then yaffs will return EBUSY. so first unmount yaffs */
+       output=test_yaffs_unmount();
+       if (output<0){
+               printf("yaffs failed to unmount\n");
+               return -1;
+       } 
+
+       output=yaffs_mount("/non_existaint_mount_point/");
+       if (output==-1){
+               error_code=yaffs_get_error();
+               if (abs(error_code)==ENOENT){
+                       return 1;
+               }
+               else {
+                       printf("different error than expected\n");
+                       return -1;
+               }
+       }
+       else {
+               printf("non existant mount point mounted.(which is a bad thing)\n");
+               return -1;
+       }
+
+}
+int test_yaffs_mount_ENOENT_clean(void){
+       return test_yaffs_mount();
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOENT.h
new file mode 100644 (file)
index 0000000..e0e7ad6
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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_ENOENT_h__
+#define __test_yaffs_mount_ENOENT_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_unmount.h"
+#include "test_yaffs_mount.h"
+
+int test_yaffs_mount_ENOENT(void);
+int test_yaffs_mount_ENOENT_clean(void);
+#endif