yaffs Yet more tests for quick tests.
authorTimothy Manning <tfhmanning@gmail.com>
Tue, 9 Nov 2010 03:32:03 +0000 (16:32 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Tue, 9 Nov 2010 03:32:03 +0000 (16:32 +1300)
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
21 files changed:
direct/timothy_tests/quick_tests/Makefile
direct/timothy_tests/quick_tests/README.txt
direct/timothy_tests/quick_tests/current_bugs.txt
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_yaffs_lseek_EFBIG.c
direct/timothy_tests/quick_tests/test_yaffs_lseek_EINVAL.c
direct/timothy_tests/quick_tests/test_yaffs_read.c
direct/timothy_tests/quick_tests/test_yaffs_read_EINVAL.c
direct/timothy_tests/quick_tests/test_yaffs_read_EINVAL.h
direct/timothy_tests/quick_tests/test_yaffs_stat.c
direct/timothy_tests/quick_tests/test_yaffs_truncate_EFBIG.c
direct/timothy_tests/quick_tests/test_yaffs_truncate_EINVAL.c
direct/timothy_tests/quick_tests/test_yaffs_truncate_EISDIR.c
direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT.c
direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOTDIR.c
direct/timothy_tests/quick_tests/test_yaffs_unlink_ENAMETOOLONG.c
direct/timothy_tests/quick_tests/test_yaffs_unmount_ENAMETOOLONG.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unmount_ENAMETOOLONG.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unmount_ENOENT.c [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_unmount_ENOENT.h [new file with mode: 0644]
direct/timothy_tests/quick_tests/test_yaffs_write.c

index 07b2948..85aa36b 100644 (file)
@@ -46,7 +46,7 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsf
 
 TESTFILES =    quick_tests.o lib.o \
                test_yaffs_mount.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.o test_yaffs_mount_ENOENT.o test_yaffs_mount_EBUSY.o \
-               test_yaffs_unmount.o\
+               test_yaffs_unmount.o test_yaffs_unmount_ENOENT.o test_yaffs_unmount_ENAMETOOLONG.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_unlink.o  test_yaffs_unlink_EISDIR.o test_yaffs_unlink_ENOENT.o test_yaffs_unlink_ENAMETOOLONG.o test_yaffs_unlink_ENOTDIR.o\
@@ -54,7 +54,7 @@ TESTFILES =   quick_tests.o lib.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_EFBIG.o\
                test_yaffs_write.o \
-               test_yaffs_read.o test_yaffs_read_EBADF.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_EFBIG.o \
                test_yaffs_access.o test_yaffs_access_EINVAL.o test_yaffs_access_ENOTDIR.o test_yaffs_access_ENOENT.o\
                test_yaffs_stat.o \
index cc5b036..58536c9 100644 (file)
@@ -10,7 +10,7 @@ Tests made
        test_yaffs_mount_EBUSY          //called when trying to mount a new mount point with a mount point already mounted.
 
        test_yaffs_access
-       test_yaffs_access_ENIVAL        //when the mode is incorrect.
+       test_yaffs_access_ENIVAL
        test_yaffs_access_ENOTDIR
        test_yaffs_access_ENOENT
 
@@ -37,6 +37,7 @@ Tests made
 
        test_yaffs_read
        test_yaffs_read_EBADF
+       test_yaffs_read_EINVAL
 
        test_yaffs_stat
 
@@ -55,9 +56,12 @@ Tests made
        test_yaffs_unlink_ENOENT
 
        test_yaffs_unmount
+       test_yaffs_unmount_ENOENT
+       test_yaffs_unmount_ENAMETOOLONG
+
        test_yaffs_write
 
-       add a test where a directory is moved. /fluffy/box. move "fluffy" to "/fluffy/frog". 
+       
 
 Tests to add
        test_yaffs_mount_EACCES         //Cannot be generated with yaffs.
@@ -66,10 +70,9 @@ Tests to add
        test_yaffs_mount_EMFILE         //Cannot be generated with yaffs.
        test_yaffs_mount_ENOTDIR        //Cannot be generated with yaffs.
 
-       test_yaffs_umount_ENODEV
-       test_yaffs_umount_ENAMETOOLONG
-       test_yaffs_umount_ENOENT
-       test_yaffs_umount_EBUSY
+       test_yaffs_umount_ENODEV        //Cannot be generated with yaffs.
+       test_yaffs_umount_ENOENT        //Cannot be generated with yaffs.
+       test_yaffs_umount_EBUSY         //when files are open and yaffs is unmounted.
 
        test_yaffs_open_EACCES
        test_yaffs_open_ENOSPC
@@ -78,11 +81,20 @@ Tests to add
 
        test_yaffs_close        //This function has already been called by the time this test is reached.
        
-
-       test_yaffs_read_EINVAL  //test exists but is not finshed yet. 
+       test_yaffs_stat_EBADF
+       test_yaffs_stat_ELOOP
+       test_yaffs_stat_EACCES
+       test_yaffs_stat_ENAMETOOLONG
+       test_yaffs_stat_ENOTDIR
+        
        test_yaffs_read_EISDIR          //Cannot be generated with yaffs.
        test what happens if you read off the end of the file?
 
+       test_yaffs_write_EBADF
+       test_yaffs_write_EFBIG
+       test_yaffs_write_EINVAL
+       What happens when you run out of space?
+
        test_yaffs_unlink_EACCES
        test_yaffs_unlink_ELOOP
        test_yaffs_unlink_ENOMEM
@@ -106,7 +118,10 @@ Tests to add
        What happens if a handle is opened to a file and the file is then deleted?
        Check to see if yaffs generates an error code for no reason.
        What happens when a file is opened with no modes set?
+       Add a test where a directory is moved. /fluffy/box. move "fluffy" to "/fluffy/frog". 
+       What happens when yaffs is unmounted twice?
 
+       What happens when open a handle, unmount yaffs and then try to use the handle? 
 
 How to add a test
        First create the test .c and .h file.
index da09048..f2a81c9 100644 (file)
@@ -15,6 +15,9 @@ Current BUGS
                ENODEV. yaffs_mount should be returning ENAMETOOLONG.
                When the name is passed into the yaffs_mount function the length of the
                mount point decreases from around 10000000 to 200. This needs to be investigated.
+               
+               Bug with unmounting a too long non-existing mountpoint. 
+               The error returned is ENODEV. It should be ENAMETOOLONG.
 
 
        ENOTDIR ERRORS
@@ -30,12 +33,24 @@ Current BUGS
        Bug with lseeking to a very large size (size =100000000000000000000000000000000000000) without causing an error.
        Should cause the error EINVAL.
 
+       Bug with unmounting a non-existing mountpoint. The function returns ENODEV 
+       but should be returning EINVAL.
+       
+       Bug with reading -1 bytes of a file without an error (test is in test_yaffs_read_EINVAL).
+       It should return EINVAL.
+
+       Unmount2 forcing the unmount needs to break the handles so they return EBADF.
+
 
 Current WARNINGS
        
-       <<WHAT FUNCTIONS>>
        WARNING- If yaffs is unmounted then most of yaffs' functions return ENODIR. 
-       some function return EBADF instead.
+       But some function return EBADF instead.
+       Functions which return ENOTDIR: open, close, access, unlink, lseek, write, read
+
+       Functions which return ENOENT: access, stat
+       
+
 
        WARNING-the function yaffs_open does not check the mode passed to it. 
        This means that yaffs open does not return EINVAL if a bad mode is passed to it.
index 9a0adc2..b1fb094 100644 (file)
@@ -24,6 +24,8 @@
 #include "test_yaffs_mount_EBUSY.h"
 
 #include "test_yaffs_unmount.h"
+#include "test_yaffs_unmount_ENOENT.h"
+#include "test_yaffs_unmount_ENAMETOOLONG.h"
 
 #include "test_yaffs_open.h"
 #include "test_yaffs_open_EISDIR.h"
@@ -61,6 +63,7 @@
 
 #include "test_yaffs_read.h"
 #include "test_yaffs_read_EBADF.h"
+#include "test_yaffs_read_EINVAL.h"
 
 #include "test_yaffs_lseek.h"
 #include "test_yaffs_lseek_EBADF.h"
@@ -89,14 +92,16 @@ typedef struct test {
 
 
 test_template test_list[]={
-       {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
+/*     {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
        {test_yaffs_mount_ENODEV,test_yaffs_mount_ENODEV_clean,"test_yaffs_mount_ENODEV"},
        {test_yaffs_mount_ENAMETOOLONG,test_yaffs_mount_ENAMETOOLONG_clean,"test_yaffs_mount_ENAMETOOLONG"},
        {test_yaffs_mount_ENOENT,test_yaffs_mount_ENOENT_clean,"test_yaffs_mount_ENOENT"},
        {test_yaffs_mount_EBUSY,test_yaffs_mount_EBUSY_clean,"test_yaffs_mount_EBUSY"},
 
        {test_yaffs_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"},
-
+       {test_yaffs_unmount_ENOENT,test_yaffs_unmount_ENOENT_clean,"test_yaffs_unmount_ENOENT"},
+       {test_yaffs_unmount_ENAMETOOLONG,test_yaffs_unmount_ENAMETOOLONG_clean,"test_yaffs_unmount_ENAMETOOLONG"},
+*/
        {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"},
        {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"},
        {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"},
@@ -130,6 +135,7 @@ test_template test_list[]={
 
        {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
        {test_yaffs_read_EBADF,test_yaffs_read_EBADF_clean,"test_yaffs_read_EBADF"},
+       {test_yaffs_read_EINVAL,test_yaffs_read_EINVAL_clean,"test_yaffs_read_EINVAL"},
 
        {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
 
index 4822499..5a001bb 100644 (file)
 
 #include "test_yaffs_lseek_EFBIG.h"
 
-static int handle=0;
+static int handle=-1;
 
 int test_yaffs_lseek_EFBIG(void){
        handle=test_yaffs_open();
        int error_code=0;
-       int output=yaffs_lseek(handle, 100000000000000000000000000000000000000, SEEK_SET);
+       int output=0;
+
+       if (handle<0){
+               printf("failed to open file\n");
+               return -1;
+       }
+       
+       yaffs_lseek(handle, 100000000000000000000000000000000000000, SEEK_SET);
 
        if (output<0){
                error_code=yaffs_get_error();
index 173e1b5..b03914e 100644 (file)
 
 #include "test_yaffs_lseek_EINVAL.h"
 
-int handle=0;
+int handle=-1;
 
 int test_yaffs_lseek_EINVAL(void){
        handle=test_yaffs_open();
        int error_code=0;
-       int output=yaffs_lseek(handle, 0, -1);
+       int output=0;
+
+       if (handle<0){
+               printf("failed to open file\n");
+               return -1;
+       }
+       
+
+       output=yaffs_lseek(handle, 0, -1);
 
        if (output<0){
                error_code=yaffs_get_error();
index 2bc2aba..a5157d2 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "test_yaffs_read.h"
 
-static int handle=0;
+static int handle=-1;
 
 int test_yaffs_read(void){
        handle=test_yaffs_open();
@@ -46,5 +46,10 @@ int test_yaffs_read(void){
 }
 
 int test_yaffs_read_clean(void){
-       return yaffs_close(handle);
+       if (handle>=0){
+               return yaffs_close(handle);
+       }
+       else {
+               return 1; /* no handle was opened so there is no need to close a handle */
+       }       
 }
index 7e7d43e..f11e3ad 100644 (file)
  * published by the Free Software Foundation.
  */
 
-#include "test_yaffs_read_EBADF.h"
+#include "test_yaffs_read_EINVAL.h"
 
 static int handle=0;
 
-int test_yaffs_read_EBADF(void){
+int test_yaffs_read_EINVAL(void){
+       int error_code=0;
        handle=test_yaffs_open();
        char text[20]="\0";
        int output=0;
-       //printf("handle %d\n",handle);
+
        if (handle>=0){
-               output=yaffs_read(-1, text, FILE_TEXT_NBYTES);
-               //printf("yaffs_test_read output: %d\n",output);
-               //printf("text in file is: '%s' expected text is '%s'\n",text,FILE_TEXT);
+               output=yaffs_read(handle, text, -1);
+
                if (output<0){ 
-                       if (0==memcmp(text,FILE_TEXT,FILE_TEXT_NBYTES)){
+                       error_code=yaffs_get_error();
+                       if (abs(error_code)== EINVAL){
                                return 1;
                        }
                        else {
-                               printf("returned error does not match the the expected error\n");
+                               printf("different error than expected\n");
                                return -1;
                        }
                }
@@ -45,6 +46,11 @@ int test_yaffs_read_EBADF(void){
        
 }
 
-int test_yaffs_read_EBADF_clean(void){
-       return yaffs_close(handle);
+int test_yaffs_read_EINVAL_clean(void){
+       if (handle>=0){
+               return yaffs_close(handle);
+       }
+       else {
+               return 1; /* no handle was opened so there is no need to close a handle */
+       }       
 }
index 845148f..b965058 100644 (file)
  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  */
 
-#ifndef __test_yaffs_read_EBADF_h__
-#define __test_yaffs_read_EBADF_h__
+#ifndef __test_yaffs_read_EINVAL_h__
+#define __test_yaffs_read_EINVAL_h__
 #include "lib.h"
 #include "yaffsfs.h"
 #include "test_yaffs_open.h"
 
 
-int test_yaffs_read_EBADF(void);
-int test_yaffs_read_EBADF_clean(void);
+int test_yaffs_read_EINVAL(void);
+int test_yaffs_read_EINVAL_clean(void);
 #endif
index f99ab7f..d379944 100644 (file)
@@ -17,28 +17,38 @@ int test_yaffs_stat(void){
        int mode=0;
        int size=0;
        mode =yaffs_test_stat_mode();
-/*     printf("\nmode %o\n",mode);
-       printf("expected mode %o \n",FILE_MODE);
-       printf("anding together %o\n",FILE_MODE & mode);
-       printf("%d\n",FILE_MODE == (FILE_MODE & mode));
-*/     if (FILE_MODE == (FILE_MODE & mode)){
-               mode=1;
+       
+       if (mode>=0){
+       
+               if (FILE_MODE == (FILE_MODE & mode)){
+                       mode=1;
+               }
+               else {
+                       printf("mode did not match expected file mode\n");
+                       return -1;
+               }
        }
        else {
-               printf("mode did not match expected file mode\n");
-               return -1;
+               mode =-1;
        }
+
        size=yaffs_test_stat_size();
-       if (size==FILE_SIZE){
-               size=1;
+       if (size >=0){
+               if (size==FILE_SIZE){
+                       size=1;
+               }
+               else {
+                       printf("file size %d, expected file size %d\n",size,FILE_SIZE);
+                       printf("mode did not match expected file mode\n");
+                       return -1;
+               }
        }
        else {
-               printf("file size %d, expected file size %d\n",size,FILE_SIZE);
-               printf("mode did not match expected file mode\n");
-               return -1;
-       }
-       
-       if (mode && size){
+               size =-1;
+       }       
+
+
+       if ((mode>0) && (size>0)){
                return 1;
        }
        else {
@@ -61,7 +71,7 @@ int yaffs_test_stat_mode(void){
                return stat.st_mode;    
        }
        else {
-               printf("failed to stat file\n") ;
+               printf("failed to stat file mode\n") ;
                return -1;
        }
 }
@@ -74,7 +84,7 @@ int yaffs_test_stat_size(void){
                return stat.st_size;    
        }
        else {
-               printf("failed to stat file\n") ;
+               printf("failed to stat file size\n") ;
                return -1;
        }
 }
index 7ea85da..0fc79af 100644 (file)
@@ -26,7 +26,7 @@ int test_yaffs_truncate_EFBIG(void){
                                return 1;
                        }
                        else {
-                               printf("recieved a different error than expected\n");
+                               printf("received a different error than expected\n");
                                return -1;
                        }
                }
index bec53de..7c8fd9d 100644 (file)
@@ -26,7 +26,7 @@ int test_yaffs_truncate_EINVAL(void){
                                return 1;
                        }
                        else {
-                               printf("recieved a different error than expected\n");
+                               printf("received a different error than expected\n");
                                return -1;
                        }
                }
index 051e1a7..5fa4601 100644 (file)
@@ -26,7 +26,7 @@ int test_yaffs_truncate_EISDIR(void){
                                return 1;
                        }
                        else {
-                               printf("recieved a different error than expected\n");
+                               printf("received a different error than expected\n");
                                return -1;
                        }
                }
index 6258aea..7d264e5 100644 (file)
@@ -26,7 +26,7 @@ int test_yaffs_truncate_ENOENT(void){
                                return 1;
                        }
                        else {
-                               printf("recieved a different error than expected\n");
+                               printf("received a different error than expected\n");
                                return -1;
                        }
                }
index 2cc71b5..bda51ef 100644 (file)
@@ -26,7 +26,7 @@ int test_yaffs_truncate_ENOTDIR(void){
                                return 1;
                        }
                        else {
-                               printf("recieved a different error than expected\n");
+                               printf("received a different error than expected\n");
                                return -1;
                        }
                }
index c5184a5..8f25543 100644 (file)
@@ -14,7 +14,7 @@
 #include "test_yaffs_unlink_ENAMETOOLONG.h"
 
 
-static int handle=0;
+
 int test_yaffs_unlink_ENAMETOOLONG(void){
        int output=0;
        int error_code=0;
@@ -45,15 +45,9 @@ int test_yaffs_unlink_ENAMETOOLONG(void){
                printf("directory unlinked opened.(which is a bad thing)\n");
                return -1;
        }
-       /* the program should not get here but the compiler is complaining */
-       return -1;
 }
+
 int test_yaffs_unlink_ENAMETOOLONG_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*/
-       }
+       return 1;
 }
 
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENAMETOOLONG.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENAMETOOLONG.c
new file mode 100644 (file)
index 0000000..1af5761
--- /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_unmount_ENAMETOOLONG.h"
+
+
+
+
+int test_yaffs_unmount_ENAMETOOLONG(void){
+       int output=0;
+       int x;
+       int error_code=0;
+       int file_name_length=1000000;
+       char file_name[file_name_length];
+
+
+
+       for (x=0; x<file_name_length -1; x++){
+               file_name[x]='a';
+       }
+       file_name[file_name_length-2]='\0';
+       
+       //printf("file name: %s\n",file_name);
+
+
+       output=yaffs_unmount(file_name);
+
+       if (output<0){
+               error_code=yaffs_get_error();
+               if (abs(error_code)== ENAMETOOLONG){
+                       return 1;
+               }
+               else {
+                       printf("different error than expected\n");
+                       return -1;
+               }
+       }
+       else {
+               printf("mounted a too long mount point name.(which is a bad thing)\n");
+               return -1;
+       }
+       /* the program should not get here but the compiler is complaining */
+       return -1;
+}
+
+int test_yaffs_unmount_ENAMETOOLONG_clean(void){
+       return 1;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENAMETOOLONG.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENAMETOOLONG.h
new file mode 100644 (file)
index 0000000..f337671
--- /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_unmount_ENAMETOOLONG_h__
+#define __test_yaffs_unmount_ENAMETOOLONG_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_mount.h"
+#include "test_yaffs_unmount.h"
+
+
+int test_yaffs_unmount_ENAMETOOLONG(void);
+int test_yaffs_unmount_ENAMETOOLONG_clean(void);
+#endif
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENOENT.c
new file mode 100644 (file)
index 0000000..5eb853c
--- /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_mount_ENOENT.h"
+
+
+int test_yaffs_unmount_ENOENT(void){
+       int output=0;
+       int error_code=0;
+       /*printf("path %s\n",path); */
+       
+       
+
+       output=yaffs_unmount("/non_existaint_mount_point/");
+       if (output==-1){
+               error_code=yaffs_get_error();
+               if (abs(error_code)==EINVAL){
+                       return 1;
+               }
+               else {
+                       printf("different error than expected\n");
+                       return -1;
+               }
+       }
+       else {
+               printf("non existant mount point unmounted.(which is a bad thing)\n");
+               return -1;
+       }
+
+}
+int test_yaffs_unmount_ENOENT_clean(void){
+       return 1;
+}
+
diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount_ENOENT.h
new file mode 100644 (file)
index 0000000..9c4c2cc
--- /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_unmount_ENOENT_h__
+#define __test_yaffs_unmount_ENOENT_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_unmount.h"
+#include "test_yaffs_mount.h"
+
+int test_yaffs_unmount_ENOENT(void);
+int test_yaffs_unmount_ENOENT_clean(void);
+#endif
index dbd17e5..cd5a61f 100644 (file)
@@ -27,5 +27,10 @@ int test_yaffs_write(void){
 }
 
 int test_yaffs_write_clean(void){
-       return yaffs_close(handle);
+       if (handle>=0){
+               return yaffs_close(handle);
+       }
+       else {
+               return 1; /* no handle was opened so there is no need to close a handle */
+       }       
 }