From c744d74c2f562bb505c3086585ae9beb359c85a3 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Mon, 29 Nov 2010 10:45:17 +1300 Subject: [PATCH] yaffs Added morew tests to direct/timothy_tests/quick_tests Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/Makefile | 7 ++- .../timothy_tests/quick_tests/quick_tests.h | 13 +++- .../quick_tests/test_yaffs_fdatasync_EBADF.c | 2 +- .../quick_tests/test_yaffs_fdatasync_EROFS.c | 48 ++++++++++++++ .../quick_tests/test_yaffs_fdatasync_EROFS.h | 26 ++++++++ .../quick_tests/test_yaffs_flush_EROFS.c | 49 +++++++++++++++ .../quick_tests/test_yaffs_flush_EROFS.h | 26 ++++++++ .../quick_tests/test_yaffs_fstat_EROFS.c | 47 ++++++++++++++ .../quick_tests/test_yaffs_fstat_EROFS.h | 26 ++++++++ .../quick_tests/test_yaffs_ftruncate_EROFS.c | 48 ++++++++++++++ .../quick_tests/test_yaffs_ftruncate_EROFS.h | 26 ++++++++ .../quick_tests/test_yaffs_link_EROFS.c | 62 +++++++++++++++++++ .../quick_tests/test_yaffs_link_EROFS.h | 25 ++++++++ 13 files changed, 399 insertions(+), 6 deletions(-) create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.h diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 252c635..12462b6 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -53,6 +53,7 @@ TESTFILES = quick_tests.o lib.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_unlink_ELOOP_dir.o \ test_yaffs_ftruncate.o test_yaffs_ftruncate_EBADF.o test_yaffs_ftruncate_EINVAL.o test_yaffs_ftruncate_big_file.o \ + test_yaffs_ftruncate_EROFS.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_ELOOP.o \ test_yaffs_truncate_ELOOP_dir.o \ @@ -63,13 +64,13 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_access_ENOENT2.o test_yaffs_access_ELOOP_dir.o test_yaffs_access_ELOOP.o test_yaffs_access_EROFS.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_stat_ELOOP_dir.o\ - test_yaffs_fstat.o test_yaffs_fstat_EBADF.o \ + test_yaffs_fstat.o test_yaffs_fstat_EBADF.o test_yaffs_fstat_EROFS.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_ELOOP_dir.o test_yaffs_chmod_ELOOP.o test_yaffs_chmod_EROFS.o \ test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EROFS.o test_yaffs_fchmod_EINVAL.o\ test_yaffs_fsync.o test_yaffs_fsync_EBADF.o \ - test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.o \ + test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.o test_yaffs_fdatasync_EROFS.o\ test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o test_yaffs_mkdir_ENOENT.o \ test_yaffs_mkdir_ELOOP_dir.o \ test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o \ @@ -93,7 +94,7 @@ TESTFILES = quick_tests.o lib.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_ELOOP_dir.o \ test_yaffs_lstat.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o \ - test_yaffs_flush.o test_yaffs_flush_EBADF.o + test_yaffs_flush.o test_yaffs_flush_EBADF.o test_yaffs_flush_EROFS.o diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 876ff40..60df322 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -54,6 +54,7 @@ #include "test_yaffs_ftruncate_EBADF.h" #include "test_yaffs_ftruncate_EINVAL.h" #include "test_yaffs_ftruncate_big_file.h" +#include "test_yaffs_ftruncate_EROFS.h" #include "test_yaffs_truncate.h" @@ -97,6 +98,7 @@ #include "test_yaffs_fstat.h" #include "test_yaffs_fstat_EBADF.h" +#include "test_yaffs_fstat_EROFS.h" #include "test_yaffs_chmod.h" #include "test_yaffs_chmod_ENOENT.h" @@ -117,6 +119,7 @@ #include "test_yaffs_fdatasync.h" #include "test_yaffs_fdatasync_EBADF.h" +#include "test_yaffs_fdatasync_EROFS.h" #include "test_yaffs_mkdir.h" #include "test_yaffs_mkdir_EEXIST.h" @@ -194,6 +197,7 @@ #include "test_yaffs_flush.h" #include "test_yaffs_flush_EBADF.h" +#include "test_yaffs_flush_EROFS.h" #include "yaffsfs.h" #include "yaffs_error_converter.h" @@ -275,11 +279,13 @@ test_template test_list[]={ {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_fstat_EROFS,test_yaffs_fstat_EROFS_clean,"test_yaffs_fstat_EROFS"}, {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"}, {test_yaffs_ftruncate_EBADF,test_yaffs_ftruncate_EBADF_clean,"test_yaffs_ftruncate_EBADF"}, {test_yaffs_ftruncate_EINVAL,test_yaffs_ftruncate_EINVAL_clean,"test_yaffs_ftruncate_EINVAL"}, {test_yaffs_ftruncate_big_file,test_yaffs_ftruncate_big_file_clean,"test_yaffs_ftruncate_big_file"}, + {test_yaffs_ftruncate_EROFS,test_yaffs_ftruncate_EROFS_clean,"test_yaffs_ftruncate_EROFS"}, {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"}, {test_yaffs_truncate_ENOTDIR,test_yaffs_truncate_ENOTDIR_clean,"test_yaffs_truncate_ENOTDIR"}, @@ -308,6 +314,7 @@ test_template test_list[]={ {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_fdatasync_EROFS,test_yaffs_fdatasync_EROFS_clean,"test_yaffs_fdatasync_EROFS"}, {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"}, {test_yaffs_mkdir_EEXIST,test_yaffs_mkdir_EEXIST_clean,"test_yaffs_mkdir_EEXIST"}, @@ -328,7 +335,8 @@ test_template test_list[]={ {test_yaffs_unmount2,test_yaffs_unmount2_clean,"test_yaffs_unmount2"}, {test_yaffs_unmount2_ENODEV,test_yaffs_unmount2_ENODEV_clean,"test_yaffs_unmount2_ENODEV"}, - {test_yaffs_unmount2_EINVAL,test_yaffs_unmount2_EINVAL_clean,"test_yaffs_unmount2_EINVAL"}, {test_yaffs_unmount2_with_handle_open_and_forced_mode_on,test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_on"}, + {test_yaffs_unmount2_EINVAL,test_yaffs_unmount2_EINVAL_clean,"test_yaffs_unmount2_EINVAL"}, +{test_yaffs_unmount2_with_handle_open_and_forced_mode_on,test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_on"}, {test_yaffs_unmount2_with_handle_open_and_forced_mode_off,test_yaffs_unmount2_with_handle_open_and_forced_mode_off_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_off"}, {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"}, @@ -385,7 +393,8 @@ test_template test_list[]={ {test_yaffs_lstat_ENOTDIR,test_yaffs_lstat_ENOTDIR_clean,"test_yaffs_lstat_ENOTDIR"}, {test_yaffs_flush,test_yaffs_flush_clean,"test_yaffs_flush"}, - {test_yaffs_flush_EBADF,test_yaffs_flush_EBADF_clean,"test_yaffs_flush_EBADF"} + {test_yaffs_flush_EBADF,test_yaffs_flush_EBADF_clean,"test_yaffs_flush_EBADF"}, + {test_yaffs_flush_EROFS,test_yaffs_flush_EROFS_clean,"test_yaffs_flush_EROFS"} }; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EBADF.c b/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EBADF.c index edfbb95..0e0786a 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EBADF.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EBADF.c @@ -11,7 +11,7 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_fdatasync.h" +#include "test_yaffs_fdatasync_EBADF.h" diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.c new file mode 100644 index 0000000..d2d78b8 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.c @@ -0,0 +1,48 @@ +/* + * 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 + * + * 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_fdatasync_EROFS.h" + +static int handle =-1; + +int test_yaffs_fdatasync_EROFS(void) +{ + int output = 0; + int error_code = 0; + EROFS_setup(); + handle = test_yaffs_open(); + output = yaffs_fdatasync(handle); + if (output==-1){ + error_code=yaffs_get_error(); + if (abs(error_code)==EROFS){ + return 1; + } else { + print_message("different error than expected\n",2); + return -1; + } + } else { + print_message("file synced on a read only system.(which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_fdatasync_EROFS_clean(void) +{ + int output=1; + if (handle >= 0) { + output= yaffs_close(handle); + } + return (EROFS_clean() && output); +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.h new file mode 100644 index 0000000..28ecb00 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_fdatasync_EROFS.h @@ -0,0 +1,26 @@ +/* + * 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 + * + * 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_fdatasync_EROFS_h__ +#define __test_yaffs_fdatasync_EROFS_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" + +int test_yaffs_fdatasync_EROFS(void); +int test_yaffs_fdatasync_EROFS_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.c new file mode 100644 index 0000000..b8a1ac5 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.c @@ -0,0 +1,49 @@ +/* + * 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 + * + * 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_flush_EROFS.h" + +static int handle =-1; + +int test_yaffs_flush_EROFS(void) +{ + int output=0; + int error =0; + EROFS_setup(); + handle = test_yaffs_open(); + output = yaffs_flush(handle); + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==EROFS){ + return 1; + } else { + print_message("different error than expected\n",2); + return -1; + } + } else { + print_message("flushed a file with EROFS (which is a bad thing)\n",2); + return -1; + } + +} + + +int test_yaffs_flush_EROFS_clean(void) +{ + int output=1; + if (handle >= 0) { + output= yaffs_close(handle); + } + return (EROFS_clean() && output); +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.h new file mode 100644 index 0000000..b912a15 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_flush_EROFS.h @@ -0,0 +1,26 @@ +/* + * 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 + * + * 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_flush_EROFS_h__ +#define __test_yaffs_flush_EROFS_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" + +int test_yaffs_flush_EROFS(void); +int test_yaffs_flush_EROFS_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.c new file mode 100644 index 0000000..cf90933 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.c @@ -0,0 +1,47 @@ +/* + * 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 + * + * 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_fstat_EROFS.h" + +static int handle = -1; + +int test_yaffs_fstat_EROFS(void) +{ + int output = 0; + struct yaffs_stat stat; + int error_code = 0; + EROFS_setup(); + handle = test_yaffs_open(); + output = yaffs_fstat(handle , &stat); + if (output < 0){ + error_code = yaffs_get_error(); + if (abs(error_code) == EROFS){ + return 1; + } else { + print_message("different error than expected\n", 2); + return -1; + } + } else { + print_message("file statted with EROFS set.(which is a bad thing)\n", 2 ); + return -1; + } +} + +int test_yaffs_fstat_EROFS_clean(void) +{ + int output=1; + if (handle >= 0) { + output= yaffs_close(handle); + } + return (EROFS_clean() && output); +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.h new file mode 100644 index 0000000..f382bde --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_fstat_EROFS.h @@ -0,0 +1,26 @@ +/* + * 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 + * + * 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_fstat_EROFS_h__ +#define __test_yaffs_fstat_EROFS_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" + +int test_yaffs_fstat_EROFS(void); +int test_yaffs_fstat_EROFS_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.c new file mode 100644 index 0000000..57a3ab5 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.c @@ -0,0 +1,48 @@ +/* + * 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 + * + * 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_ftruncate_EROFS.h" + +static int handle = -1; + +int test_yaffs_ftruncate_EROFS(void) +{ + int output = 0; + int error_code = 0; + EROFS_setup(); + handle = test_yaffs_open(); + + output = yaffs_ftruncate(handle,FILE_SIZE_TRUNCATED ); + if (output < 0){ + error_code=yaffs_get_error(); + //printf("EISDIR def %d, Error code %d\n", EISDIR,error_code); + if (abs(error_code) == EROFS){ + return 1; + } else { + print_message("different error than expected\n", 2); + return -1; + } + } else { + print_message("file truncated with EROFS set.(which is a bad thing)\n", 2); + return -1; + } +} + +int test_yaffs_ftruncate_EROFS_clean(void) +{ + int output=1; + if (handle >= 0) { + output= yaffs_close(handle); + } + return (EROFS_clean() && output); +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.h new file mode 100644 index 0000000..18ba182 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate_EROFS.h @@ -0,0 +1,26 @@ +/* + * 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 + * + * 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_ftruncate_EROFS_h__ +#define __test_yaffs_ftruncate_EROFS_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" + +int test_yaffs_ftruncate_EROFS(void); +int test_yaffs_ftruncate_EROFS_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.c b/direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.c new file mode 100644 index 0000000..31c0900 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.c @@ -0,0 +1,62 @@ +/* + * 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 + * + * 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_ELOOP_dir.h" + + + +int test_yaffs_link_ELOOP_dir(void) +{ + int output=0; + int error =0; + + if (set_up_ELOOP()<0){ + print_message("failed to setup symlinks\n",2); + return -1; + } + + output = yaffs_link(ELOOP_PATH "/file",HARD_LINK_PATH); + 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("created a hard link to a non-existing-dir (which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_link_ELOOP_dir_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 */ + } +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.h b/direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.h new file mode 100644 index 0000000..cfdb130 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_EROFS.h @@ -0,0 +1,25 @@ +/* + * 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 + * + * 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_ELOOP_dir_h__ +#define __test_yaffs_link_ELOOP_dir_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_ELOOP_dir(void); +int test_yaffs_link_ELOOP_dir_clean(void); + +#endif -- 2.30.2