yaffs Still hunting the bug.
authorTimothy Manning <tfhmanning@gmail.com>
Wed, 17 Nov 2010 00:45:53 +0000 (13:45 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Wed, 17 Nov 2010 00:45:53 +0000 (13:45 +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/lib.h
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_yaffs_sync.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_sync.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unmount2.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unmount2.h [new file with mode: 0644]

index 94614fb..dca2eed 100644 (file)
@@ -67,7 +67,9 @@ TESTFILES =   quick_tests.o lib.o \
                test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o \
                test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o \
                test_yaffs_symlink.o test_yaffs_symlink_ENOTDIR.o test_yaffs_symlink_EEXIST.o test_yaffs_symlink_ENOENT.o \
-               test_yaffs_mount2.o
+               test_yaffs_mount2.o \
+               test_yaffs_unmount2.o \
+               test_yaffs_sync.o
 
 
                  
index 41efeee..5033e12 100644 (file)
@@ -16,6 +16,8 @@ Tests made
        test_yaffs_mount_ENAMETOOLONG
        test_yaffs_mount_EBUSY          //caused by trying to mount a new mount point with a mount point already mounted.
 
+       test_yaffs_mount2
+
        test_yaffs_access
        test_yaffs_access_ENIVAL
        test_yaffs_access_ENOTDIR
@@ -86,6 +88,8 @@ Tests made
        test_yaffs_unmount_ENAMETOOLONG
        test_yaffs_umount_EBUSY //cause by having a file handle open and then trying to unmount yaffs.
 
+       test_yaffs_unmount2
+
        test_yaffs_write
        test_yaffs_write_EBADF
 
@@ -124,7 +128,7 @@ Tests to add
        test_yaffs_symlink_EROFS
 
        
-       //the yaffs_mknod function does not exist in yaffsfs, so these tests will be ignored.
+       //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
@@ -135,13 +139,16 @@ Tests to add
        test_yaffs_mknod_ENOTDIR
        test_yaffs_mknod_EROFS
 
-       test_yaffs_mount2
+
        test_yaffs_mount2_EINVAL
        test_yaffs_mount2_ENOTDIR
        test_yaffs_mount2_ENOENT
        test_yaffs_mount2_ENODEV
        test_yaffs_mount2_ENAMETOOLONG
 
+
+       test_yaffs_unmount2_with handle open and forced mode on
+       test_yaffs_unmount2_with handle open and forced mode off. should give EBUSY.
        test_yaffs_unmount2
        test_yaffs_unmount2_ENOENT
        test_yaffs_unmount2_ENOTDIR
index 2906312..bf7001f 100644 (file)
@@ -36,6 +36,8 @@
 
 #define NODE_PATH "/yaffs2/node"
 
+
+
 /* warning do not define anything as FILE because there seems to be a conflict with stdio.h */ 
 #define FILE_PATH "/yaffs2/foo"
 
index 16776c1..0a6cf06 100644 (file)
 
 #include "test_yaffs_mount2.h"
 
+#include "test_yaffs_unmount2.h"
+
+#include "test_yaffs_sync.h"
+
 #include "yaffsfs.h"
 #include "yaffs_error_converter.h"
 #include "lib.h"
@@ -217,9 +221,11 @@ test_template test_list[]={
        {test_yaffs_symlink_EEXIST,test_yaffs_symlink_EEXIST_clean,"test_yaffs_symlink_EEXIST"},
        {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"},
 
-       {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"}
+       {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"},
 
+       {test_yaffs_unmount2,test_yaffs_unmount2_clean,"test_yaffs_unmount2"},
 
+       {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"}
 
 
 
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync.c b/direct/timothy_tests/quick_tests/test_yaffs_sync.c
new file mode 100644 (file)
index 0000000..9f7b03e
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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_sync.h"
+
+
+int test_yaffs_sync(void)
+{
+       return yaffs_sync(FILE_PATH);
+
+}
+
+
+int test_yaffs_sync_clean(void)
+{
+       return 1;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync.h b/direct/timothy_tests/quick_tests/test_yaffs_sync.h
new file mode 100644 (file)
index 0000000..82a7c9c
--- /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_sync_h__
+#define __test_yaffs_sync_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_sync(void);
+int test_yaffs_sync_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c
new file mode 100644 (file)
index 0000000..97fb2b1
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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_sync_ENOTDIR.h"
+
+
+int test_yaffs_sync_ENOTDIR(void)
+{
+       int output = yaffs_sync("non-existing-dir/foo");
+       if (output<0){
+               error_code=yaffs_get_error();
+               if (abs(error_code)==ENOTDIR){
+                       return 1;
+               } else {
+                       print_message("returned error does not match the the expected error\n",2);
+                       return -1;
+               }
+       } else {
+               print_message("synced a file in a non-existing directory (which is a bad thing)\n",2);
+               return -1;
+       }       
+
+
+}
+
+
+int test_yaffs_sync_ENOTDIR_clean(void)
+{
+       return 1;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h
new file mode 100644 (file)
index 0000000..4b11cab
--- /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_sync_ENOTDIR_h__
+#define __test_yaffs_sync_ENOTDIR_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_sync_ENOTDIR(void);
+int test_yaffs_sync_ENOTDIR_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount2.c
new file mode 100644 (file)
index 0000000..d0b1408
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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_unmount2.h"
+
+int test_yaffs_unmount2(void)
+{
+       int output = -1;
+
+       output = yaffs_unmount2(YAFFS_MOUNT_POINT,1);
+       return output;
+}
+
+int test_yaffs_unmount2_clean(void)
+{
+       return test_yaffs_mount();      
+}
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount2.h
new file mode 100644 (file)
index 0000000..fc2e13b
--- /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_unmount2__
+#define __test_yaffs_unmount2__
+
+#include "yaffsfs.h"
+#include "lib.h"
+#include "test_yaffs_mount.h"
+
+int test_yaffs_unmount2(void);
+int test_yaffs_unmount2_clean(void);
+#endif