test_yaffs_truncate_EFBIG.o\
test_yaffs_write.o \
test_yaffs_read.o \
- test_yaffs_lseek.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 \
test_yaffs_close_EBADF.o
test_yaffs_ftruncate
test_yaffs_ftruncate_EBADF
test_yaffs_ftruncate_ENIVAL
+ test_yaffs_ftruncate_EFBIG
test_yaffs_lseek
+ test_yaffs_lseek_EBADF
+ test_yaffs_lseek_EINVAL
+ test_yaffs_lseek_EFBIG
test_yaffs_open
test_yaffs_open_EEXIST
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_open_EINVAL2 //the function open has two modes which can be set, so two tests modes are needed.
test_yaffs_read
test_yaffs_stat
test_yaffs_open_ELOOP //Too many symbolic links were encountered in resolving pathname
test yaffs_open_running_out_of_handles error
- 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_unlink_EACCES
test_yaffs_unlink_ELOOP
test_yaffs_unlink_ENOMEM
test_yaffs_access_ENAMETOOLONG
test_yaffs_access_ENOENT_generated_with_a_dangling_symbloic_link
- test_yaffs_ftruncate_EACCES
- test_yaffs_ftruncate_EFBIG
- test_yaffs_ftruncate_EISDIR
- test_yaffs_ftruncate_ELOOP
- test_yaffs_ftruncate_ENOENT
- test_yaffs_ftruncate_ENOTDIR
+ test_yaffs_ftruncate_EACCES
+ test_yaffs_ftruncate_EISDIR //
+ test_yaffs_ftruncate_ELOOP //
+ test_yaffs_ftruncate_ENOENT //
+ test_yaffs_ftruncate_ENOTDIR //
test_yaffs_truncate_EACCES
test_yaffs_truncate_ELOOP
test_yaffs_truncate_ENAMETOOLONG
add a truncate function for truncating a file size to -1.
-
- check to see if an error code is generated when there isn't an error.
+ 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?
How to add a test
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.)
+ Bug with lseeking to a very large size (size =100000000000000000000000000000000000000) without causing an error.
+ Should cause the error EINVAL.
+
Current WARNINGS
#include "test_yaffs_ftruncate_EINVAL.h"
#include "test_yaffs_ftruncate_EFBIG.h"
+
#include "test_yaffs_truncate.h"
#include "test_yaffs_truncate_ENOTDIR.h"
#include "test_yaffs_truncate_EISDIR.h"
#include "test_yaffs_write.h"
#include "test_yaffs_read.h"
+
#include "test_yaffs_lseek.h"
+#include "test_yaffs_lseek_EBADF.h"
+#include "test_yaffs_lseek_EINVAL.h"
+#include "test_yaffs_lseek_EFBIG.h"
#include "test_yaffs_access.h"
#include "test_yaffs_access_EINVAL.h"
{test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
+ {test_yaffs_lseek_EBADF,test_yaffs_lseek_EBADF_clean,"test_yaffs_lseek_EBADF"},
+ {test_yaffs_lseek_EINVAL,test_yaffs_lseek_EINVAL_clean,"test_yaffs_lseek_EINVAL"},
+ {test_yaffs_lseek_EFBIG,test_yaffs_lseek_EFBIG_clean,"test_yaffs_lseek_EFBIG"},
+
{test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
{test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
static int handle=0;
int test_yaffs_lseek(void){
handle=test_yaffs_open();
- char text[20]="\0";
int output=0;
if (handle>=0){
- if (0==yaffs_lseek(handle, 0, SEEK_SET)){
+ output=yaffs_lseek(handle, 0, SEEK_SET);
+ if (output==0){
return 1;
}
else {
- printf("lseek returned a different position to the expeced position\n");
+ if (output<0){
+ printf("lseek failed to seek\n");
+ }
+ else {
+ printf("lseek returned a different position to the expeced position\n");
+ return -1;
+ }
}
}
else {
}
int test_yaffs_lseek_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 */
+ }
+
}
+
+
--- /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_lseek_EBADF.h"
+
+
+int test_yaffs_lseek_EBADF(void){
+ int error_code=0;
+ int output=yaffs_lseek(-1, 0, SEEK_SET);
+ if (output<0){
+ error_code=yaffs_get_error();
+ //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
+ if (abs(error_code)==EBADF){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("lseeked to a negative position\n");
+ }
+}
+
+int test_yaffs_lseek_EBADF_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_lseek_EBADF_h__
+#define __test_yaffs_lseek_EBADF_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_lseek_EBADF(void);
+int test_yaffs_lseek_EBADF_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_lseek_EFBIG.h"
+
+static int handle=0;
+
+int test_yaffs_lseek_EFBIG(void){
+ handle=test_yaffs_open();
+ int error_code=0;
+ int output=yaffs_lseek(handle, 100000000000000000000000000000000000000, SEEK_SET);
+
+ if (output<0){
+ error_code=yaffs_get_error();
+ //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
+ if (abs(error_code)==EINVAL){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("lseeked to a very large size (which is a bad thing)\n");
+ return -1;
+ }
+}
+
+int test_yaffs_lseek_EFBIG_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 */
+ }
+}
+
--- /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_lseek_EFBIG_h__
+#define __test_yaffs_lseek_EFBIG_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_lseek_EFBIG(void);
+int test_yaffs_lseek_EFBIG_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_lseek_EINVAL.h"
+
+int handle=0;
+
+int test_yaffs_lseek_EINVAL(void){
+ handle=test_yaffs_open();
+ int error_code=0;
+ int output=yaffs_lseek(handle, 0, -1);
+
+ if (output<0){
+ error_code=yaffs_get_error();
+ //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
+ if (abs(error_code)==EINVAL){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("lseeked to a negative position (which is a bad thing)\n");
+ return -1;
+ }
+}
+
+int test_yaffs_lseek_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 */
+ }
+}
+
--- /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_lseek_EINVAL_h__
+#define __test_yaffs_lseek_EINVAL_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_lseek_EINVAL(void);
+int test_yaffs_lseek_EINVAL_clean(void);
+
+#endif