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_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o \
- test_yaffs_symlink.o
+ test_yaffs_symlink.o test_yaffs_symlink_ENOTDIR.o
test_yaffs_stat_ENOENT
test_yaffs_stat_ENOTDIR
+ test_yaffs_symlink
+
test_yaffs_fstat
test_yaffs_fstat_EBADF
test_yaffs_mkdir_ENAMETOOLONG
test_yaffs_mkdir_EROFS
- test_yaffs_symlink
+
test_yaffs_symlink_EACCES
test_yaffs_symlink_EEXISTS
test_yaffs_symlink_ELOOP
test_yaffs_symlink_ENAMETOOLONG
- test_yaffs_symlink_ENOENT
+ test_yaffs_symlink_ENOENT //if there is a slash on the end
test_yaffs_symlink_ENOTDIR
test_yaffs_symlink_EROFS
#include "test_yaffs_mkdir_ENOTDIR.h"
#include "test_yaffs_symlink.h"
+#include "test_yaffs_symlink_ENOTDIR.h"
+
#include "yaffsfs.h"
#include "yaffs_error_converter.h"
{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"}
+ {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"},
+ {test_yaffs_symlink_ENOTDIR,test_yaffs_symlink_ENOTDIR_clean,"test_yaffs_symlink_ENOTDIR"}
int test_yaffs_mkdir_EEXIST_clean(void)
{
- if (output >= 0){
- return yaffs_rmdir(DIR_PATH);
- } else {
- return 1;
- }
+ return yaffs_rmdir(DIR_PATH);
}
--- /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_ENOTDIR.h"
+
+static int output = 0;
+
+int test_yaffs_symlink_ENOTDIR(void)
+{
+ int error_code = 0;
+ output = yaffs_symlink(FILE_PATH,"non-existing-dir/sym_link");
+ 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("created a symlink in a non-existing directory (which is a bad thing)\n",2);
+ return -1;
+ }
+
+}
+
+int test_yaffs_symlink_ENOTDIR_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_ENOTDIR_h__
+#define __test_yaffs_symlink_ENOTDIR_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_symlink_ENOTDIR(void);
+int test_yaffs_symlink_ENOTDIR_clean(void);
+
+#endif