Merge branch 'quick_tests'
authorTimothy Manning <tfhmanning@gmail.com>
Fri, 26 Nov 2010 02:13:37 +0000 (15:13 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Fri, 26 Nov 2010 02:13:37 +0000 (15:13 +1300)
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_chmod_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_mknode.c [deleted file]
direct/timothy_tests/quick_tests/test_yaffs_open_ELOOP_dir.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_open_ELOOP_dir.h [moved from direct/timothy_tests/quick_tests/test_yaffs_mknode.h with 77% similarity]
direct/timothy_tests/quick_tests/test_yaffs_open_ENOTDIR.c
direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.h [new file with mode: 0644]

index a13bad078722516ea72224a8c5f54702746ca0aa..6c3ad4ad586b030c449b36fdb1d19b28e07c9d14 100644 (file)
@@ -49,6 +49,7 @@ TESTFILES =   quick_tests.o lib.o \
                test_yaffs_unmount.o test_yaffs_unmount_ENODEV.o test_yaffs_unmount_ENAMETOOLONG.o test_yaffs_unmount_EBUSY.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_open_EINVAL.o test_yaffs_open_EINVAL2.o test_yaffs_open_ELOOP.o \
+               test_yaffs_open_ELOOP_dir.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_unlink_ENOENT2.o \
                test_yaffs_ftruncate.o test_yaffs_ftruncate_EBADF.o test_yaffs_ftruncate_EINVAL.o test_yaffs_ftruncate_big_file.o \
@@ -88,7 +89,7 @@ TESTFILES =   quick_tests.o lib.o \
                test_yaffs_rmdir_ENOTDIR.o \
                test_yaffs_rename.o test_yaffs_rename_ENOENT.o test_yaffs_rename_ENOTDIR.o test_yaffs_rename_EINVAL.o \
                test_yaffs_rename_dir.o test_yaffs_rename_dir_ENOENT.o test_yaffs_rename_dir_ENOENT2.o test_yaffs_rename_dir_to_file.o \
-               test_yaffs_rename_file_to_dir.o test_yaffs_rename_EEXISTS.o test_yaffs_rename_ELOOP.o\
+               test_yaffs_rename_file_to_dir.o test_yaffs_rename_EEXISTS.o test_yaffs_rename_ELOOP.o test_yaffs_rename_ELOOP_dev.o \
                test_yaffs_lstat.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o \
                test_yaffs_flush.o test_yaffs_flush_EBADF.o
 
index bbeb0d77eb72688d05b3d804d5072d2524a28bcb..a2a08ff1cd2efbd79dc2c2ae32547c0c5f3c2bb7 100644 (file)
@@ -316,7 +316,6 @@ Tests which do not exist in yaffs:
        test_yaffs_mkdir_ELOOP
 
        //the yaffs_mknod function does not exist in yaffsfs, so these tests will not be added.
-       test_yaffs_mknod
        test_yaffs_mknod_EACCES
        test_yaffs_mknod_EEXIST
        test_yaffs_mknod_EINVAL
index 8d819eea10f2fabad044565216beed36f401a32c..42d2fe0b8500479cb8b78490a524ea94c1380e8d 100644 (file)
@@ -36,6 +36,7 @@
 #include "test_yaffs_open_EINVAL.h"
 #include "test_yaffs_open_EINVAL2.h"
 #include "test_yaffs_open_ELOOP.h"
+#include "test_yaffs_open_ELOOP_dir.h"
 
 #include "test_yaffs_close_EBADF.h"
 
 #include "test_yaffs_rename_file_to_dir.h"
 #include "test_yaffs_rename_EEXISTS.h"
 #include "test_yaffs_rename_ELOOP.h"
+#include "test_yaffs_rename_ELOOP_dev.h"
 
 #include "test_yaffs_lstat.h"
 #include "test_yaffs_lstat_ENOENT.h"
@@ -223,6 +225,7 @@ test_template test_list[]={
        {test_yaffs_open_EINVAL,test_yaffs_open_EINVAL_clean,"test_yaffs_open_EINVAL"},
        {test_yaffs_open_EINVAL2,test_yaffs_open_EINVAL2_clean,"test_yaffs_open_EINVAL2"},
        {test_yaffs_open_ELOOP,test_yaffs_open_ELOOP_clean,"test_yaffs_open_ELOOP"},
+       {test_yaffs_open_ELOOP_dir,test_yaffs_open_ELOOP_dir_clean,"test_yaffs_open_ELOOP_dir"},
        
        {test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
 
@@ -365,6 +368,7 @@ test_template test_list[]={
        {test_yaffs_rename_file_to_dir,test_yaffs_rename_file_to_dir_clean,"test_yaffs_rename_file_to_dir"},
        {test_yaffs_rename_EEXISTS,test_yaffs_rename_EEXISTS_clean,"test_yaffs_rename_EEXISTS"},
        {test_yaffs_rename_ELOOP,test_yaffs_rename_ELOOP_clean,"test_yaffs_rename_ELOOP"},
+       {test_yaffs_rename_ELOOP_dev,test_yaffs_rename_ELOOP_dev_clean,"test_yaffs_rename_ELOOP_dev"},
 
        {test_yaffs_lstat,test_yaffs_lstat_clean,"test_yaffs_lstat"},
        {test_yaffs_lstat_ENOENT,test_yaffs_lstat_ENOENT_clean,"test_yaffs_lstat_ENOENT"},
index fef37e5504f1bec111f6583216e8d8cd2004d045..26e701c9d4f90c3fed673d5bbb60878334fea04c 100644 (file)
@@ -39,5 +39,5 @@ int test_yaffs_chmod_EROFS(void)
 
 int test_yaffs_chmod_EROFS_clean(void)
 {
-       return test_yaffs_chmod() | EROFS_clean();
+       return  EROFS_clean() | test_yaffs_chmod() ;
 }
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mknode.c b/direct/timothy_tests/quick_tests/test_yaffs_mknode.c
deleted file mode 100644 (file)
index 5c6c5ca..0000000
+++ /dev/null
@@ -1,33 +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_mknode.h"
-
-static int output = 0;
-
-int test_yaffs_mknode(void)
-{
-       output = yaffs_mknod(NODE_PATH,S_IREAD | S_IWRITE);
-       return output;
-}
-
-
-int test_yaffs_mknode_clean(void)
-{
-       if (output >= 0){
-               return yaffs_unlink(NODE_PATH);
-       } else {
-               return 1;       /* the file failed to open so there is no need to close it */
-       }
-}
-
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_ELOOP_dir.c b/direct/timothy_tests/quick_tests/test_yaffs_open_ELOOP_dir.c
new file mode 100644 (file)
index 0000000..0f44248
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * 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_ELOOP_dir.h"
+
+static int handle = -1;
+
+int test_yaffs_open_ELOOP_dir(void)
+{
+       int error_code=0;
+
+       if (set_up_ELOOP()<0){
+               print_message("failed to setup symlinks\n",2);
+               return -1;
+       }
+       handle=yaffs_open(ELOOP_PATH "/file", O_TRUNC| O_RDWR,FILE_MODE );
+       if (handle <0){
+               error_code=yaffs_get_error();
+               if (abs(error_code)==ELOOP){
+                       return 1;
+               }
+               else {
+                       print_message("different error than expected\n",2);
+                       return -1;
+               }
+       }
+       else {
+               print_message("opened a ELOOP.(which is a bad thing)\n",2);
+               return -1;
+       }
+}
+
+int test_yaffs_open_ELOOP_dir_clean(void)
+{
+       if (handle >=0){
+               return yaffs_close(handle);
+       }
+       else {
+               return 1;       /* the file failed to open so there is no need to close it*/
+       }
+}
+
similarity index 77%
rename from direct/timothy_tests/quick_tests/test_yaffs_mknode.h
rename to direct/timothy_tests/quick_tests/test_yaffs_open_ELOOP_dir.h
index 7699141edda7f0ed13b9d6aec807409ca36a4b9d..9ee2f5f3a6095734914d7cb67f89e448d7caf01e 100644 (file)
  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  */
 
-#ifndef __test_yaffs_mknode_h__
-#define __test_yaffs_mknode_h__
+#ifndef __test_yaffs_open_ELOOP_dir_h__
+#define __test_yaffs_open_ELOOP_dir_h__
 
 #include "lib.h"
 #include "yaffsfs.h"
 
-int test_yaffs_mknode(void);
-int test_yaffs_mknode_clean(void);
+int test_yaffs_open_ELOOP_dir(void);
+int test_yaffs_open_ELOOP_dir_clean(void);
 
 #endif
index 25082ae273d4a0081e0ffb9d9394e5fa4b84db02..098430809fb0050779200c498539fc6a470e7443 100644 (file)
@@ -19,7 +19,7 @@ int test_yaffs_open_ENOTDIR(void)
 {
        int error_code=0;
 
-       handle=yaffs_open("/nonexisting_dir/foo", O_TRUNC| O_RDWR,FILE_MODE );
+       handle=yaffs_open("/yaffs2/foo/file", O_TRUNC| O_RDWR,FILE_MODE );
        if (handle <0){
                error_code=yaffs_get_error();
                if (abs(error_code)==ENOTDIR){
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.c b/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.c
new file mode 100644 (file)
index 0000000..27a4df4
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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_rename_ELOOP_dev.h"
+
+
+int test_yaffs_rename_ELOOP_dev(void)
+{
+       int output=0;
+       int error_code =0;
+
+       
+       if (set_up_ELOOP()<0){
+               print_message("failed to setup symlinks\n",2);
+               return -1;
+       }
+
+
+       output = yaffs_rename(ELOOP_PATH "/file" , RENAME_PATH);
+       if (output<0){ 
+               error_code=yaffs_get_error();
+               if (abs(error_code)==ELOOP){
+                       return 1;
+               } else {
+                       print_message("returned error does not match the the expected error\n",2);
+                       return -1;
+               }
+       } else{
+               print_message("renamed a ELOOP (which is a bad thing)\n",2);
+               return -1;
+       }       
+}
+
+
+int test_yaffs_rename_ELOOP_dev_clean(void)
+{
+       int output = 0;
+       if (0 ==  yaffs_access(RENAME_PATH,0)) {
+               output = yaffs_rename(RENAME_PATH,FILE_PATH);
+               if (output < 0) {
+                       print_message("failed to remove the directory\n",2);
+                       return -1;
+               }
+       }
+       return 1;
+
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.h b/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.h
new file mode 100644 (file)
index 0000000..377bbb2
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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_rename_ELOOP_dev_h__
+#define __test_yaffs_rename_ELOOP_dev_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_rename_ELOOP_dev(void);
+int test_yaffs_rename_ELOOP_dev_clean(void);
+
+#endif