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.o test_yaffs_read_EBADF.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_open_EINVAL2 //the function open has two modes which can be set, so two tests modes are needed.
test_yaffs_read
+ test_yaffs_read_EBADF
+
test_yaffs_stat
test_yaffs_truncate
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_read_EISDIR //Cannot be generated with yaffs.
+ test what happens if you read off the end of the file?
+
test_yaffs_unlink_EACCES
test_yaffs_unlink_ELOOP
test_yaffs_unlink_ENOMEM
test_yaffs_access_ENOENT_generated_with_a_dangling_symbloic_link
test_yaffs_ftruncate_EACCES
- test_yaffs_ftruncate_EISDIR //
- test_yaffs_ftruncate_ELOOP //
- test_yaffs_ftruncate_ENOENT //
- test_yaffs_ftruncate_ENOTDIR //
+ test_yaffs_ftruncate_EISDIR //Cannot be generated with yaffs.
+ test_yaffs_ftruncate_ELOOP //Cannot be generated with yaffs.
+ test_yaffs_ftruncate_ENOENT //Cannot be generated with yaffs.
+ test_yaffs_ftruncate_ENOTDIR //Cannot be generated with yaffs.
test_yaffs_truncate_EACCES
test_yaffs_truncate_ELOOP
#include "test_yaffs_truncate_EFBIG.h"
#include "test_yaffs_write.h"
+
#include "test_yaffs_read.h"
+#include "test_yaffs_read_EBADF.h"
#include "test_yaffs_lseek.h"
#include "test_yaffs_lseek_EBADF.h"
{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"},
+ {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_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
--- /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_read_EBADF.h"
+
+int test_yaffs_read_EBADF(void){
+ int error_code=0;
+ int output=0;
+ char text[100];
+ text[0] ='\0';
+ output=yaffs_read(-1, text, FILE_TEXT_NBYTES);
+ if (output<0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==EBADF){
+ return 1;
+ }
+ else {
+ printf("returned error does not match the the expected error\n");
+ return -1;
+ }
+ }
+ else{
+ printf("read a non-existing file (which is a bad thing)\n");
+ return -1;
+ }
+}
+
+int test_yaffs_read_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_read_EBADF_h__
+#define __test_yaffs_read_EBADF_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);
+#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_read_EBADF.h"
+
+static int handle=0;
+
+int test_yaffs_read_EBADF(void){
+ 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);
+ if (output<0){
+ if (0==memcmp(text,FILE_TEXT,FILE_TEXT_NBYTES)){
+ return 1;
+ }
+ else {
+ printf("returned error does not match the the expected error\n");
+ return -1;
+ }
+ }
+ else{
+ printf("read a non-existing file (which is a bad thing)\n");
+ return -1;
+ }
+ }
+ else {
+ printf("error opening file\n");
+ return -1;
+ }
+
+}
+
+int test_yaffs_read_EBADF_clean(void){
+ return yaffs_close(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_read_EBADF_h__
+#define __test_yaffs_read_EBADF_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);
+#endif