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_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_fstat.o test_yaffs_fstat_EBADF.o \
test_yaffs_close_EBADF.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.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o
test_yaffs_lseek_EBADF.c
test_yaffs_lseek_EINVAL.c
+test_yaffs_lstat
+test_yaffs_lstat_ENOENT
+test_yaffs_lstat_ENOTDIR
+
test_yaffs_mkdir.c
test_yaffs_mkdir_EEXIST.c
test_yaffs_mkdir_ENOENT.c
test_yaffs_chmod_ELOOP
test_yaffs_chmod_ENAMETOOLONG
- test_yaffs_lstat
+
test_yaffs_lstat_EACCES
- test_yaffs_lstat_ENOTDIR
test_yaffs_lstat_ENAMETOOLONG
- test_yaffs_lstat_ENOENT
test_yaffs_lstat_ELOOP
test_yaffs_readlink
return EXIT_ON_ERROR;
}
+
+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);
+ }
+ return (output1|output2);
+}
+
void join_paths(char *path1,char *path2,char *new_path )
{
#define RENAME_DIR_PATH "/yaffs2/dir2"
-
+#define ELOOP "/yaffs2/ELOOP"
+#define ELOOP2 "/yaffs2/ELOOP2"
/* warning do not define anything as FILE because there seems to be a conflict with stdio.h */
#define FILE_PATH "/yaffs2/foo"
void set_print_level(int new_level);
void set_exit_on_error(int num);
int get_exit_on_error(void);
+int set_up_ELOOP(void);
#endif
#include "test_yaffs_access_ENOTDIR.h"
#include "test_yaffs_access_ENOENT.h"
#include "test_yaffs_access_ENOENT2.h"
+#include "test_yaffs_access_ELOOP.h"
#include "test_yaffs_stat.h"
#include "test_yaffs_stat_ENOENT.h"
#include "test_yaffs_rename_EEXISTS.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"
{test_yaffs_access_ENOTDIR,test_yaffs_access_ENOTDIR_clean,"test_yaffs_access_ENOTDIR"},
{test_yaffs_access_ENOENT,test_yaffs_access_ENOENT_clean,"test_yaffs_access_ENOENT"},
{test_yaffs_access_ENOENT2,test_yaffs_access_ENOENT2_clean,"test_yaffs_access_ENOENT2"},
+ {test_yaffs_access_ELOOP,test_yaffs_access_ELOOP_clean,"test_yaffs_access_ELOOP"},
{test_yaffs_unlink, test_yaffs_unlink_clean,"test_yaffs_unlink"},
{test_yaffs_unlink_EISDIR,test_yaffs_unlink_EISDIR_clean,"test_yaffs_unlink_EISDIR"},
{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_lstat,test_yaffs_lstat_clean,"test_yaffs_lstat"}
+
+ {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[]);
--- /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_access_ELOOP.h"
+
+int test_yaffs_access_ELOOP(void)
+{
+ int output=0;
+ int error=0;
+ if (set_up_ELOOP()<0){
+ print_message("failed to setup symlinks\n",2);
+ return -1;
+ }
+ output= yaffs_access(ELOOP,0);
+ if (output<0){
+ error=yaffs_get_error();
+ if ( abs(error)== ELOOP){
+ return 1;
+ } else {
+ print_message("error does not match expected error\n",2);
+ return -1;
+ }
+ } else{
+ print_message("accessed an existing file with bad mode (which is a bad thing\n",2);
+
+ return -1;
+ }
+}
+
+int test_yaffs_access_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__access_ELOOP_h__
+#define __test_yaffs_access_ELOOP_h__
+#include "lib.h"
+#include "yaffsfs.h"
+int test_yaffs_access_ELOOP(void);
+int test_yaffs_access_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_lstat_ENOENT.h"
+
+
+int test_yaffs_lstat_ENOENT(void)
+{
+ int output = -1;
+ int error_code = -1;
+ struct yaffs_stat stat;
+ if (0 != yaffs_access(FILE_PATH,0)){
+ output=test_yaffs_open();
+ if (output>=0){
+ output = yaffs_close(output);
+ if (output<0){
+ print_message("failed to close file\n",2);
+ return -1;
+ }
+ } else {
+ print_message("failed to open file\n",2);
+ return -1;
+ }
+ }
+ if (0 != yaffs_access(SYMLINK_PATH,0)){
+ output=yaffs_symlink(FILE_PATH,SYMLINK_PATH);
+ if (output<0){
+ print_message("failed to open file\n",2);
+ return -1;
+ }
+ }
+
+ output =yaffs_lstat("yaffs2/non-existing-dir/",&stat);
+ if (output<0){
+ error_code=yaffs_get_error();
+ if (abs(error_code)==ENOENT){
+ return 1;
+ } else {
+ print_message("different error than expected\n", 2);
+ return -1;
+ }
+ } else {
+ print_message("lstatted a non-existing file\n", 2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_lstat_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_lstat_ENOENT_h__
+#define __test_yaffs_lstat_ENOENT_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_lstat_ENOENT(void);
+int test_yaffs_lstat_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_lstat_ENOTDIR.h"
+
+
+int test_yaffs_lstat_ENOTDIR(void)
+{
+ int output = -1;
+ int error_code = -1;
+ struct yaffs_stat stat;
+ if (0 != yaffs_access(FILE_PATH,0)){
+ output=test_yaffs_open();
+ if (output>=0){
+ output = yaffs_close(output);
+ if (output<0){
+ print_message("failed to close file\n",2);
+ return -1;
+ }
+ } else {
+ print_message("failed to open file\n",2);
+ return -1;
+ }
+ }
+ if (0 != yaffs_access(SYMLINK_PATH,0)){
+ output=yaffs_symlink(FILE_PATH,SYMLINK_PATH);
+ if (output<0){
+ print_message("failed to open file\n",2);
+ return -1;
+ }
+ }
+
+ output =yaffs_lstat("yaffs2/foo/dir",&stat);
+ 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("lstatted a non-existing file\n", 2);
+ return -1;
+ }
+}
+
+
+int test_yaffs_lstat_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_lstat_ENOTDIR_h__
+#define __test_yaffs_lstat_ENOTDIR_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+#include "test_yaffs_open.h"
+
+int test_yaffs_lstat_ENOTDIR(void);
+int test_yaffs_lstat_ENOTDIR_clean(void);
+
+#endif