yaffs Added more tests to direct/timothy_tests/quick_tests
authorTimothy Manning <tfhmanning@gmail.com>
Mon, 29 Nov 2010 00:55:50 +0000 (13:55 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Mon, 29 Nov 2010 00:57:10 +0000 (13:57 +1300)
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
22 files changed:
direct/timothy_tests/quick_tests/Makefile
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_yaffs_fchmod_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_fsync_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_open_EROFS.c
direct/timothy_tests/quick_tests/test_yaffs_rename_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_rename_EROFS.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_rmdir_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_rmdir_EROFS.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_symlink_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_symlink_EROFS.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_sync_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_sync_EROFS.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_truncate_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_truncate_EROFS.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_write_EROFS.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_write_EROFS.h [new file with mode: 0644]

index 8d25cd9..57fdacb 100644 (file)
@@ -52,13 +52,13 @@ TESTFILES =         quick_tests.o lib.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_open_EROFS.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_unlink_ELOOP_dir.o \
+               test_yaffs_unlink_ENOTDIR.o test_yaffs_unlink_ENOENT2.o test_yaffs_unlink_ELOOP_dir.o test_yaffs_unlink_EROFS.o \
                test_yaffs_ftruncate.o test_yaffs_ftruncate_EBADF.o test_yaffs_ftruncate_EINVAL.o test_yaffs_ftruncate_big_file.o \
                test_yaffs_ftruncate_EROFS.o \
                test_yaffs_truncate.o test_yaffs_truncate_ENOTDIR.o test_yaffs_truncate_EISDIR.o test_yaffs_truncate_ENOENT.o \
                test_yaffs_truncate_EINVAL.o test_yaffs_truncate_big_file.o test_yaffs_truncate_ENOENT2.o test_yaffs_truncate_ELOOP.o \
-               test_yaffs_truncate_ELOOP_dir.o \
-               test_yaffs_write.o test_yaffs_write_EBADF.o test_yaffs_write_big_file.o \
+               test_yaffs_truncate_ELOOP_dir.o test_yaffs_truncate_EROFS.o \
+               test_yaffs_write.o test_yaffs_write_EBADF.o test_yaffs_write_big_file.o test_yaffs_write_EROFS.o \
                test_yaffs_read.o test_yaffs_read_EBADF.o test_yaffs_read_EINVAL.o\
                test_yaffs_lseek.o test_yaffs_lseek_EBADF.o test_yaffs_lseek_EINVAL.o test_yaffs_lseek_big_file.o \
                test_yaffs_access.o test_yaffs_access_EINVAL.o test_yaffs_access_ENOTDIR.o test_yaffs_access_ENOENT.o \
@@ -76,11 +76,11 @@ TESTFILES =         quick_tests.o lib.o \
                test_yaffs_mkdir_ELOOP_dir.o test_yaffs_mkdir_EROFS.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_symlink_ENOENT2.o test_yaffs_symlink_ELOOP_dir.o \
+               test_yaffs_symlink_ENOENT2.o test_yaffs_symlink_ELOOP_dir.o test_yaffs_symlink_EROFS.o \
                test_yaffs_mount2.o test_yaffs_mount2_ENODEV.o \
                test_yaffs_unmount2.o test_yaffs_unmount2_ENODEV.o test_yaffs_unmount2_EINVAL.o \
                test_yaffs_unmount2_with_handle_open_and_forced_mode_on.o test_yaffs_unmount2_with_handle_open_and_forced_mode_off.o\
-               test_yaffs_sync.o test_yaffs_sync_ENODEV.o  \
+               test_yaffs_sync.o test_yaffs_sync_ENODEV.o  test_yaffs_sync_EROFS.o \
                test_yaffs_remount_force_off_read_only_off.o test_yaffs_remount_force_on_read_only_off.o test_yaffs_remount_ENODEV.o \
                test_yaffs_remount_EINVAL.o \
                test_yaffs_freespace.o test_yaffs_freespace_EINVAL.o \
@@ -90,10 +90,10 @@ TESTFILES =         quick_tests.o lib.o \
                test_yaffs_link_ENOTDIR2.o test_yaffs_link_ENOENT2.o test_yaffs_link_ENOENT3.o test_yaffs_link_ENOENT3.o \
                test_yaffs_link_ENOENT4.o test_yaffs_link_ELOOP_dir.o test_yaffs_link_EROFS.o \
                test_yaffs_rmdir.o test_yaffs_rmdir_EBUSY.o test_yaffs_rmdir_EINVAL.o test_yaffs_rmdir_ENOENT.o \
-               test_yaffs_rmdir_ENOTDIR.o test_yaffs_rmdir_ELOOP_dir.o \
+               test_yaffs_rmdir_ENOTDIR.o test_yaffs_rmdir_ELOOP_dir.o test_yaffs_rmdir_EROFS.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_dir.o \
+               test_yaffs_rename_file_to_dir.o test_yaffs_rename_EEXISTS.o  test_yaffs_rename_ELOOP_dir.o test_yaffs_rename_EROFS.o \
                test_yaffs_lstat.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o \
                test_yaffs_flush.o test_yaffs_flush_EBADF.o test_yaffs_flush_EROFS.o
 
index 336a1d7..017b4ab 100644 (file)
@@ -50,6 +50,7 @@
 #include "test_yaffs_unlink_ENOENT.h"
 #include "test_yaffs_unlink_ENOENT2.h"
 #include "test_yaffs_unlink_ELOOP_dir.h"
+#include "test_yaffs_unlink_EROFS.h"
 
 #include "test_yaffs_ftruncate.h"
 #include "test_yaffs_ftruncate_EBADF.h"
 #include "test_yaffs_truncate_ENOENT2.h"
 #include "test_yaffs_truncate_ELOOP.h"
 #include "test_yaffs_truncate_ELOOP_dir.h"
+#include "test_yaffs_truncate_EROFS.h"
 
 #include "test_yaffs_write.h"
 #include "test_yaffs_write_EBADF.h"
 #include "test_yaffs_write_big_file.h"
+#include "test_yaffs_write_EROFS.h"
 
 #include "test_yaffs_read.h"
 #include "test_yaffs_read_EBADF.h"
 #include "test_yaffs_symlink_ENOENT.h"
 #include "test_yaffs_symlink_ENOENT2.h"
 #include "test_yaffs_symlink_ELOOP_dir.h"
+#include "test_yaffs_symlink_EROFS.h"
 
 #include "test_yaffs_mount2.h"
 #include "test_yaffs_mount2_ENODEV.h"
 
 #include "test_yaffs_sync.h"
 #include "test_yaffs_sync_ENODEV.h"
+#include "test_yaffs_sync_EROFS.h"
 
 #include "test_yaffs_remount_force_off_read_only_off.h"
 #include "test_yaffs_remount_force_on_read_only_off.h"
 #include "test_yaffs_rmdir_ENOENT.h"
 #include "test_yaffs_rmdir_ENOTDIR.h"
 #include "test_yaffs_rmdir_ELOOP_dir.h"
+#include "test_yaffs_rmdir_EROFS.h"
 
 #include "test_yaffs_rename.h"
 #include "test_yaffs_rename_ENOENT.h"
 #include "test_yaffs_rename_file_to_dir.h"
 #include "test_yaffs_rename_EEXISTS.h"
 #include "test_yaffs_rename_ELOOP_dir.h"
+#include "test_yaffs_rename_EROFS.h"
 
 #include "test_yaffs_lstat.h"
 #include "test_yaffs_lstat_ENOENT.h"
@@ -259,6 +266,7 @@ test_template test_list[]={
        {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"},
        {test_yaffs_unlink_ENOENT2,test_yaffs_unlink_ENOENT2_clean,"test_yaffs_unlink_ENOENT2"},
        {test_yaffs_unlink_ELOOP_dir,test_yaffs_unlink_ELOOP_dir_clean,"test_yaffs_unlink_ELOOP_dir"},
+       {test_yaffs_unlink_EROFS,test_yaffs_unlink_EROFS_clean,"test_yaffs_unlink_EROFS"},
 
 
        {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
@@ -269,6 +277,7 @@ test_template test_list[]={
        {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
        {test_yaffs_write_EBADF,test_yaffs_write_EBADF_clean,"test_yaffs_write_EBADF"},
        {test_yaffs_write_big_file,test_yaffs_write_big_file_clean,"test_yaffs_write_big_file"},
+       {test_yaffs_write_EROFS,test_yaffs_write_EROFS_clean,"test_yaffs_write_EROFS"},
 
        {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
        {test_yaffs_read_EBADF,test_yaffs_read_EBADF_clean,"test_yaffs_read_EBADF"},
@@ -297,6 +306,7 @@ test_template test_list[]={
        {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"},
        {test_yaffs_truncate_ENOENT2,test_yaffs_truncate_ENOENT2_clean,"test_yaffs_truncate_ENOENT2"},
        {test_yaffs_truncate_ELOOP,test_yaffs_truncate_ELOOP_clean,"test_yaffs_truncate_ELOOP"},
+       {test_yaffs_truncate_EROFS,test_yaffs_truncate_EROFS_clean,"test_yaffs_truncate_EROFS"},
 //     {test_yaffs_truncate_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled.
 
        {test_yaffs_chmod,test_yaffs_chmod_clean,"test_yaffs_chmod"},
@@ -326,6 +336,7 @@ test_template test_list[]={
        {test_yaffs_mkdir_ENOENT,test_yaffs_mkdir_ENOENT_clean,"test_yaffs_mkdir_ENOENT"},
        {test_yaffs_mkdir_ELOOP_dir,test_yaffs_mkdir_ELOOP_dir_clean,"test_yaffs_mkdir_ELOOP_dir"},
        {test_yaffs_mkdir_EROFS,test_yaffs_mkdir_EROFS_clean,"test_yaffs_mkdir_EROFS"},
+       {test_yaffs_rename_EROFS,test_yaffs_rename_EROFS_clean,"test_yaffs_rename_EROFS"},
 
        {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"},
        {test_yaffs_symlink_ENOTDIR,test_yaffs_symlink_ENOTDIR_clean,"test_yaffs_symlink_ENOTDIR"},
@@ -333,6 +344,7 @@ test_template test_list[]={
        {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"},
        {test_yaffs_symlink_ENOENT2,test_yaffs_symlink_ENOENT2_clean,"test_yaffs_symlink_ENOENT2"},
        {test_yaffs_symlink_ELOOP_dir,test_yaffs_symlink_ELOOP_dir_clean,"test_yaffs_symlink_ELOOP_dir"},
+       {test_yaffs_symlink_EROFS,test_yaffs_symlink_EROFS_clean,"test_yaffs_symlink_EROFS"},
 
        {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"},
        {test_yaffs_mount2_ENODEV,test_yaffs_mount2_ENODEV_clean,"test_yaffs_mount2_ENODEV"},
@@ -346,7 +358,7 @@ test_template test_list[]={
 
        {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"},
        {test_yaffs_sync_ENODEV,test_yaffs_sync_ENODEV_clean,"test_yaffs_sync_ENODEV"},
-
+       {test_yaffs_sync_EROFS,test_yaffs_sync_EROFS_clean,"test_yaffs_sync_EROFS"},
 
 
        {test_yaffs_remount_force_off_read_only_off,test_yaffs_remount_force_off_read_only_off_clean,"test_yaffs_remount_force_off_read_only_off"},
@@ -380,6 +392,8 @@ test_template test_list[]={
        {test_yaffs_rmdir_ENOENT,test_yaffs_rmdir_ENOENT_clean,"test_yaffs_rmdir_ENOENT"},
        {test_yaffs_rmdir_ENOTDIR,test_yaffs_rmdir_ENOTDIR_clean,"test_yaffs_rmdir_ENOTDIR"},
        {test_yaffs_rmdir_ELOOP_dir,test_yaffs_rmdir_ELOOP_dir_clean,"test_yaffs_rmdir_ELOOP_dir"},
+       {test_yaffs_rmdir_EROFS,test_yaffs_rmdir_EROFS_clean,"test_yaffs_rmdir_EROFS"},
+
        {test_yaffs_stat_ELOOP_dir,test_yaffs_stat_ELOOP_dir_clean,"test_yaffs_stat_ELOOP_dir"},
 
        {test_yaffs_rename,test_yaffs_rename_clean,"test_yaffs_rename"},
index 0d733fa..c3fcfea 100644 (file)
@@ -21,13 +21,14 @@ int test_yaffs_fchmod_EROFS(void)
        if (EROFS_setup() < 0 ){
                return -1;
        }
-       handle = test_yaffs_open();
-
-       if (handle < 0){
+       handle = yaffs_open(FILE_PATH,O_CREAT  ,S_IREAD  );
+       if (handle<0){
                print_message("failed to open file\n",2);
                return -1;
        }
 
+
+
        output = yaffs_fchmod(handle,S_IREAD|S_IWRITE);
 
        if (output<0){
index d2d78b8..9820904 100644 (file)
@@ -20,7 +20,11 @@ int test_yaffs_fdatasync_EROFS(void)
        int output = 0;
        int error_code = 0;
        EROFS_setup();
-       handle = test_yaffs_open();
+       handle = yaffs_open(FILE_PATH,O_CREAT  ,S_IREAD  );
+       if (handle<0){
+               print_message("failed to open file\n",2);
+               return -1;
+       }
        output = yaffs_fdatasync(handle);
        if (output==-1){
                error_code=yaffs_get_error();
index b8a1ac5..e31af7f 100644 (file)
@@ -20,7 +20,11 @@ int test_yaffs_flush_EROFS(void)
        int output=0;
        int error =0;
        EROFS_setup();
-       handle = test_yaffs_open();
+       handle = yaffs_open(FILE_PATH,O_CREAT  ,S_IREAD  );
+       if (handle<0){
+               print_message("failed to open file\n",2);
+               return -1;
+       }
        output = yaffs_flush(handle);
        if (output<0){
                error=yaffs_get_error();
index 97757fa..a4e3081 100644 (file)
@@ -21,7 +21,11 @@ int test_yaffs_fsync_EROFS(void)
        int error_code = 0;
 
        EROFS_setup();
-       handle = test_yaffs_open();
+       handle = yaffs_open(FILE_PATH,O_CREAT  ,S_IREAD  );
+       if (handle<0){
+               print_message("failed to open file\n",2);
+               return -1;
+       }
        output = yaffs_fsync(handle);
        if (output==-1){
                error_code=yaffs_get_error();
index 57a3ab5..192a43b 100644 (file)
@@ -20,8 +20,11 @@ int test_yaffs_ftruncate_EROFS(void)
        int output = 0;
        int error_code = 0;
        EROFS_setup();
-       handle = test_yaffs_open();
-
+       handle = yaffs_open(FILE_PATH,O_CREAT  ,S_IREAD  );
+       if (handle<0){
+               print_message("failed to open file\n",2);
+               return -1;
+       }
        output = yaffs_ftruncate(handle,FILE_SIZE_TRUNCATED );
        if (output < 0){
                error_code=yaffs_get_error();
index 5b85563..0773b7d 100644 (file)
@@ -21,7 +21,7 @@ int test_yaffs_open_EROFS(void)
        yaffs_unlink(FILE_PATH);
        EROFS_setup();
 
-       handle = yaffs_open(FILE_PATH, O_CREAT | O_EXCL | O_TRUNC| O_RDWR ,FILE_MODE );
+       handle = yaffs_open(FILE_PATH, O_CREAT  ,S_IREAD);
        if (handle == -1){
                error_code = yaffs_get_error();
                if (abs(error_code) == EROFS){
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_rename_EROFS.c
new file mode 100644 (file)
index 0000000..5f5437b
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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_EROFS.h"
+
+
+int test_yaffs_rename_EROFS(void)
+{
+       int output=0;
+       int error_code =0;
+       EROFS_setup();
+       output = yaffs_rename(FILE_PATH , RENAME_PATH);
+       if (output<0){ 
+               error_code=yaffs_get_error();
+               if (abs(error_code)==EROFS){
+                       return 1;
+               } else {
+                       print_message("returned error does not match the the expected error\n",2);
+                       return -1;
+               }
+       } else{
+               print_message("removed /yaffs2/ directory (which is a bad thing)\n",2);
+               return -1;
+       }       
+}
+
+
+int test_yaffs_rename_EROFS_clean(void)
+{
+       int output = 0;
+       if (0 ==  yaffs_access("/yaffs2/dir2/file",0) ) {
+               output = yaffs_unlink("/yaffs2/dir2/file");
+               if (output < 0) {
+                       print_message("failed to remove the file\n",2);
+                       return -1;
+               }
+       }
+       if (0 ==  yaffs_access(RENAME_PATH,0) && 0 != yaffs_access(DIR_PATH,0)) {
+               output = yaffs_rename(RENAME_PATH,FILE_PATH);
+               if (output < 0) {
+                       print_message("failed to remove the directory\n",2);
+                       return -1;
+               }
+       }
+       
+       return  EROFS_clean();
+
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_rename_EROFS.h
new file mode 100644 (file)
index 0000000..cdabca4
--- /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_EROFS_h__
+#define __test_yaffs_rename_EROFS_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_rename_EROFS(void);
+int test_yaffs_rename_EROFS_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rmdir_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_rmdir_EROFS.c
new file mode 100644 (file)
index 0000000..17e28e6
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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_rmdir_EROFS.h"
+
+
+int test_yaffs_rmdir_EROFS(void)
+{
+       int output=0;
+       int error_code =0;
+
+       
+
+       if (0 !=  yaffs_access(DIR_PATH,0)) {
+               output = yaffs_mkdir(DIR_PATH,S_IWRITE | S_IREAD);
+               if (output < 0) {
+                       print_message("failed to create directory\n",2);
+                       return -1;
+               }
+       }
+
+       EROFS_setup();
+
+       output = yaffs_rmdir(DIR_PATH);
+       if (output<0){ 
+               error_code=yaffs_get_error();
+               if (abs(error_code)==EROFS){
+                       return 1;
+               } else {
+                       print_message("returned error does not match the the expected error\n",2);
+                       return -1;
+               }
+       } else{
+               print_message("removed /yaffs2/ directory (which is a bad thing)\n",2);
+               return -1;
+       }       
+}
+
+
+int test_yaffs_rmdir_EROFS_clean(void)
+{
+       int output = 0;
+       int output2 =EROFS_clean();
+       if (0 ==  yaffs_access(DIR_PATH,0)) {
+               output = yaffs_rmdir(DIR_PATH);
+               if (output < 0) {
+                       print_message("failed to remove the directory\n",2);
+                       return -1;
+               }
+       }
+       return  (output && output2);
+
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rmdir_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_rmdir_EROFS.h
new file mode 100644 (file)
index 0000000..a090435
--- /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_rmdir_EROFS_h__
+#define __test_yaffs_rmdir_EROFS_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_rmdir_EROFS(void);
+int test_yaffs_rmdir_EROFS_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_symlink_EROFS.c
new file mode 100644 (file)
index 0000000..c53848c
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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_EROFS.h"
+
+static int output = 0;
+
+int test_yaffs_symlink_EROFS(void)
+{
+       int error_code = 0;
+       if (-1==yaffs_access(SYMLINK_PATH,0)){
+               output=yaffs_symlink(FILE_PATH,SYMLINK_PATH);
+               if (output>0){
+                       print_message("failed to create the first symlink\n",2);
+                       return -1;
+               }
+       }
+       EROFS_setup();
+       output = yaffs_symlink(FILE_PATH,SYMLINK_PATH);
+       if (output<0){ 
+               error_code=yaffs_get_error();
+               if (abs(error_code)==EROFS){
+                       return 1;
+               } else {
+                       print_message("returned error does not match the the expected error\n",2);
+                       return -1;
+               }
+       } else {
+               print_message("created a symlink over an existing symlink (which is a bad thing)\n",2);
+               return -1;
+       }       
+
+}
+
+int test_yaffs_symlink_EROFS_clean(void)
+{
+       return EROFS_clean() && yaffs_unlink(SYMLINK_PATH);
+}
+
+
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_symlink_EROFS.h
new file mode 100644 (file)
index 0000000..428d365
--- /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_EROFS_h__
+#define __test_yaffs_symlink_EROFS_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_symlink_EROFS(void);
+int test_yaffs_symlink_EROFS_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_sync_EROFS.c
new file mode 100644 (file)
index 0000000..4497b7c
--- /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_sync_EROFS.h"
+
+
+int test_yaffs_sync_EROFS(void)
+{
+       int error_code=-1;
+       int output=0;
+
+       EROFS_setup();
+
+       output = yaffs_sync(YAFFS_MOUNT_POINT);
+       
+       if (output<0){
+               error_code=yaffs_get_error();
+               if (abs(error_code)==EROFS){
+                       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_EROFS_clean(void)
+{
+       return  EROFS_clean();
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_sync_EROFS.h
new file mode 100644 (file)
index 0000000..3db9760
--- /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_EROFS_h__
+#define __test_yaffs_sync_EROFS_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_sync_EROFS(void);
+int test_yaffs_sync_EROFS_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate_EROFS.c
new file mode 100644 (file)
index 0000000..ae0662d
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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_truncate_EROFS.h"
+
+
+
+int test_yaffs_truncate_EROFS(void)
+{
+       int error=0;
+       int output=0;
+
+
+       EROFS_setup();
+       output= yaffs_truncate(FILE_PATH,FILE_SIZE_TRUNCATED );
+       if (output<0){
+               error=yaffs_get_error();
+               if (abs(error)==EROFS){
+                       return 1;
+               } else {
+                       print_message("received a different error than expected\n",2);
+                       return -1;
+               }
+       } else{
+               print_message("truncated a file with EROFS\n",2);
+               return -1;
+       }
+}
+
+int test_yaffs_truncate_EROFS_clean(void)
+{
+       return  EROFS_clean();
+}
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_truncate_EROFS.h
new file mode 100644 (file)
index 0000000..45bde51
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * 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_truncate_EROFS_h__
+#define __test_yaffs_truncate_EROFS_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_truncate_EROFS(void);
+int test_yaffs_truncate_EROFS_clean(void); 
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.c
new file mode 100644 (file)
index 0000000..23ac0f7
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * 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_EROFS.h"
+
+
+int test_yaffs_unlink_EROFS(void)
+{
+       int output=0;
+       int error_code=0;
+
+       EROFS_setup();
+
+       output=yaffs_unlink(FILE_PATH);
+       if (output==-1){
+               error_code=yaffs_get_error();
+               if (abs(error_code)==EROFS){
+                       return 1;
+               } else {
+                       print_message("different error than expected\n",2);
+                       return -1;
+               }
+       } else {
+               print_message("unlinked a directory with EROFS set.(which is a bad thing)\n",2);
+               return -1;
+       }
+
+
+}
+int test_yaffs_unlink_EROFS_clean(void)
+{
+       return EROFS_clean();
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.h
new file mode 100644 (file)
index 0000000..0cc6ea2
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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_unlink_EROFS_dir_h__
+#define __test_yaffs_unlink_EROFS_dir_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_unlink_EROFS(void);
+int test_yaffs_unlink_EROFS_clean(void);
+
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_write_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_write_EROFS.c
new file mode 100644 (file)
index 0000000..d39e42a
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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_write_EROFS.h"
+
+static int handle= -1;
+
+int test_yaffs_write_EROFS(void)
+{
+       int output=0;
+       int error_code=0;
+       EROFS_setup();
+       handle=yaffs_open(FILE_PATH, O_CREAT  ,S_IREAD);
+       if (handle>=0){
+               output= yaffs_write(handle, FILE_TEXT, FILE_TEXT_NBYTES);
+               if (output<0){
+                       error_code=yaffs_get_error();
+                       //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
+                       if (abs(error_code)==EROFS){
+                               return 1;
+                       } else {
+                               print_message("different error than expected\n",2);
+                               return -1;
+                       }
+               } else {
+                       print_message("wrote to a bad handle.(which is a bad thing)\n",2);
+                       return -1;
+               }
+
+       } else {
+               print_message("error opening file\n",2);
+               return -1;
+       }
+}
+
+int test_yaffs_write_EROFS_clean(void)
+{
+       int output=1;
+       if (handle>=0){
+               output= yaffs_close(handle);
+       } 
+       return (EROFS_clean() && output);
+}
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_write_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_write_EROFS.h
new file mode 100644 (file)
index 0000000..e66008a
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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_write_EROFS_h__
+#define __test_yaffs_write_EROFS_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_write_EROFS(void);
+int test_yaffs_write_EROFS_clean(void);
+
+#endif