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_rename_file_to_dir.o test_yaffs_rename_EEXISTS.o \
+ test_yaffs_lstat.o
test_yaffs_symlink_ENAMETOOLONG
test_yaffs_symlink_EROFS
-
- //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_EEXIST
- test_yaffs_mknod_EINVAL
- test_yaffs_mknod_ELOOP
- test_yaffs_mknod_ENAMETOOLONG
- test_yaffs_mknod_ENOENT
- test_yaffs_mknod_ENOTDIR
- test_yaffs_mknod_EROFS
-
-
- 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_ENAMETOOLONG
test_yaffs_mount2_with read only set
-
-
- test_yaffs_unmount2_ENOENT //cannot be generated in yaffs.
- test_yaffs_unmount2_ENOTDIR //cannot be generated in yaffs.
test_yaffs_unmount2_ENAMETOOLONG
-
test_yaffs_remount_force_off_read_only_on
test_yaffs_remount_force_on_read_only_on
- test_yaffs_remount_ENOENT //cannot be generated in yaffs
- test_yaffs_remount_ENOTDIR //cannot be generated in yaffs
-
test_yaffs_freespace_ENAMETOOLONG
test_yaffs_totalspace_ENAMETOOLONG
test_yaffs_closedir
-
test_yaffs_link_EACCES
test_yaffs_link_ELOOP
- test_yaffs_link_EMLINK //should not happen on yaffs
+
test_yaffs_link_ENAMETOOLONG
test_yaffs_link_EPERM
test_yaffs_link_EROFS
test_yaffs_rmdir_EROFS
- what happens if a file is renamed into a dir.
- //need to do rename for directories.
- //what happens if the dir or file is renamed over an existing dir or file
+
test_yaffs_rename_EACCES
test_yaffs_rename_ELOOP
test_yaffs_rename_EMLINK
test_yaffs_rename_EEXISTS or EPERM
test_yaffs_rename_EROFS
-
test_yaffs_dup
test_yaffs_dup_EBADF
test_yaffs_stat_EACCES
test_yaffs_stat_ENAMETOOLONG
-
-
test_yaffs_read_big_file
test what happens if you read off the end of the file?
What happens when a mount point is mounted using mount2 with read only mode set and then a file is chmoded?
+
+Tests which do not exist in yaffs:
+
+ test_yaffs_link_EMLINK //should not happen on yaffs
+
+ //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_EEXIST
+ test_yaffs_mknod_EINVAL
+ test_yaffs_mknod_ELOOP
+ test_yaffs_mknod_ENAMETOOLONG
+ test_yaffs_mknod_ENOENT
+ test_yaffs_mknod_ENOTDIR
+ test_yaffs_mknod_EROFS
+
+ 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_remount_ENOENT //cannot be generated in yaffs
+ test_yaffs_remount_ENOTDIR //cannot be generated in yaffs
+
+ test_yaffs_unmount2_ENOENT //cannot be generated in yaffs.
+ test_yaffs_unmount2_ENOTDIR //cannot be generated in yaffs.
+
How to add a test
First create the test .c and .h file.
The file name and test function name should be the same.
#include "test_yaffs_rename_file_to_dir.h"
#include "test_yaffs_rename_EEXISTS.h"
+#include "test_yaffs_lstat.h"
+
#include "yaffsfs.h"
#include "yaffs_error_converter.h"
#include "lib.h"
{test_yaffs_rename_dir_ENOENT2,test_yaffs_rename_dir_ENOENT2_clean,"test_yaffs_rename_dir_ENOENT2"},
{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_EEXISTS,test_yaffs_rename_EEXISTS_clean,"test_yaffs_rename_EEXISTS"},
+ {test_yaffs_lstat,test_yaffs_lstat_clean,"test_yaffs_lstat"}
};
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_lstat.h"
+
+
+int test_yaffs_lstat(void)
+{
+ int output = -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(SYMLINK_PATH,&stat);
+ return output;
+}
+
+
+int test_yaffs_lstat_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_h__
+#define __test_yaffs_lstat_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_lstat(void);
+int test_yaffs_lstat_clean(void);
+
+#endif
int test_yaffs_symlink(void)
{
+ if (0 == yaffs_access(SYMLINK_PATH,0)){
+ output=yaffs_unlink(SYMLINK_PATH);
+ if (output<0){
+ print_message("failed to unlink symlink\n",2);
+ return -1;
+ }
+ }
output = yaffs_symlink(FILE_PATH,SYMLINK_PATH);
return output;
}