yaffs Updated quick tests' README.
authorTimothy Manning <tfhmanning@gmail.com>
Sun, 7 Nov 2010 22:39:31 +0000 (11:39 +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.c
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.h [new file with mode: 0644]

index 0e843e9a099de9bf9d1afb9ed4239ee1103296cc..8b2b0089dee5cf3a6122728557c1f9973c4898dc 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 \
 #               yaffs_checkptrwtest.o\
 
 TESTFILES =    quick_tests.o lib.o \
-               test_yaffs_mount.o \
+               test_yaffs_mount.o test_yaffs_mount_ENOTDIR.o test_yaffs_mount_ENODEV.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 \
                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 fca9396b7590d39506749b6eaa4940e4c2bc8359..fd8c377be206cdc90d58351ef3a71ce7d4ae2eb5 100644 (file)
@@ -7,8 +7,8 @@ the yaffs_close function has been covered by tests
 
 tests made
        test_yaffs_mount
 
 tests made
        test_yaffs_mount
+       test_yaffs_mount_ENODEV
        test_yaffs_access
        test_yaffs_access
-       test_yaffs_close
        test_yaffs_close_EBADF
        test_yaffs_ftruncate
        test_yaffs_lseek
        test_yaffs_close_EBADF
        test_yaffs_ftruncate
        test_yaffs_lseek
@@ -21,29 +21,35 @@ tests made
        test_yaffs_read
        test_yaffs_stat
        test_yaffs_truncate
        test_yaffs_read
        test_yaffs_stat
        test_yaffs_truncate
+       test_yaffs_unlink
        test_yaffs_unlink_EISDIR
        test_yaffs_unlink_ENAMETOOLONG
        test_yaffs_unlink_ENOENT
        test_yaffs_unlink_ENOTDIR
        test_yaffs_write
        test_yaffs_unlink_EISDIR
        test_yaffs_unlink_ENAMETOOLONG
        test_yaffs_unlink_ENOENT
        test_yaffs_unlink_ENOTDIR
        test_yaffs_write
+
+
 tests to add
 tests to add
-       test_yaffs_mount_EACCES
-       test_yaffs_mount_EINVAL
-       test_yaffs_mount_ELOOP
-       test_yaffs_mount_EMFILE
+       test_yaffs_mount_EACCES         //Cannot be generated with yaffs.
+       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_ENAMETOOLONG
        test_yaffs_mount_ENOENT
-       test_yaffs_mount_ENOTDIR
+       test_yaffs_mount_ENOTDIR        //Cannot be generated with yaffs.
+
        test_yaffs_open_EACCES
        test_yaffs_open_ENOSPC
        test_yaffs_open_EACCES
        test_yaffs_open_ENOSPC
-       test_yaffs_open_ELOOP   Too many symbolic links were encountered in resolving pathname
-       test_yaffs_close
+       test_yaffs_open_ELOOP   //Too many symbolic links were encountered in resolving pathname
        test yaffs_open_running_out_of_handles error
        test yaffs_open_running_out_of_handles error
+
+       test_yaffs_close        //This function has already been called by the time this test is reached. 
+
        test_yaffs_unlink_EACCES
        test_yaffs_unlink_ELOOP
        test_yaffs_unlink_ENOENT
        test_yaffs_unlink_ENOMEM
        test_yaffs_unlink_EACCES
        test_yaffs_unlink_ELOOP
        test_yaffs_unlink_ENOENT
        test_yaffs_unlink_ENOMEM
-       check to see if an error code is generated when there isn't an error
+
        test_yaffs_access_EACCESS
        test_yaffs_access_ELOOP
        test_yaffs_access_ENAMETOOLONG
        test_yaffs_access_EACCESS
        test_yaffs_access_ELOOP
        test_yaffs_access_ENAMETOOLONG
@@ -51,6 +57,27 @@ tests to add
        test_yaffs_access_ENOTDIR
        test_yaffs_access_ENIVAL        //mode is incorrect.
 
        test_yaffs_access_ENOTDIR
        test_yaffs_access_ENIVAL        //mode is incorrect.
 
+       test_yaffs_ftruncate_EACCES
+       test_yaffs_ftruncate_EFBIG
+       test_yaffs_ftruncate_ENIVAL
+       test_yaffs_ftruncate_EISDIR
+       test_yaffs_ftruncate_ELOOP
+       test_yaffs_ftruncate_ENOENT
+       test_yaffs_ftruncate_ENOTDIR
+       test_yaffs_ftruncate_EPERM
+
+       test_yaffs_truncate_EACCES
+       test_yaffs_truncate_EFBIG
+       test_yaffs_truncate_ENIVAL
+       test_yaffs_truncate_EISDIR
+       test_yaffs_truncate_ELOOP
+       test_yaffs_truncate_ENAMETOOLONG
+       test_yaffs_truncate_ENOENT
+       test_yaffs_truncate_ENOTDIR
+       test_yaffs_truncate_EPERM
+
+       check to see if an error code is generated when there isn't an error.
+
 
 How to add a test
        First create the test .c and .h file.
 
 How to add a test
        First create the test .c and .h file.
@@ -98,7 +125,6 @@ How to add a test
 
 
 BUGS
 
 
 BUGS
-       Needing to include int random_seed; and int simulate_power_failure = 0; in any main program using yaffsfs.h
        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 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. 
        
index 24150823531843bcfb309a4ce5456ad30c78fcf6..1f6a935cfc90af888d7bcd607760d9d833aae8d7 100644 (file)
@@ -65,7 +65,12 @@ int main(){
                        printf("test: %s failed to clean\n",test_list[x].name_of_test);         
                        num_of_tests_failed ++; 
                        num_of_tests_pass--;
                        printf("test: %s failed to clean\n",test_list[x].name_of_test);         
                        num_of_tests_failed ++; 
                        num_of_tests_pass--;
-                       quit_quick_tests(1);
+                       get_error();
+                       printf("\n\n");
+                       if (EXIT_ON_ERROR){
+                               quit_quick_tests(1);
+                       }
+                       
                }
                        
        }
                }
                        
        }
index e7ae6bae2f873db2a189f7e5aa7dc7e1842482cd..9b9643ffa9a9621ab3140d8a69ae4d1fe27b36c6 100644 (file)
@@ -18,6 +18,8 @@
 #include <stdio.h>
 
 #include "test_yaffs_mount.h"
 #include <stdio.h>
 
 #include "test_yaffs_mount.h"
+#include "test_yaffs_mount_ENOTDIR.h"
+#include "test_yaffs_mount_ENODEV.h"
 
 #include "test_yaffs_open.h"
 #include "test_yaffs_open_EISDIR.h"
 
 #include "test_yaffs_open.h"
 #include "test_yaffs_open_EISDIR.h"
@@ -59,6 +61,9 @@ typedef struct test {
 
 test_template test_list[]={
        {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
 
 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_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,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"},
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.c b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.c
new file mode 100644 (file)
index 0000000..58e1baf
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * YAFFS: Yet another FFS. A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ *   for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Timothy Manning <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_ENODEV(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)==ENODEV){
+                       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_ENODEV_clean(void){
+       return 1;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.h b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENODEV.h
new file mode 100644 (file)
index 0000000..27cd767
--- /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_ENODEV_h__
+#define __test_yaffs_mount_ENODEV_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_mount_ENODEV(void);
+int test_yaffs_mount_ENODEV_clean(void);
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.c
new file mode 100644 (file)
index 0000000..5afc3a7
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * YAFFS: Yet another FFS. A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ *   for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Timothy Manning <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;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_mount_ENOTDIR.h
new file mode 100644 (file)
index 0000000..2d12fea
--- /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_ENOTDIR_h__
+#define __test_yaffs_mount_ENOTDIR_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_mount_ENOTDIR(void);
+int test_yaffs_mount_ENOTDIR_clean(void);
+#endif