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 \
+ test_yaffs_stat.o test_yaffs_stat_ENOENT.o test_yaffs_stat_ENOTDIR.o \
+ test_yaffs_fstat.o test_yaffs_fstat_EBADF.o \
test_yaffs_close_EBADF.o
test_yaffs_stat
+ test_yaffs_stat_ENOENT
+ test_yaffs_stat_ENOTDIR
+
+ test_yaffs_fstat
+ test_yaffs_fstat_EBADF
test_yaffs_truncate
test_yaffs_truncate_ENOTDIR
test_yaffs_unlink_ELOOP
test_yaffs_unlink_ENOMEM
+ test_yaffs_stat_EACCES
+ test_yaffs_stat_ELOOP
+
test_yaffs_access_EACCESS
test_yaffs_access_ELOOP
test_yaffs_access_ENAMETOOLONG
test_yaffs_truncate_EACCES
test_yaffs_truncate_ELOOP
test_yaffs_truncate_ENAMETOOLONG
- add a truncate function for truncating a file size to -1.
+ Add a truncate function for truncating a file size to -1.
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.
Bug when trying to truncate a file in a non-existing directory. The error
returned is ENOENT it should be ENOTDIR.
+ Bug when trying to stat a file in a non-existing directory. The error
+ returned is ENOENT, it should be ENOTDIR
+
Bug with truncating to a very large size. The yaffs_truncate function truncates the file to a massive size without any errors.
The function should return 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.
- A read of -1 bytes tries to read 4 gig of data
+ Bug with reading -1 bytes of a file without an error (test is in test_yaffs_read_EINVAL).
+ It should return EINVAL. This is because it was reading an empty file.
+ When text is added to the file a read of -1 bytes tries to read 4 gig of data
+
+ Bug when writing a file. the writhing to the file causes the file size to exceed the size of yaffs file system memory.
+ Output of test:
+ test_yaffs_write_EFBIG
+ AddrToChunk of offset -2147483648 gives chunk -1048576 start 0
+ AddrToChunk of offset -2147481600 gives chunk -1048575 start 0
+ AddrToChunk of offset -2147479552 gives chunk -1048574 start 0
+ AddrToChunk of offset -2147477504 gives chunk -1048573 start 0
+ AddrToChunk of offset -2147475456 gives chunk -1048572 start 0
+ AddrToChunk of offset -2147473408 gives chunk -1048571 start 0
+ AddrToChunk of offset -2147471360 gives chunk -1048570 start 0
+ AddrToChunk of offset -2147469312 gives chunk -1048569 start 0
+ AddrToChunk of offset -2147467264 gives chunk -1048568 start 0
+ AddrToChunk of offset -2147465216 gives chunk -1048567 start 0
+ wrote a large amount of text to a file.(which is a bad thing)
+ test: test_yaffs_write_EFBIG failed
+ yaffs_error code 0
+ error is : Unknown error code
+
Current WARNINGS
#include "test_yaffs_access_ENOENT.h"
#include "test_yaffs_stat.h"
+#include "test_yaffs_stat_ENOENT.h"
+#include "test_yaffs_stat_ENOTDIR.h"
+
+#include "test_yaffs_fstat.h"
+#include "test_yaffs_fstat_EBADF.h"
+
#include "yaffsfs.h"
#include "yaffs_error_converter.h"
#include "lib.h"
{test_yaffs_read_EINVAL,test_yaffs_read_EINVAL_clean,"test_yaffs_read_EINVAL"},
{test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
+ {test_yaffs_stat_ENOENT,test_yaffs_stat_ENOENT_clean,"test_yaffs_stat_ENOENT"},
+ {test_yaffs_stat_ENOTDIR,test_yaffs_stat_ENOTDIR_clean,"test_yaffs_stat_ENOTDIR"},
+
+ {test_yaffs_fstat,test_yaffs_fstat_clean,"test_yaffs_fstat"},
+ {test_yaffs_fstat_EBADF,test_yaffs_fstat_EBADF_clean,"test_yaffs_fstat_EBADF"},
{test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
{test_yaffs_ftruncate_EBADF,test_yaffs_ftruncate_EBADF_clean,"test_yaffs_ftruncate_EBADF"},
--- /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_fstat.h"
+
+static int handle=0;
+int test_yaffs_fstat(void){
+ struct yaffs_stat stat;
+ handle=test_yaffs_open();
+ if (handle>=0){
+ return yaffs_fstat(handle , &stat);;
+ }
+ else {
+ printf("error opening file\n");
+ return -1;
+ }
+}
+
+int test_yaffs_fstat_clean(void){
+ if (handle<0){
+ return yaffs_close(handle);
+ }
+ 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_fstat_h__
+#define __test_yaffs_fstat_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_fstat(void);
+int test_yaffs_fstat_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_fstat_EBADF.h"
+
+
+int test_yaffs_fstat_EBADF(void){
+ int output=0;
+ struct yaffs_stat stat;
+ int error_code=0;
+ output=yaffs_fstat(-1 , &stat);
+ if (output<0){
+ error_code=yaffs_get_error();
+ //printf("EISDIR def %d, Error code %d\n", EISDIR,error_code);
+ if (abs(error_code)== EBADF){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("non existant file truncated.(which is a bad thing)\n");
+ return -1;
+ }
+}
+
+int test_yaffs_fstat_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_fstat_EBADF_h__
+#define __test_yaffs_fstat_EBADF_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_fstat_EBADF(void);
+int test_yaffs_fstat_EBADF_clean(void);
+#endif
}
int test_yaffs_ftruncate_EINVAL_clean(void){
+ if (handle<0){
+ return yaffs_close(handle);
+ }
return 1;
}
--- /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_stat_ENOENT.h"
+
+int test_yaffs_stat_ENOENT(void){
+ int error_code=0;
+ struct yaffs_stat stat;
+ int output=0;
+ char text[100];
+ text[0] ='\0';
+ output=yaffs_stat("/yaffs2/non-existing_file", &stat);;
+ if (output<0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==ENOENT){
+ return 1;
+ }
+ else {
+ printf("returned error does not match the the expected error\n");
+ return -1;
+ }
+ }
+ else{
+ printf("stated a non-existing file (which is a bad thing)\n");
+ return -1;
+ }
+}
+
+int test_yaffs_stat_ENOENT_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_stat_ENOENT_h__
+#define __test_yaffs_stat_ENOENT_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+
+int test_yaffs_stat_ENOENT(void);
+int test_yaffs_stat_ENOENT_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_stat_ENOTDIR.h"
+
+int test_yaffs_stat_ENOTDIR(void){
+ int error_code=0;
+ struct yaffs_stat stat;
+ int output=0;
+ char text[100];
+ text[0] ='\0';
+ output=yaffs_stat("/non-existing-dir/foo", &stat);;
+ if (output<0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==ENOTDIR){
+ return 1;
+ }
+ else {
+ printf("returned error does not match the the expected error\n");
+ return -1;
+ }
+ }
+ else{
+ printf("stated a non-existing file (which is a bad thing)\n");
+ return -1;
+ }
+}
+
+int test_yaffs_stat_ENOTDIR_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_stat_ENOTDIR_h__
+#define __test_yaffs_stat_ENOTDIR_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+
+int test_yaffs_stat_ENOTDIR(void);
+int test_yaffs_stat_ENOTDIR_clean(void);
+#endif
handle=test_yaffs_open();
int x=0;
- long int file_name_length=100000000000;
-
+ int file_name_length=20000;
+ if (handle<0){
+ printf("failed to open file\n");
+ return -1;
+ }
+ output=yaffs_lseek(handle,0x7FFFFF00, SEEK_SET);
+ if (output<0){
+ printf("failed to seek\n");
+ return -1;
+ }
file_name = malloc(file_name_length);
if(!file_name){
printf("unable to create file text\n");