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 \
- test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o
+ test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o \
+ test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o \
+ test_yaffs_symlink.o
test_yaffs_read_EBADF
test_yaffs_read_EINVAL
+ test_yaffs_mkdir
+ test_yaffs_mkdir_EEXISTS
+ test_yaffs_mkdir_ENOTDIR
test_yaffs_stat
test_yaffs_stat_ENOENT
test_yaffs_readlink_ELOOP
test_yaffs_readlink_ENAMETOOLONG
- test_yaffs_mkdir
+
test_yaffs_mkdir_EACCES
- test_yaffs_mkdir_EEXISTS
test_yaffs_mkdir_ELOOP
test_yaffs_mkdir_ENAMETOOLONG
- test_yaffs_mkdir_ENOENT
- test_yaffs_mkdir_ENOTDIR
test_yaffs_mkdir_EROFS
test_yaffs_symlink
Bug when trying to chmod a file in a non-existing directory. The error
returned is ENOENT, it should be ENOTDIR
+ Bug when trying to mkdir on top of a non-existing directory. The error
+ returned is ENOENT, it should be ENOTDIR. yaffs_mkdir should never return ENOENT.
Bug with truncating to a very large size. The yaffs_truncate function truncates the file to a massive size without any errors.
#define FILE_TEXT "file foo " /* keep space at end of string */
#define FILE_TEXT_NBYTES 10
+#define DIR_PATH "/yaffs2/new_directory/"
+
+#define SYMLINK_PATH "/yaffs2/sym_foo"
+
/* warning do not define anything as FILE because there seems to be a conflict with stdio.h */
#define FILE_PATH "/yaffs2/foo"
#include "test_yaffs_fdatasync_EBADF.h"
#include "test_yaffs_mkdir.h"
+#include "test_yaffs_mkdir_EEXIST.h"
+#include "test_yaffs_mkdir_ENOTDIR.h"
+
+#include "test_yaffs_symlink.h"
#include "yaffsfs.h"
#include "yaffs_error_converter.h"
{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"}
+ {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"},
+ {test_yaffs_mkdir_EEXIST,test_yaffs_mkdir_EEXIST_clean,"test_yaffs_mkdir_EEXIST"},
+ {test_yaffs_mkdir_ENOTDIR,test_yaffs_mkdir_ENOTDIR_clean,"test_yaffs_mkdir_ENOTDIR"},
+
+ {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"}
#include "test_yaffs_mkdir.h"
-static int handle = 0;
+static int output = -1;
int test_yaffs_mkdir(void)
{
- handle = yaffs_mkdir("/yaffs2/new_directory/",O_CREAT | O_RDWR);
- return handle;
+ output = yaffs_mkdir("/yaffs2/new_directory/",O_CREAT | O_RDWR);
+ return output;
}
int test_yaffs_mkdir_clean(void)
{
- if (handle >= 0){
+ if (output >= 0){
return yaffs_rmdir("/yaffs2/new_directory/");
} else {
return 1; /* the file failed to open so there is no need to close it */
* published by the Free Software Foundation.
*/
-#include "test_yaffs_mkdir_EEXISTS.h"
+#include "test_yaffs_mkdir_EEXIST.h"
static int output = -1;
-int test_yaffs_mkdir_EEXISTS(void)
+int test_yaffs_mkdir_EEXIST(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;
+ int error_code = 0;
+
+ if (0==yaffs_access(DIR_PATH,0)){
+ /* if the file exists then the file does not need to be created the first time*/
+
+ } else {
+
+ output = yaffs_mkdir(DIR_PATH,O_CREAT | O_RDWR);
+ if (output <0) {
+ print_message("failed 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){
+ if (abs(error_code) == EEXIST){
return 1;
} else {
print_message("different error than expected\n", 2);
}
-int test_yaffs_mkdir_EEXISTS_clean(void)
+int test_yaffs_mkdir_EEXIST_clean(void)
{
if (output >= 0){
- return yaffs_rmdir("/yaffs2/new_directory/");
+ return yaffs_rmdir(DIR_PATH);
} else {
return 1;
}
* 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__
+#ifndef __test_yaffs_mkdir_EEXIST_h__
+#define __test_yaffs_mkdir_EEXIST_h__
#include "lib.h"
#include "yaffsfs.h"
-int test_yaffs_mkdir_EEXISTS(void);
-int test_yaffs_mkdir_EEXISTS_clean(void);
+int test_yaffs_mkdir_EEXIST(void);
+int test_yaffs_mkdir_EEXIST_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_ENOTDIR.h"
+
+static int output = -1;
+
+int test_yaffs_mkdir_ENOTDIR(void)
+{
+ int error_code = 0;
+
+
+ output = yaffs_mkdir("/non_existing_directory/new_directory/",O_CREAT | O_RDWR);
+ if (output < 0){
+ error_code = yaffs_get_error();
+ if (abs(error_code) == ENOTDIR){
+ return 1;
+ } else {
+ print_message("different error than expected\n", 2);
+ return -1;
+ }
+ } else {
+ print_message("created a new directory on top of an non-existing directory (which is a bad thing)\n", 2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_mkdir_ENOTDIR_clean(void)
+{
+ if (output >= 0){
+ return yaffs_rmdir(DIR_PATH);
+ } 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_ENOTDIR_h__
+#define __test_yaffs_mkdir_ENOTDIR_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_mkdir_ENOTDIR(void);
+int test_yaffs_mkdir_ENOTDIR_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_symlink.h"
+
+static int output = 0;
+
+int test_yaffs_symlink(void)
+{
+ output = yaffs_symlink(FILE_PATH,SYMLINK_PATH);
+ return output;
+}
+
+
+int test_yaffs_symlink_clean(void)
+{
+ if (output >= 0){
+ return yaffs_unlink(SYMLINK_PATH);
+ } 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_symlink_h__
+#define __test_yaffs_symlink_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_symlink(void);
+int test_yaffs_symlink_clean(void);
+
+#endif