yaffs Added some more tests to quick tests.
authorTimothy Manning <tfhmanning@gmail.com>
Mon, 15 Nov 2010 22:55:35 +0000 (11:55 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Tue, 16 Nov 2010 00:46:18 +0000 (13:46 +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_fchmod_EINVAL.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h [new file with mode: 0644]

index 6e298b4138ab225f23a3bc16d72348cdf5867568..9737cdba04ba99c38698101624225021acc7f274 100644 (file)
@@ -64,7 +64,9 @@ TESTFILES =   quick_tests.o lib.o \
                test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o\
                test_yaffs_fsync.o test_yaffs_fsync_EBADF.o \
                test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.o \
                test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o\
                test_yaffs_fsync.o test_yaffs_fsync_EBADF.o \
                test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.o \
-               test_yaffs_mkdir.o
+               test_yaffs_mkdir.o \
+               test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o
+
                  
 
 YAFFSTESTOBJS  = $(COMMONTESTOBJS) $(TESTFILES)
                  
 
 YAFFSTESTOBJS  = $(COMMONTESTOBJS) $(TESTFILES)
index 74d512a3e033b434acb4f0bb3dfb370c533c30f0..f2a99421fd3ade216ebe63998343a1608f89cf06 100644 (file)
@@ -9,6 +9,7 @@ Tests made
 
        test_yaffs_fchmod
        test_yaffs_fchmod_EBADF
 
        test_yaffs_fchmod
        test_yaffs_fchmod_EBADF
+       test_yaffs_fchmod_EINVAL
 
        test_yaffs_mount
        test_yaffs_mount_ENODEV
 
        test_yaffs_mount
        test_yaffs_mount_ENODEV
@@ -84,8 +85,6 @@ Tests made
 
 Tests to add
        test_yaffs_fchmod_EACCES
 
 Tests to add
        test_yaffs_fchmod_EACCES
-       test_yaffs_fchmod_EINVAL
-       test_yaffs_fchmod
 
        test_yaffs_chmod_EACCES
        test_yaffs_chmod_ELOOP
 
        test_yaffs_chmod_EACCES
        test_yaffs_chmod_ELOOP
@@ -224,11 +223,10 @@ Tests to add
 
        test_yaffs_close        //This function has already been called by the time this test is reached.
        
 
        test_yaffs_close        //This function has already been called by the time this test is reached.
        
-       test_yaffs_stat_EBADF
        test_yaffs_stat_ELOOP
        test_yaffs_stat_EACCES
        test_yaffs_stat_ENAMETOOLONG
        test_yaffs_stat_ELOOP
        test_yaffs_stat_EACCES
        test_yaffs_stat_ENAMETOOLONG
-       test_yaffs_stat_ENOTDIR
+
         
 
        test_yaffs_read_EFBIG
         
 
        test_yaffs_read_EFBIG
index 12bd6afb78467ae77a23a29a4b55c75fa9f3c75e..d2bc003c3458c29d410c196b199517025b1a758d 100644 (file)
@@ -92,6 +92,7 @@
 
 #include "test_yaffs_fchmod.h"
 #include "test_yaffs_fchmod_EBADF.h"
 
 #include "test_yaffs_fchmod.h"
 #include "test_yaffs_fchmod_EBADF.h"
+#include "test_yaffs_fchmod_EINVAL.h"
 
 #include "test_yaffs_fsync.h"
 #include "test_yaffs_fsync_EBADF.h"
 
 #include "test_yaffs_fsync.h"
 #include "test_yaffs_fsync_EBADF.h"
@@ -198,6 +199,9 @@ test_template test_list[]={
        {test_yaffs_fdatasync_EBADF,test_yaffs_fdatasync_EBADF_clean,"test_yaffs_fdatasync_EBADF"},
 
        {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"}
        {test_yaffs_fdatasync_EBADF,test_yaffs_fdatasync_EBADF_clean,"test_yaffs_fdatasync_EBADF"},
 
        {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"}
+
+       {test_yaffs_fchmod_EINVAL,test_yaffs_fchmod_EINVAL_clean,"test_yaffs_fchmod_EINVAL"}
+
        };
 
 void init_quick_tests(int argc, char *argv[]);
        };
 
 void init_quick_tests(int argc, char *argv[]);
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.c
new file mode 100644 (file)
index 0000000..61bb7b4
--- /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_fchmod_EINVAL.h"
+
+static int handle = -1;
+
+int test_yaffs_fchmod_EINVAL(void)
+{
+       int error = 0;
+       int output = 0;
+
+       
+       handle = test_yaffs_open();
+
+       if (handle < 0){
+               print_message("failed to open file\n",2);
+               return -1;
+       }
+
+
+
+       output = yaffs_fchmod(handle,111111);
+
+       if (output<0){
+               error=yaffs_get_error();
+               if (abs(error)==EINVAL){
+                       return 1;
+               } else {
+                       print_message("different error than expected\n",2);
+                       return -1;
+               }
+       } else {
+               print_message("chmoded an non-existing file (which is a bad thing)\n",2);
+               return -1;
+       }
+
+
+}
+
+int test_yaffs_fchmod_EINVAL_clean(void)
+{
+       if (handle >= 0) {
+               return yaffs_close(handle);
+       }
+       return test_yaffs_chmod();
+}
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h
new file mode 100644 (file)
index 0000000..0c7e2dc
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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_fchmod_EINVAL_h__
+#define __test_yaffs_fchmod_EINVAL_h__
+       
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+#include "test_yaffs_chmod.h"
+
+int test_yaffs_fchmod_EINVAL(void);    
+int test_yaffs_fchmod_EINVAL_clean(void);
+
+#endif