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_ftruncate.o test_yaffs_ftruncate_EBADF.o test_yaffs_ftruncate_EINVAL.o test_yaffs_ftruncate_EFBIG.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_access_ENOENT
test_yaffs_close_EBADF
+
test_yaffs_ftruncate
+ test_yaffs_ftruncate_EBADF
+ test_yaffs_ftruncate_ENIVAL
+
test_yaffs_lseek
test_yaffs_open
test_yaffs_unmount
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.
test_yaffs_ftruncate_EACCES
test_yaffs_ftruncate_EFBIG
- test_yaffs_ftruncate_ENIVAL
test_yaffs_ftruncate_EISDIR
test_yaffs_ftruncate_ELOOP
test_yaffs_ftruncate_ENOENT
output=test_list[x].p_function(); /*run test*/
if (output>=0){
/*test has passed*/
+ printf("\ttest %s passed\n",test_list[x].name_of_test);
num_of_tests_pass++;
}
else {
#include "test_yaffs_unlink_ENOENT.h"
#include "test_yaffs_ftruncate.h"
+#include "test_yaffs_ftruncate_EBADF.h"
+#include "test_yaffs_ftruncate_EINVAL.h"
+#include "test_yaffs_ftruncate_EFBIG.h"
#include "test_yaffs_truncate.h"
#include "test_yaffs_truncate_ENOTDIR.h"
{test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
+
{test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
+ {test_yaffs_ftruncate_EBADF,test_yaffs_ftruncate_EBADF_clean,"test_yaffs_ftruncate_EBADF"},
+ {test_yaffs_ftruncate_EINVAL,test_yaffs_ftruncate_EINVAL_clean,"test_yaffs_ftruncate_EINVAL"},
+ {test_yaffs_ftruncate_EFBIG,test_yaffs_ftruncate_EFBIG_clean,"test_yaffs_ftruncate_EFBIG"},
{test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"},
{test_yaffs_truncate_ENOTDIR,test_yaffs_truncate_ENOTDIR_clean,"test_yaffs_truncate_ENOTDIR"},
--- /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_ftruncate_EBADF.h"
+
+static int handle=0;
+int test_yaffs_ftruncate_EBADF(void){
+ int output=0;
+ int error_code=0;
+ output= yaffs_ftruncate(-1,FILE_SIZE_TRUNCATED );
+ 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_ftruncate_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_ftruncate_EBADF_h__
+#define __test_yaffs_ftruncate_EBADF_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_ftruncate_EBADF(void);
+int test_yaffs_ftruncate_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_ftruncate_EFBIG.h"
+
+static int handle=0;
+int test_yaffs_ftruncate_EFBIG(void){
+ int output=0;
+ int error_code=0;
+ handle=test_yaffs_open();
+ if (handle>=0){
+ output=yaffs_ftruncate(handle,10000000000000000000000000000000);
+ if (output<0){
+ error_code=yaffs_get_error();
+ //printf("EISDIR def %d, Error code %d\n", EISDIR,error_code);
+ if (abs(error_code)== EINVAL){ /* yaffs uses the error EINVAL instead of EFBIG */
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("file truncated to a very large size.(which is a bad thing)\n");
+ return -1;
+ }
+ }
+ else {
+ printf("error opening file\n");
+ return -1;
+ }
+
+
+
+}
+
+int test_yaffs_ftruncate_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_ftruncate_EFBIG_h__
+#define __test_yaffs_ftruncate_EFBIG_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_ftruncate_EFBIG(void);
+int test_yaffs_ftruncate_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_ftruncate_EINVAL.h"
+
+static int handle=0;
+int test_yaffs_ftruncate_EINVAL(void){
+ int output=0;
+ int error_code=0;
+ handle=test_yaffs_open();
+ if (handle>=0){
+ output=yaffs_ftruncate(handle,-1 );
+ if (output<0){
+ error_code=yaffs_get_error();
+ //printf("EISDIR def %d, Error code %d\n", EISDIR,error_code);
+ if (abs(error_code)== EINVAL){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("file truncated to a negative size.(which is a bad thing)\n");
+ return -1;
+ }
+ }
+ else {
+ printf("error opening file\n");
+ return -1;
+ }
+
+
+
+}
+
+int test_yaffs_ftruncate_EINVAL_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_ftruncate_EINVAL_h__
+#define __test_yaffs_ftruncate_EINVAL_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_ftruncate_EINVAL(void);
+int test_yaffs_ftruncate_EINVAL_clean(void);
+#endif
return yaffs_close(handle);
}
else {
- return -1; /* the file failed to open so there is no need to close it*/
+ return 1; /* the file failed to open so there is no need to close it*/
}
}
return -1;
}
}
- else if (output >=0){
+ else {
printf("non existant directory 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_open_EISDIR_clean(void){
if (handle >=0){
output= yaffs_truncate("/yaffs2/foo",10000000000000000000000000000000000000000000 );
if (output<0){
error=yaffs_get_error();
- if (abs(error)==EINVAL){
+ if (abs(error)==EINVAL){ /*in yaffs EINVAL is used instead of EFBIG */
return 1;
}
else {
}
int test_yaffs_truncate_EINVAL_clean(void){
- return -1;
+ return 1;
}