yaffs More quick tests.
authorTimothy Manning <tfhmanning@gmail.com>
Tue, 16 Nov 2010 02:49:09 +0000 (15:49 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Tue, 16 Nov 2010 02:49:09 +0000 (15:49 +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_mkdir_EEXIST.c
direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.h [new file with mode: 0644]

index 36a8b510e7a4bc33968ff91490a52efcde803e94..157abdea2fa275b066fcc3939ac49fb503e9f54f 100644 (file)
@@ -66,7 +66,7 @@ TESTFILES =   quick_tests.o lib.o \
                test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.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_fdatasync.o test_yaffs_fdatasync_EBADF.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.o test_yaffs_symlink_ENOTDIR.o
 
                  
 
 
                  
 
index e5a3e260f5d549053271eece162f833e31d0454c..f98e4190aacffe5391f1f96c80105da82eacab1e 100644 (file)
@@ -60,6 +60,8 @@ Tests made
        test_yaffs_stat_ENOENT
        test_yaffs_stat_ENOTDIR
 
        test_yaffs_stat_ENOENT
        test_yaffs_stat_ENOTDIR
 
+       test_yaffs_symlink
+
        test_yaffs_fstat
        test_yaffs_fstat_EBADF
 
        test_yaffs_fstat
        test_yaffs_fstat_EBADF
 
@@ -112,12 +114,12 @@ Tests to add
        test_yaffs_mkdir_ENAMETOOLONG
        test_yaffs_mkdir_EROFS
 
        test_yaffs_mkdir_ENAMETOOLONG
        test_yaffs_mkdir_EROFS
 
-       test_yaffs_symlink
+
        test_yaffs_symlink_EACCES
        test_yaffs_symlink_EEXISTS
        test_yaffs_symlink_ELOOP
        test_yaffs_symlink_ENAMETOOLONG
        test_yaffs_symlink_EACCES
        test_yaffs_symlink_EEXISTS
        test_yaffs_symlink_ELOOP
        test_yaffs_symlink_ENAMETOOLONG
-       test_yaffs_symlink_ENOENT
+       test_yaffs_symlink_ENOENT       //if there is a slash on the end
        test_yaffs_symlink_ENOTDIR
        test_yaffs_symlink_EROFS
 
        test_yaffs_symlink_ENOTDIR
        test_yaffs_symlink_EROFS
 
index 00b66839670b761223be211f855989a28c065941..d157d112aed2b99123205b6dc31d6b69cf4dcd4f 100644 (file)
 #include "test_yaffs_mkdir_ENOTDIR.h"
 
 #include "test_yaffs_symlink.h"
 #include "test_yaffs_mkdir_ENOTDIR.h"
 
 #include "test_yaffs_symlink.h"
+#include "test_yaffs_symlink_ENOTDIR.h"
+
 
 #include "yaffsfs.h"
 #include "yaffs_error_converter.h"
 
 #include "yaffsfs.h"
 #include "yaffs_error_converter.h"
@@ -207,7 +209,8 @@ test_template test_list[]={
        {test_yaffs_mkdir_EEXIST,test_yaffs_mkdir_EEXIST_clean,"test_yaffs_mkdir_EEXIST"},
        {test_yaffs_mkdir_ENOTDIR,test_yaffs_mkdir_ENOTDIR_clean,"test_yaffs_mkdir_ENOTDIR"},
 
        {test_yaffs_mkdir_EEXIST,test_yaffs_mkdir_EEXIST_clean,"test_yaffs_mkdir_EEXIST"},
        {test_yaffs_mkdir_ENOTDIR,test_yaffs_mkdir_ENOTDIR_clean,"test_yaffs_mkdir_ENOTDIR"},
 
-       {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"}
+       {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"},
+       {test_yaffs_symlink_ENOTDIR,test_yaffs_symlink_ENOTDIR_clean,"test_yaffs_symlink_ENOTDIR"}
 
 
 
 
 
 
index 939c2149b4779d7d2df7b4a8423f737359a20109..b83594e266ef8fa1dfc22a9d9880bac97e59c247 100644 (file)
@@ -49,10 +49,6 @@ int test_yaffs_mkdir_EEXIST(void)
 
 int test_yaffs_mkdir_EEXIST_clean(void)
 {
 
 int test_yaffs_mkdir_EEXIST_clean(void)
 {
-       if (output >= 0){
-               return yaffs_rmdir(DIR_PATH);
-       } else {
-               return 1;       
-       }
+       return yaffs_rmdir(DIR_PATH);
 }
 
 }
 
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c
new file mode 100644 (file)
index 0000000..b2f7867
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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_symlink_ENOTDIR.h"
+
+static int output = 0;
+
+int test_yaffs_symlink_ENOTDIR(void)
+{
+       int error_code = 0;
+       output = yaffs_symlink(FILE_PATH,"non-existing-dir/sym_link");
+       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("created a symlink in a non-existing directory (which is a bad thing)\n",2);
+               return -1;
+       }       
+
+}
+
+int test_yaffs_symlink_ENOTDIR_clean(void)
+{
+       if (output >= 0){
+               return yaffs_unlink(SYMLINK_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_symlink_ENOTDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.h
new file mode 100644 (file)
index 0000000..e8f26eb
--- /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_symlink_ENOTDIR_h__
+#define __test_yaffs_symlink_ENOTDIR_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_symlink_ENOTDIR(void);
+int test_yaffs_symlink_ENOTDIR_clean(void);
+
+#endif