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_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\
test_yaffs_ftruncate.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_lseek.o \
test_yaffs_open_ENAMETOOLONG
test_yaffs_open_ENOENT
test_yaffs_open_ENOTDIR
+ test_yaffs_open_EINVAL
+ test_yaffs_open_EINVAL2 //the function open has to modes which can be set, so two modes are needed.
test_yaffs_read
test_yaffs_stat
test_yaffs_truncate_EISDIR
test_yaffs_truncate_ENOENT
test_yaffs_truncate_ENIVAL
+ test_yaffs_truncate_EFBIG
test_yaffs_unlink
test_yaffs_unlink_EISDIR
test_yaffs_ftruncate_ELOOP
test_yaffs_ftruncate_ENOENT
test_yaffs_ftruncate_ENOTDIR
- test_yaffs_ftruncate_EPERM
test_yaffs_truncate_EACCES
- test_yaffs_truncate_EFBIG
test_yaffs_truncate_ELOOP
test_yaffs_truncate_ENAMETOOLONG
- test_yaffs_truncate_EPERM
+
check to see if an error code is generated when there isn't an error.
Bug truncating a file to a size of -1 does not cause an error.
+ BUG truncating a file to a size greater than the maximum file size should
+ return the error EFBIG. However EFBIG has not been defined in yaffs and
+ needs to be added. When a file is truncated to a large size
+ (size =10000000000000000000000000000000000000000000) the truncate
+ function works without any errors, which is wrong.
+
+ Bug with opening a file with bad mode. yaffs_open has two modes which
+ are passed into it. if the modes are set to 255 the open function
+ does not report any errors. (Also need to try this with modes set to -1.)
+
Current WARNINGS
WARNING- If yaffs is unmounted then most of yaffs' functions return ENODIR.
#include "test_yaffs_open_ENOENT.h"
#include "test_yaffs_open_ENOTDIR.h"
#include "test_yaffs_open_ENAMETOOLONG.h"
+#include "test_yaffs_open_EINVAL.h"
+#include "test_yaffs_open_EINVAL2.h"
#include "test_yaffs_close_EBADF.h"
#include "test_yaffs_truncate_EISDIR.h"
#include "test_yaffs_truncate_ENOENT.h"
#include "test_yaffs_truncate_EINVAL.h"
+#include "test_yaffs_truncate_EFBIG.h"
#include "test_yaffs_write.h"
#include "test_yaffs_read.h"
{test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"},
{test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"},
{test_yaffs_open_ENAMETOOLONG,test_yaffs_open_ENAMETOOLONG_clean,"test_yaffs_open_ENAMETOOLONG"},
+ {test_yaffs_open_EINVAL,test_yaffs_open_EINVAL_clean,"test_yaffs_open_EINVAL"},
+ {test_yaffs_open_EINVAL2,test_yaffs_open_EINVAL2_clean,"test_yaffs_open_EINVAL2"},
{test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
{test_yaffs_truncate_ENOTDIR,test_yaffs_truncate_ENOTDIR_clean,"test_yaffs_truncate_ENOTDIR"},
{test_yaffs_truncate_EISDIR,test_yaffs_truncate_EISDIR_clean,"test_yaffs_truncate_EISDIR"},
{test_yaffs_truncate_EINVAL,test_yaffs_truncate_EINVAL_clean,"test_yaffs_truncate_EINVAL"},
- {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"}
+ {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"},
+ {test_yaffs_truncate_EFBIG,test_yaffs_truncate_EFBIG_clean,"test_yaffs_truncate_EFBIG"}
};
void init_quick_tests(void);
--- /dev/null
+/*
+ * 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_EINVAL.h"
+
+static int handle=0;
+int test_yaffs_open_EINVAL(void){
+ int output=0;
+ int error_code=0;
+ /*printf("path %s\n",path); */
+ handle=yaffs_open(FILE_PATH, 255,FILE_MODE);
+ if (handle==-1){
+ error_code=yaffs_get_error();
+ //printf("EEXIST def %d, Error code %d\n",(- EEXIST),error_code);
+ if (abs(error_code)== EINVAL){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf(" file opened with bad mode.(which is a bad thing)\n");
+ return -1;
+ }
+ /* the program should not get here but the compiler is complaining */
+ return -1;
+}
+int test_yaffs_open_EINVAL_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*/
+ }
+}
+
--- /dev/null
+/*
+ * 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_open_EINVAL_h__
+#define __test_yaffs_open_EINVAL_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_open_EINVAL(void);
+int test_yaffs_open_EINVAL_clean(void);
+#endif
--- /dev/null
+/*
+ * 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_EINVAL2.h"
+
+static int handle=0;
+int test_yaffs_open_EINVAL2(void){
+ int output=0;
+ int error_code=0;
+ /*printf("path %s\n",path); */
+ handle=yaffs_open(FILE_PATH, O_CREAT | O_RDWR ,255);
+ if (handle==-1){
+ error_code=yaffs_get_error();
+ //printf("EEXIST def %d, Error code %d\n",(- EEXIST),error_code);
+ if (abs(error_code)== EINVAL){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf(" file opened with bad mode.(which is a bad thing)\n");
+ return -1;
+ }
+ /* the program should not get here but the compiler is complaining */
+ return -1;
+}
+int test_yaffs_open_EINVAL2_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*/
+ }
+}
+
--- /dev/null
+/*
+ * 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_open_EINVAL2_h__
+#define __test_yaffs_open_EINVAL2_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_open_EINVAL2(void);
+int test_yaffs_open_EINVAL2_clean(void);
+#endif
--- /dev/null
+/*
+ * 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_EFBIG.h"
+static int handle=0;
+
+int test_yaffs_truncate_EFBIG(void){
+ int error=0;
+ int output=0;
+ handle=test_yaffs_open();
+ if (handle>=0){
+ output= yaffs_truncate("/yaffs2/foo",10000000000000000000000000000000000000000000 );
+ if (output<0){
+ error=yaffs_get_error();
+ if (abs(error)==EINVAL){
+ return 1;
+ }
+ else {
+ printf("recieved a different error than expected\n");
+ return -1;
+ }
+ }
+ else{
+ printf("truncated a file to a massive size\n");
+ return -1;
+ }
+
+ }
+ else {
+ printf("error opening file");
+ return -1;
+ }
+}
+
+int test_yaffs_truncate_EFBIG_clean(void){
+ return 1;
+}
--- /dev/null
+/*
+ * 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_EFBIG_h__
+#define __test_yaffs_truncate_EFBIG_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_truncate_EFBIG(void);
+int test_yaffs_truncate_EFBIG_clean(void);
+#endif