test_yaffs_mount.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.o test_yaffs_mount_EBUSY.o \
test_yaffs_unmount.o test_yaffs_unmount_ENODEV.o test_yaffs_unmount_ENAMETOOLONG.o test_yaffs_unmount_EBUSY.o \
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_open_ENAMETOOLONG.o test_yaffs_open_EINVAL.o test_yaffs_open_EINVAL2.o test_yaffs_open_ELOOP.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_unlink_ENOENT2.o \
test_yaffs_ftruncate.o test_yaffs_ftruncate_EBADF.o test_yaffs_ftruncate_EINVAL.o test_yaffs_ftruncate_big_file.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_big_file.o test_yaffs_truncate_ENOENT2.o\
+ test_yaffs_truncate_EINVAL.o test_yaffs_truncate_big_file.o test_yaffs_truncate_ENOENT2.o test_yaffs_truncate_ELOOP.o \
test_yaffs_write.o test_yaffs_write_EBADF.o test_yaffs_write_big_file.o \
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_big_file.o \
test_yaffs_access.o test_yaffs_access_EINVAL.o test_yaffs_access_ENOTDIR.o test_yaffs_access_ENOENT.o \
test_yaffs_access_ENOENT2.o test_yaffs_access_ELOOP.o \
- test_yaffs_stat.o test_yaffs_stat_ENOENT.o test_yaffs_stat_ENOTDIR.o test_yaffs_stat_ENOENT2.o \
+ test_yaffs_stat.o test_yaffs_stat_ENOENT.o test_yaffs_stat_ENOTDIR.o test_yaffs_stat_ENOENT2.o test_yaffs_stat_ELOOP.o \
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_chmod_ENOENT2.o \
+ test_yaffs_chmod_ENOENT2.o test_yaffs_chmod_ELOOP.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 test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o test_yaffs_mkdir_ENOENT.o\
+ test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o test_yaffs_mkdir_ENOENT.o \
test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o \
test_yaffs_symlink.o test_yaffs_symlink_ENOTDIR.o test_yaffs_symlink_EEXIST.o test_yaffs_symlink_ENOENT.o \
test_yaffs_symlink_ENOENT2.o \
test_yaffs_inodecount.o test_yaffs_inodecount_EINVAL.o \
test_yaffs_link.o test_yaffs_link_ENOENT.o test_yaffs_link_EEXIST.o test_yaffs_link_ENOTDIR.o \
test_yaffs_link_ENOTDIR2.o test_yaffs_link_ENOENT2.o test_yaffs_link_ENOENT3.o test_yaffs_link_ENOENT3.o \
+ test_yaffs_link_ENOENT4.o \
test_yaffs_rmdir.o test_yaffs_rmdir_EBUSY.o test_yaffs_rmdir_EINVAL.o test_yaffs_rmdir_ENOENT.o \
test_yaffs_rmdir_ENOTDIR.o \
test_yaffs_rename.o test_yaffs_rename_ENOENT.o test_yaffs_rename_ENOTDIR.o test_yaffs_rename_EINVAL.o \
test_yaffs_rename_dir.o test_yaffs_rename_dir_ENOENT.o test_yaffs_rename_dir_ENOENT2.o test_yaffs_rename_dir_to_file.o \
- test_yaffs_rename_file_to_dir.o test_yaffs_rename_EEXISTS.o \
- test_yaffs_lstat.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o
+ test_yaffs_rename_file_to_dir.o test_yaffs_rename_EEXISTS.o test_yaffs_rename_ELOOP.o\
+ test_yaffs_lstat.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o
test_yaffs_rmdir_EACCES
test_yaffs_rmdir_ENOTEMPTY
test_yaffs_rmdir_EROFS
+ test_yaffs_emdir_ELOOP
What happens when a mount point is mounted using mount2 with read only mode set and then a file is chmoded?
+ Try to remove lost and found dir and replace it with a file of the same name.
+
+ Change the mode of the lost and found dir to read only.
Tests which do not exist in yaffs:
test_yaffs_link_EMLINK //should not happen on yaffs
+ test_yaffs_link_ELOOP
+ test_yaffs_lstat_ELOOP
+
+ test_yaffs_mkdir_ELOOP
+
//the yaffs_mknod function does not exist in yaffsfs, so these tests will not be added.
test_yaffs_mknod
test_yaffs_mknod_EACCES
test_yaffs_mknod_ENOTDIR
test_yaffs_mknod_EROFS
+ teat_yaffs_mount_ELOOP
+
test_yaffs_mount2_EINVAL //cannot happen in yaffs since the mode is not checked.
test_yaffs_mount2_ENOTDIR //cannot be generated in yaffs.
test_yaffs_mount2_ENOENT //cannot be generated in yaffs.
+ test_yaffs_mount2_ELOOP
test_yaffs_remount_ENOENT //cannot be generated in yaffs
test_yaffs_remount_ENOTDIR //cannot be generated in yaffs
int set_up_ELOOP(void){
int output1=1;
int output2=1;
- if (0!=yaffs_access(ELOOP2)){
- output1=yaffs_symlink(ELOOP,ELOOP2);
- }
- if (0!=yaffs_access(ELOOP)){
- output2=yaffs_symlink(ELOOP2,ELOOP);
+ int error =0;
+
+ output1=yaffs_symlink(ELOOP_PATH,ELOOP2_PATH);
+ if (output1 <0){
+ error=yaffs_get_error();
+ if (abs(error)==EEXIST){
+ output1= 1;
+ } else {
+ output1=-1;
+ }
+ }
+
+ output2=yaffs_symlink(ELOOP2_PATH,ELOOP_PATH);
+
+ if (output2 <0){
+ error=yaffs_get_error();
+ if (abs(error)==EEXIST){
+ output2= 1;
+ } else {
+ output2=-1;
+ }
}
+
+
+ yaffs_set_error(0); /*reset the last error to 0 */
return (output1|output2);
}
#include <stdio.h>
#include <string.h>
+#include "yaffsfs.h"
+#define ELOOP 10 //the error code ELOOP is not defined yet so I'm making a stand in.
+
#define YAFFS_MOUNT_POINT "/yaffs2/"
#define FILE_NAME "foo"
#define RENAME_DIR_PATH "/yaffs2/dir2"
-#define ELOOP "/yaffs2/ELOOP"
-#define ELOOP2 "/yaffs2/ELOOP2"
+#define ELOOP_PATH "/yaffs2/ELOOP"
+#define ELOOP2_PATH "/yaffs2/ELOOP2"
/* 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_open_ENAMETOOLONG.h"
#include "test_yaffs_open_EINVAL.h"
#include "test_yaffs_open_EINVAL2.h"
+#include "test_yaffs_open_ELOOP.h"
#include "test_yaffs_close_EBADF.h"
#include "test_yaffs_truncate_EINVAL.h"
#include "test_yaffs_truncate_big_file.h"
#include "test_yaffs_truncate_ENOENT2.h"
+#include "test_yaffs_truncate_ELOOP.h"
#include "test_yaffs_write.h"
#include "test_yaffs_write_EBADF.h"
#include "test_yaffs_stat_ENOENT.h"
#include "test_yaffs_stat_ENOTDIR.h"
#include "test_yaffs_stat_ENOENT2.h"
+#include "test_yaffs_stat_ELOOP.h"
#include "test_yaffs_fstat.h"
#include "test_yaffs_fstat_EBADF.h"
#include "test_yaffs_chmod_ENOTDIR.h"
#include "test_yaffs_chmod_EINVAL.h"
#include "test_yaffs_chmod_ENOENT2.h"
-
+#include "test_yaffs_chmod_ELOOP.h"
#include "test_yaffs_fchmod.h"
#include "test_yaffs_fchmod_EBADF.h"
#include "test_yaffs_mkdir_ENOTDIR.h"
#include "test_yaffs_mkdir_ENOENT.h"
+
#include "test_yaffs_symlink.h"
#include "test_yaffs_symlink_ENOTDIR.h"
#include "test_yaffs_symlink_EEXIST.h"
#include "test_yaffs_link_ENOTDIR2.h"
#include "test_yaffs_link_ENOENT2.h"
#include "test_yaffs_link_ENOENT3.h"
+#include "test_yaffs_link_ENOENT4.h"
+
#include "test_yaffs_rmdir.h"
#include "test_yaffs_rmdir_EBUSY.h"
#include "test_yaffs_rename_dir_to_file.h"
#include "test_yaffs_rename_file_to_dir.h"
#include "test_yaffs_rename_EEXISTS.h"
+#include "test_yaffs_rename_ELOOP.h"
#include "test_yaffs_lstat.h"
#include "test_yaffs_lstat_ENOENT.h"
#include "test_yaffs_lstat_ENOTDIR.h"
-
#include "yaffsfs.h"
#include "yaffs_error_converter.h"
#include "lib.h"
{test_yaffs_open_ENAMETOOLONG,test_yaffs_open_ENAMETOOLONG_clean,"test_yaffs_open_ENAMETOOLONG"},
{test_yaffs_open_EINVAL,test_yaffs_open_EINVAL_clean,"test_yaffs_open_EINVAL"},
{test_yaffs_open_EINVAL2,test_yaffs_open_EINVAL2_clean,"test_yaffs_open_EINVAL2"},
+ {test_yaffs_open_ELOOP,test_yaffs_open_ELOOP_clean,"test_yaffs_open_ELOOP"},
{test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
{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_stat_ENOENT2,test_yaffs_stat_ENOENT2_clean,"test_yaffs_stat_ENOENT2"},
+ {test_yaffs_stat_ELOOP,test_yaffs_stat_ELOOP_clean,"test_yaffs_stat_ELOOP"},
{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_truncate_EINVAL,test_yaffs_truncate_EINVAL_clean,"test_yaffs_truncate_EINVAL"},
{test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"},
{test_yaffs_truncate_ENOENT2,test_yaffs_truncate_ENOENT2_clean,"test_yaffs_truncate_ENOENT2"},
+ {test_yaffs_truncate_ELOOP,test_yaffs_truncate_ELOOP_clean,"test_yaffs_truncate_ELOOP"},
// {test_yaffs_truncate_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled.
{test_yaffs_chmod,test_yaffs_chmod_clean,"test_yaffs_chmod"},
{test_yaffs_chmod_ENOENT,test_yaffs_chmod_ENOENT_clean,"test_yaffs_chmod_ENOENT"},
{test_yaffs_chmod_ENOTDIR,test_yaffs_chmod_ENOTDIR_clean,"test_yaffs_chmod_ENOTDIR"},
{test_yaffs_chmod_EINVAL,test_yaffs_chmod_EINVAL_clean,"test_yaffs_chmod_EINVAL"},
-
+ {test_yaffs_chmod_ELOOP,test_yaffs_chmod_ELOOP_clean,"test_yaffs_chmod_ELOOP"},
{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_EINVAL,test_yaffs_fchmod_EINVAL_clean,"test_yaffs_fchmod_EINVAL"},
{test_yaffs_link_ENOTDIR2,test_yaffs_link_ENOTDIR2_clean,"test_yaffs_link_ENOTDIR2"},
{test_yaffs_link_ENOENT2,test_yaffs_link_ENOENT2_clean,"test_yaffs_link_ENOENT2"},
{test_yaffs_link_ENOENT3,test_yaffs_link_ENOENT3_clean,"test_yaffs_link_ENOENT3"},
+ {test_yaffs_link_ENOENT4,test_yaffs_link_ENOENT4_clean,"test_yaffs_link_ENOENT4"},
{test_yaffs_rmdir,test_yaffs_rmdir_clean,"test_yaffs_rmdir"},
{test_yaffs_rmdir_EBUSY,test_yaffs_rmdir_EBUSY_clean,"test_yaffs_rmdir_EBUSY"},
{test_yaffs_rename_dir_to_file,test_yaffs_rename_dir_to_file_clean,"test_yaffs_rename_dir_to_file"},
{test_yaffs_rename_file_to_dir,test_yaffs_rename_file_to_dir_clean,"test_yaffs_rename_file_to_dir"},
{test_yaffs_rename_EEXISTS,test_yaffs_rename_EEXISTS_clean,"test_yaffs_rename_EEXISTS"},
+ {test_yaffs_rename_ELOOP,test_yaffs_rename_ELOOP_clean,"test_yaffs_rename_ELOOP"},
{test_yaffs_lstat,test_yaffs_lstat_clean,"test_yaffs_lstat"},
{test_yaffs_lstat_ENOENT,test_yaffs_lstat_ENOENT_clean,"test_yaffs_lstat_ENOENT"},
{test_yaffs_lstat_ENOTDIR,test_yaffs_lstat_ENOTDIR_clean,"test_yaffs_lstat_ENOTDIR"}
+
};
void init_quick_tests(int argc, char *argv[]);
print_message("failed to setup symlinks\n",2);
return -1;
}
- output= yaffs_access(ELOOP,0);
+ output= yaffs_access(ELOOP_PATH,0);
if (output<0){
error=yaffs_get_error();
if ( abs(error)== ELOOP){
--- /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_chmod_ELOOP.h"
+
+int test_yaffs_chmod_ELOOP(void)
+{
+ int error=0;
+ int output;
+
+ if (set_up_ELOOP()<0){
+ print_message("failed to setup symlinks\n",2);
+ return -1;
+ }
+
+ output = yaffs_chmod(ELOOP_PATH,S_IREAD|S_IWRITE);
+
+ if (output<0){
+ error=yaffs_get_error();
+ if (abs(error)==ELOOP){
+ return 1;
+ } else {
+ print_message("different error than expected\n",2);
+ return -1;
+ }
+ } else {
+ print_message("chmoded the ELOOP (which is a bad thing)\n",2);
+ return -1;
+ }
+
+}
+
+int test_yaffs_chmod_ELOOP_clean(void)
+{
+ return test_yaffs_chmod();
+}
--- /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_chmod_ELOOP_h__
+#define __test_yaffs_chmod_ELOOP_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_chmod.h"
+
+int test_yaffs_chmod_ELOOP(void);
+int test_yaffs_chmod_ELOOP_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_link_ENOENT4.h"
+
+
+
+int test_yaffs_link_ENOENT4(void)
+{
+ int output=0;
+ int error =0;
+ output = yaffs_link(DIR_PATH,HARD_LINK_PATH);
+ if (output<0){
+ error=yaffs_get_error();
+ if (abs(error)==ENOENT){
+ return 1;
+ } else {
+ print_message("different error than expected\n",2);
+ return -1;
+ }
+ } else {
+ print_message("created a hard link to a dir (which is a bad thing)\n",2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_link_ENOENT4_clean(void)
+{
+ int output=0;
+ int error =0;
+ output= yaffs_unlink(HARD_LINK_PATH);
+ if (output<0){
+ error=yaffs_get_error();
+ if (abs(error)==ENOENT){
+ //if the file does not exist then the error should be ENOENT.
+ return 1;
+ } else {
+ print_message("different error than expected\n",2);
+ return -1;
+ }
+ } 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_link_ENOENT4_h__
+#define __test_yaffs_link_ENOENT4_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_link_ENOENT4(void);
+int test_yaffs_link_ENOENT4_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_open_ELOOP.h"
+
+static int handle = -1;
+
+int test_yaffs_open_ELOOP(void)
+{
+ int error_code=0;
+
+ if (set_up_ELOOP()<0){
+ print_message("failed to setup symlinks\n",2);
+ return -1;
+ }
+ handle=yaffs_open(ELOOP_PATH, O_TRUNC| O_RDWR,FILE_MODE );
+ if (handle <0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==ELOOP){
+ return 1;
+ }
+ else {
+ print_message("different error than expected\n",2);
+ return -1;
+ }
+ }
+ else {
+ print_message("non existing directory opened.(which is a bad thing)\n",2);
+ return -1;
+ }
+}
+
+int test_yaffs_open_ELOOP_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_open_ELOOP_h__
+#define __test_yaffs_open_ELOOP_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_open_ELOOP(void);
+int test_yaffs_open_ELOOP_clean(void);
+
+#endif
output = yaffs_rename(DIR_PATH , RENAME_DIR_PATH);
if (output<0){
error_code=yaffs_get_error();
- if (abs(error_code)==EEXIST){
+ if (abs(error_code)==ENOTEMPTY){
return 1;
} else {
print_message("returned error does not match the the expected error\n",2);
--- /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_rename_ELOOP.h"
+
+
+int test_yaffs_rename_ELOOP(void)
+{
+ int output=0;
+ int error_code =0;
+
+
+ if (set_up_ELOOP()<0){
+ print_message("failed to setup symlinks\n",2);
+ return -1;
+ }
+
+
+ output = yaffs_rename(ELOOP_PATH , RENAME_PATH);
+ if (output<0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==ELOOP){
+ return 1;
+ } else {
+ print_message("returned error does not match the the expected error\n",2);
+ return -1;
+ }
+ } else{
+ print_message("renamed a ELOOP (which is a bad thing)\n",2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_rename_ELOOP_clean(void)
+{
+ int output = 0;
+ if (0 == yaffs_access(RENAME_PATH,0)) {
+ output = yaffs_rename(RENAME_PATH,FILE_PATH);
+ if (output < 0) {
+ print_message("failed to remove the directory\n",2);
+ return -1;
+ }
+ }
+ 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_rename_ELOOP_h__
+#define __test_yaffs_rename_ELOOP_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_rename_ELOOP(void);
+int test_yaffs_rename_ELOOP_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_ELOOP.h"
+
+int test_yaffs_stat_ELOOP(void)
+{
+ int error_code=0;
+ struct yaffs_stat stat;
+ int output=0;
+ char text[100];
+ text[0] ='\0';
+
+ if (set_up_ELOOP()<0){
+ print_message("failed to setup symlinks\n",2);
+ return -1;
+ }
+ output=yaffs_stat(ELOOP_PATH, &stat);;
+ if (output<0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==ENOTDIR){
+ return 1;
+ } else {
+ print_message("returned error does not match the the expected error\n",2);
+ return -1;
+ }
+ } else {
+ print_message("stated a ELOOP (which is a bad thing)\n",2);
+ return -1;
+ }
+}
+
+int test_yaffs_stat_ELOOP_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_ELOOP_h__
+#define __test_yaffs_stat_ELOOP_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_stat_ELOOP(void);
+int test_yaffs_stat_ELOOP_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_truncate_ELOOP.h"
+
+
+
+int test_yaffs_truncate_ELOOP(void)
+{
+ int error=0;
+ int output=0;
+
+ if (set_up_ELOOP()<0){
+ print_message("failed to setup symlinks\n",2);
+ return -1;
+ }
+
+ output= yaffs_truncate(ELOOP_PATH,FILE_SIZE_TRUNCATED );
+ if (output<0){
+ error=yaffs_get_error();
+ if (abs(error)==ELOOP){
+ return 1;
+ } else {
+ print_message("received a different error than expected\n",2);
+ return -1;
+ }
+ } else{
+ print_message("truncated a nonexisting file\n",2);
+ return -1;
+ }
+}
+
+int test_yaffs_truncate_ELOOP_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_truncate_ELOOP_h__
+#define __test_yaffs_truncate_ELOOP_h__
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+int test_yaffs_truncate_ELOOP(void);
+int test_yaffs_truncate_ELOOP_clean(void);
+#endif