test_yaffs_fstat.o test_yaffs_fstat_EBADF.o \
test_yaffs_close_EBADF.o\
test_yaffs_chmod.o test_yaffs_chmod_ENOENT.o test_yaffs_chmod_ENOTDIR.o test_yaffs_chmod_EINVAL.o \
- test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o
+ test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o\
+ test_yaffs_fsync.o test_yaffs_fsync_EBADF.o \
+ test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.o \
+ test_yaffs_mkdir.o
YAFFSTESTOBJS = $(COMMONTESTOBJS) $(TESTFILES)
test_yaffs_close_EBADF
+ test_yaffs_fdatasync
+ test_yaffs_fdatasync_EBADF
+
+ test_yaffs_fsync
+ test_yaffs_fsync_EBADF
+
test_yaffs_ftruncate
test_yaffs_ftruncate_EBADF
test_yaffs_ftruncate_ENIVAL
test_yaffs_chmod_ELOOP
test_yaffs_chmod_ENAMETOOLONG
- test_yaffs_fsync
- test_yaffs_fsync_EBADF
-
- test_yaffs_datasync
- test_yaffs_datasync_EBADF
-
test_yaffs_lstat
test_yaffs_lstat_EACCES
test_yaffs_lstat_ENOTDIR
#include "test_yaffs_fchmod.h"
#include "test_yaffs_fchmod_EBADF.h"
+#include "test_yaffs_fsync.h"
+#include "test_yaffs_fsync_EBADF.h"
+
+#include "test_yaffs_fdatasync.h"
+#include "test_yaffs_fdatasync_EBADF.h"
+
+#include "test_yaffs_mkdir.h"
+
#include "yaffsfs.h"
#include "yaffs_error_converter.h"
#include "lib.h"
{test_yaffs_chmod_EINVAL,test_yaffs_chmod_EINVAL_clean,"test_yaffs_chmod_EINVAL"},
{test_yaffs_fchmod,test_yaffs_fchmod_clean,"test_yaffs_fchmod"},
- {test_yaffs_fchmod_EBADF,test_yaffs_fchmod_EBADF_clean,"test_yaffs_fchmod_EBADF"}
+ {test_yaffs_fchmod_EBADF,test_yaffs_fchmod_EBADF_clean,"test_yaffs_fchmod_EBADF"},
+
+ {test_yaffs_fsync,test_yaffs_fsync_clean,"test_yaffs_fsync"},
+ {test_yaffs_fsync_EBADF,test_yaffs_fsync_EBADF_clean,"test_yaffs_fsync_EBADF"},
+
+ {test_yaffs_fdatasync,test_yaffs_fdatasync_clean,"test_yaffs_fdatasync"},
+ {test_yaffs_fdatasync_EBADF,test_yaffs_fdatasync_EBADF_clean,"test_yaffs_fdatasync_EBADF"},
+
+ {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"}
};
void init_quick_tests(int argc, char *argv[]);
--- /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_fdatasync.h"
+
+static int handle = 0;
+
+int test_yaffs_fdatasync(void)
+{
+ handle = test_yaffs_open();
+ return yaffs_fdatasync(handle);
+}
+
+
+int test_yaffs_fdatasync_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_fdatasync_h__
+#define __test_yaffs_fdatasync_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_fdatasync(void);
+int test_yaffs_fdatasync_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_fdatasync.h"
+
+
+
+int test_yaffs_fdatasync_EBADF(void)
+{
+ int output = 0;
+ int error_code = 0;
+ output = yaffs_fdatasync(-1);
+ if (output==-1){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==EBADF){
+ return 1;
+ } else {
+ print_message("different error than expected\n",2);
+ return -1;
+ }
+ } else {
+ print_message("non existant file synced.(which is a bad thing)\n",2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_fdatasync_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_fdatasync_EBADF_h__
+#define __test_yaffs_fdatasync_EBADF_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_fdatasync_EBADF(void);
+int test_yaffs_fdatasync_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_fsync.h"
+
+static int handle = 0;
+
+int test_yaffs_fsync(void)
+{
+ handle = test_yaffs_open();
+ return yaffs_fsync(handle);
+}
+
+
+int test_yaffs_fsync_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_fsync_h__
+#define __test_yaffs_fsync_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_fsync(void);
+int test_yaffs_fsync_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_fsync.h"
+
+
+
+int test_yaffs_fsync_EBADF(void)
+{
+ int output = 0;
+ int error_code = 0;
+ output = yaffs_fsync(-1);
+ if (output==-1){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==EBADF){
+ return 1;
+ } else {
+ print_message("different error than expected\n",2);
+ return -1;
+ }
+ } else {
+ print_message("non existant file synced.(which is a bad thing)\n",2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_fsync_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_fsync_EBADF_h__
+#define __test_yaffs_fsync_EBADF_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_fsync_EBADF(void);
+int test_yaffs_fsync_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_mkdir.h"
+
+static int handle = 0;
+
+int test_yaffs_mkdir(void)
+{
+ handle = yaffs_mkdir("/yaffs2/new_directory/",O_CREAT | O_RDWR);
+ return handle;
+}
+
+
+int test_yaffs_mkdir_clean(void)
+{
+ if (handle >= 0){
+ return yaffs_rmdir("/yaffs2/new_directory/");
+ } 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_mkdir_h__
+#define __test_yaffs_mkdir_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_mkdir(void);
+int test_yaffs_mkdir_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_mkdir_EEXISTS.h"
+
+static int output = -1;
+
+int test_yaffs_mkdir_EEXISTS(void)
+{
+ output = yaffs_mkdir("/yaffs2/new_directory/",O_CREAT | O_RDWR);
+ if (output <0) {
+ print_message("filed to create the directory the first time\n",2);
+ return -1;
+ }
+ output = yaffs_mkdir("/yaffs2/new_directory/",O_CREAT | O_RDWR);
+ if (output < 0){
+ error_code = yaffs_get_error();
+ if (abs(error_code) == EEXISTS){
+ return 1;
+ } else {
+ print_message("different error than expected\n", 2);
+ return -1;
+ }
+ } else {
+ print_message("lseeked to a negative position (which is a bad thing)\n", 2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_mkdir_EEXISTS_clean(void)
+{
+ if (output >= 0){
+ return yaffs_rmdir("/yaffs2/new_directory/");
+ } else {
+ 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_mkdir_EEXISTS_h__
+#define __test_yaffs_mkdir_EEXISTS_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_mkdir_EEXISTS(void);
+int test_yaffs_mkdir_EEXISTS_clean(void);
+
+#endif