From: Timothy Manning Date: Fri, 26 Nov 2010 03:25:16 +0000 (+1300) Subject: yaffs Added more tests to direct/timothy_tests/quick_tests X-Git-Tag: linux-mainline-patchset-4~42 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=e7d46266c3b860e73cc8c7dc9ec494d2d82c188c yaffs Added more tests to direct/timothy_tests/quick_tests Signed-off-by: Timothy Manning --- diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 6c3ad4a..f948b01 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -51,20 +51,22 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_open_ENAMETOOLONG.o test_yaffs_open_EINVAL.o test_yaffs_open_EINVAL2.o test_yaffs_open_ELOOP.o \ test_yaffs_open_ELOOP_dir.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_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_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 \ 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_dir.o test_yaffs_access_ELOOP2.o test_yaffs_access_EROFS.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_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_ELOOP2.o test_yaffs_chmod_EROFS.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_fsync.o test_yaffs_fsync_EBADF.o \ test_yaffs_fdatasync.o test_yaffs_fdatasync_EBADF.o \ @@ -72,7 +74,7 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_mkdir_ELOOP_dir.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_symlink_ENOENT2.o test_yaffs_symlink_ELOOP_dir.o \ test_yaffs_mount2.o test_yaffs_mount2_ENODEV.o \ test_yaffs_unmount2.o test_yaffs_unmount2_ENODEV.o test_yaffs_unmount2_EINVAL.o \ test_yaffs_unmount2_with_handle_open_and_forced_mode_on.o test_yaffs_unmount2_with_handle_open_and_forced_mode_off.o\ @@ -86,10 +88,10 @@ TESTFILES = quick_tests.o lib.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_link_ELOOP_dir.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_rmdir_ENOTDIR.o test_yaffs_rmdir_ELOOP_dir.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_ELOOP.o test_yaffs_rename_ELOOP_dev.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 diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 42d2fe0..5fbf67a 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -48,6 +48,7 @@ #include "test_yaffs_unlink_ENOTDIR.h" #include "test_yaffs_unlink_ENOENT.h" #include "test_yaffs_unlink_ENOENT2.h" +#include "test_yaffs_unlink_ELOOP_dir.h" #include "test_yaffs_ftruncate.h" #include "test_yaffs_ftruncate_EBADF.h" @@ -63,6 +64,7 @@ #include "test_yaffs_truncate_big_file.h" #include "test_yaffs_truncate_ENOENT2.h" #include "test_yaffs_truncate_ELOOP.h" +#include "test_yaffs_truncate_ELOOP_dir.h" #include "test_yaffs_write.h" #include "test_yaffs_write_EBADF.h" @@ -83,7 +85,7 @@ #include "test_yaffs_access_ENOENT.h" #include "test_yaffs_access_ENOENT2.h" #include "test_yaffs_access_ELOOP_dir.h" -#include "test_yaffs_access_ELOOP2.h" +#include "test_yaffs_access_ELOOP.h" #include "test_yaffs_access_EROFS.h" #include "test_yaffs_stat.h" @@ -91,6 +93,7 @@ #include "test_yaffs_stat_ENOTDIR.h" #include "test_yaffs_stat_ENOENT2.h" #include "test_yaffs_stat_ELOOP.h" +#include "test_yaffs_stat_ELOOP_dir.h" #include "test_yaffs_fstat.h" #include "test_yaffs_fstat_EBADF.h" @@ -101,7 +104,7 @@ #include "test_yaffs_chmod_EINVAL.h" #include "test_yaffs_chmod_ENOENT2.h" #include "test_yaffs_chmod_ELOOP_dir.h" -#include "test_yaffs_chmod_ELOOP2.h" +#include "test_yaffs_chmod_ELOOP.h" #include "test_yaffs_chmod_EROFS.h" #include "test_yaffs_fchmod.h" @@ -126,6 +129,7 @@ #include "test_yaffs_symlink_EEXIST.h" #include "test_yaffs_symlink_ENOENT.h" #include "test_yaffs_symlink_ENOENT2.h" +#include "test_yaffs_symlink_ELOOP_dir.h" #include "test_yaffs_mount2.h" #include "test_yaffs_mount2_ENODEV.h" @@ -169,6 +173,7 @@ #include "test_yaffs_rmdir_EINVAL.h" #include "test_yaffs_rmdir_ENOENT.h" #include "test_yaffs_rmdir_ENOTDIR.h" +#include "test_yaffs_rmdir_ELOOP_dir.h" #include "test_yaffs_rename.h" #include "test_yaffs_rename_ENOENT.h" @@ -180,8 +185,7 @@ #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_rename_ELOOP_dev.h" +#include "test_yaffs_rename_ELOOP_dir.h" #include "test_yaffs_lstat.h" #include "test_yaffs_lstat_ENOENT.h" @@ -235,7 +239,7 @@ test_template test_list[]={ {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_dir,test_yaffs_access_ELOOP_dir_clean,"test_yaffs_access_ELOOP_dir"}, - {test_yaffs_access_ELOOP2,test_yaffs_access_ELOOP2_clean,"test_yaffs_access_ELOOP2"}, + {test_yaffs_access_ELOOP,test_yaffs_access_ELOOP_clean,"test_yaffs_access_ELOOP"}, {test_yaffs_access_EROFS,test_yaffs_access_EROFS_clean,"test_yaffs_access_EROFS"}, {test_yaffs_unlink, test_yaffs_unlink_clean,"test_yaffs_unlink"}, @@ -245,6 +249,7 @@ test_template test_list[]={ {test_yaffs_unlink_ENOTDIR,test_yaffs_unlink_ENOTDIR_clean,"test_yaffs_unlink_ENOTDIR"}, {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"}, {test_yaffs_unlink_ENOENT2,test_yaffs_unlink_ENOENT2_clean,"test_yaffs_unlink_ENOENT2"}, + {test_yaffs_unlink_ELOOP_dir,test_yaffs_unlink_ELOOP_dir_clean,"test_yaffs_unlink_ELOOP_dir"}, {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, @@ -265,6 +270,7 @@ test_template test_list[]={ {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_truncate_ELOOP_dir,test_yaffs_truncate_ELOOP_dir_clean,"test_yaffs_truncate_ELOOP_dir"}, {test_yaffs_fstat,test_yaffs_fstat_clean,"test_yaffs_fstat"}, {test_yaffs_fstat_EBADF,test_yaffs_fstat_EBADF_clean,"test_yaffs_fstat_EBADF"}, @@ -288,7 +294,7 @@ test_template test_list[]={ {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_dir,test_yaffs_chmod_ELOOP_dir_clean,"test_yaffs_chmod_ELOOP_dir"}, - {test_yaffs_chmod_ELOOP2,test_yaffs_chmod_ELOOP2_clean,"test_yaffs_chmod_ELOOP2"}, + {test_yaffs_chmod_ELOOP,test_yaffs_chmod_ELOOP_clean,"test_yaffs_chmod_ELOOP"}, {test_yaffs_chmod_EROFS,test_yaffs_chmod_EROFS_clean,"test_yaffs_chmod_EROFS"}, {test_yaffs_fchmod,test_yaffs_fchmod_clean,"test_yaffs_fchmod"}, @@ -312,6 +318,7 @@ test_template test_list[]={ {test_yaffs_symlink_EEXIST,test_yaffs_symlink_EEXIST_clean,"test_yaffs_symlink_EEXIST"}, {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"}, {test_yaffs_symlink_ENOENT2,test_yaffs_symlink_ENOENT2_clean,"test_yaffs_symlink_ENOENT2"}, + {test_yaffs_symlink_ELOOP_dir,test_yaffs_symlink_ELOOP_dir_clean,"test_yaffs_symlink_ELOOP_dir"}, {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"}, {test_yaffs_mount2_ENODEV,test_yaffs_mount2_ENODEV_clean,"test_yaffs_mount2_ENODEV"}, @@ -356,6 +363,8 @@ test_template test_list[]={ {test_yaffs_rmdir_EINVAL,test_yaffs_rmdir_EINVAL_clean,"test_yaffs_rmdir_EINVAL"}, {test_yaffs_rmdir_ENOENT,test_yaffs_rmdir_ENOENT_clean,"test_yaffs_rmdir_ENOENT"}, {test_yaffs_rmdir_ENOTDIR,test_yaffs_rmdir_ENOTDIR_clean,"test_yaffs_rmdir_ENOTDIR"}, + {test_yaffs_rmdir_ELOOP_dir,test_yaffs_rmdir_ELOOP_dir_clean,"test_yaffs_rmdir_ELOOP_dir"}, + {test_yaffs_stat_ELOOP_dir,test_yaffs_stat_ELOOP_dir_clean,"test_yaffs_stat_ELOOP_dir"}, {test_yaffs_rename,test_yaffs_rename_clean,"test_yaffs_rename"}, {test_yaffs_rename_ENOENT,test_yaffs_rename_ENOENT_clean,"test_yaffs_rename_ENOENT"}, @@ -364,11 +373,10 @@ test_template test_list[]={ {test_yaffs_rename_dir,test_yaffs_rename_dir_clean,"test_yaffs_rename_dir"}, {test_yaffs_rename_dir_ENOENT,test_yaffs_rename_dir_ENOENT_clean,"test_yaffs_rename_dir_ENOENT"}, {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_dir_to_file,test_yaffs_rename_dir_to_file_clean,"test_yaffs_rename_dir_to_file"}, {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_rename_ELOOP_dev,test_yaffs_rename_ELOOP_dev_clean,"test_yaffs_rename_ELOOP_dev"}, + {test_yaffs_rename_ELOOP_dir,test_yaffs_rename_ELOOP_dir_clean,"test_yaffs_rename_ELOOP_dir"}, {test_yaffs_lstat,test_yaffs_lstat_clean,"test_yaffs_lstat"}, {test_yaffs_lstat_ENOENT,test_yaffs_lstat_ENOENT_clean,"test_yaffs_lstat_ENOENT"}, diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP2.c b/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP.c similarity index 88% rename from direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP2.c rename to direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP.c index 719bedc..8338cc4 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP2.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP.c @@ -11,9 +11,9 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_access_ELOOP2.h" +#include "test_yaffs_access_ELOOP.h" -int test_yaffs_access_ELOOP2(void) +int test_yaffs_access_ELOOP(void) { int output=0; int error=0; @@ -37,7 +37,7 @@ int test_yaffs_access_ELOOP2(void) } } -int test_yaffs_access_ELOOP2_clean(void) +int test_yaffs_access_ELOOP_clean(void) { return 1; } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP.h b/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP.h similarity index 78% rename from direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP.h rename to direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP.h index ab79e57..089aeab 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP.h @@ -13,13 +13,10 @@ * 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__ - +#ifndef __test_yaffs_access_ELOOP_h__ +#define __test_yaffs_access_ELOOP_h__ #include "lib.h" #include "yaffsfs.h" - -int test_yaffs_rename_ELOOP(void); -int test_yaffs_rename_ELOOP_clean(void); - +int test_yaffs_access_ELOOP(void); +int test_yaffs_access_ELOOP_clean(void); #endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP2.c b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP.c similarity index 88% rename from direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP2.c rename to direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP.c index 32266dc..ae62f54 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP2.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP.c @@ -11,9 +11,9 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_chmod_ELOOP2.h" +#include "test_yaffs_chmod_ELOOP.h" -int test_yaffs_chmod_ELOOP2(void) +int test_yaffs_chmod_ELOOP(void) { int error=0; int output; @@ -40,7 +40,7 @@ int test_yaffs_chmod_ELOOP2(void) } -int test_yaffs_chmod_ELOOP2_clean(void) +int test_yaffs_chmod_ELOOP_clean(void) { return test_yaffs_chmod(); } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP2.h b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP.h similarity index 79% rename from direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP2.h rename to direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP.h index 336aadc..3254f62 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP2.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ELOOP.h @@ -13,14 +13,14 @@ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ -#ifndef __test_yaffs_chmod_ELOOP2_h__ -#define __test_yaffs_chmod_ELOOP2_h__ +#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_ELOOP2(void); -int test_yaffs_chmod_ELOOP2_clean(void); +int test_yaffs_chmod_ELOOP(void); +int test_yaffs_chmod_ELOOP_clean(void); #endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_flush.c b/direct/timothy_tests/quick_tests/test_yaffs_flush.c index de5ccde..c2417fb 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_flush.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_flush.c @@ -17,15 +17,23 @@ static int handle =-1; int test_yaffs_flush(void) { - int output=0; + int output=-1; handle = test_yaffs_open(); - output =yaffs_flush(handle); - + if (handle >= 0){ + output =yaffs_flush(handle); + } else { + print_message("failed to open file\n",2); + } + return output; } int test_yaffs_flush_clean(void) { - return yaffs_close(handle); + if (handle>=0){ + return yaffs_close(handle); + } else { + return -1; + } } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.c b/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dir.c similarity index 90% rename from direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.c rename to direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dir.c index 27a4df4..080d20a 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dir.c @@ -11,10 +11,10 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_rename_ELOOP_dev.h" +#include "test_yaffs_rename_ELOOP_dir.h" -int test_yaffs_rename_ELOOP_dev(void) +int test_yaffs_rename_ELOOP_dir(void) { int output=0; int error_code =0; @@ -42,7 +42,7 @@ int test_yaffs_rename_ELOOP_dev(void) } -int test_yaffs_rename_ELOOP_dev_clean(void) +int test_yaffs_rename_ELOOP_dir_clean(void) { int output = 0; if (0 == yaffs_access(RENAME_PATH,0)) { diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.h b/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dir.h similarity index 76% rename from direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.h rename to direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dir.h index 377bbb2..f1f1f74 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dev.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP_dir.h @@ -13,13 +13,13 @@ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ -#ifndef __test_yaffs_rename_ELOOP_dev_h__ -#define __test_yaffs_rename_ELOOP_dev_h__ +#ifndef __test_yaffs_rename_ELOOP_dir_h__ +#define __test_yaffs_rename_ELOOP_dir_h__ #include "lib.h" #include "yaffsfs.h" -int test_yaffs_rename_ELOOP_dev(void); -int test_yaffs_rename_ELOOP_dev_clean(void); +int test_yaffs_rename_ELOOP_dir(void); +int test_yaffs_rename_ELOOP_dir_clean(void); #endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP.c b/direct/timothy_tests/quick_tests/test_yaffs_rmdir_ELOOP_dir.c similarity index 64% rename from direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP.c rename to direct/timothy_tests/quick_tests/test_yaffs_rmdir_ELOOP_dir.c index 8d648a2..13c0ae0 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_rename_ELOOP.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_rmdir_ELOOP_dir.c @@ -11,22 +11,28 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_rename_ELOOP.h" +#include "test_yaffs_rmdir_ELOOP_dir.h" -int test_yaffs_rename_ELOOP(void) +int test_yaffs_rmdir_ELOOP_dir(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 (0 != yaffs_access(DIR_PATH,0)) { + output = yaffs_mkdir(DIR_PATH,S_IWRITE | S_IREAD); + if (output < 0) { + print_message("failed to create directory\n",2); + return -1; + } + } + output = yaffs_rmdir(ELOOP_PATH "/file"); if (output<0){ error_code=yaffs_get_error(); if (abs(error_code)==ELOOP){ @@ -36,17 +42,17 @@ int test_yaffs_rename_ELOOP(void) return -1; } } else{ - print_message("renamed a ELOOP (which is a bad thing)\n",2); + print_message("removed /yaffs2/ directory (which is a bad thing)\n",2); return -1; } } -int test_yaffs_rename_ELOOP_clean(void) +int test_yaffs_rmdir_ELOOP_dir_clean(void) { int output = 0; - if (0 == yaffs_access(RENAME_PATH,0)) { - output = yaffs_rename(RENAME_PATH,FILE_PATH); + if (0 == yaffs_access(DIR_PATH,0)) { + output = yaffs_rmdir(DIR_PATH); if (output < 0) { print_message("failed to remove the directory\n",2); return -1; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP2.h b/direct/timothy_tests/quick_tests/test_yaffs_rmdir_ELOOP_dir.h similarity index 76% rename from direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP2.h rename to direct/timothy_tests/quick_tests/test_yaffs_rmdir_ELOOP_dir.h index 85809a2..6b65c2d 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_access_ELOOP2.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_rmdir_ELOOP_dir.h @@ -13,10 +13,13 @@ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ -#ifndef __test_yaffs__access_ELOOP2_h__ -#define __test_yaffs_access_ELOOP2_h__ +#ifndef __test_yaffs_rmdir_ELOOP_dir_h__ +#define __test_yaffs_rmdir_ELOOP_dir_h__ + #include "lib.h" #include "yaffsfs.h" -int test_yaffs_access_ELOOP2(void); -int test_yaffs_access_ELOOP2_clean(void); + +int test_yaffs_rmdir_ELOOP_dir(void); +int test_yaffs_rmdir_ELOOP_dir_clean(void); + #endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.c b/direct/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.c new file mode 100644 index 0000000..e2a4eca --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.c @@ -0,0 +1,46 @@ +/* + * 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_stat_ELOOP_dir.h" + +int test_yaffs_stat_ELOOP_dir(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 "/file", &stat);; + 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("stated a ELOOP (which is a bad thing)\n",2); + return -1; + } +} + +int test_yaffs_stat_ELOOP_dir_clean(void) +{ + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.h b/direct/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.h new file mode 100644 index 0000000..ff40ea5 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.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_stat_ELOOP_dir_h__ +#define __test_yaffs_stat_ELOOP_dir_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" + +int test_yaffs_stat_ELOOP_dir(void); +int test_yaffs_stat_ELOOP_dir_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_ELOOP_dir.c b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ELOOP_dir.c new file mode 100644 index 0000000..843d835 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ELOOP_dir.c @@ -0,0 +1,52 @@ +/* + * 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_symlink_ELOOP_dir.h" + +static int output = 0; + +int test_yaffs_symlink_ELOOP_dir(void) +{ + int error_code = 0; + if (set_up_ELOOP()<0){ + print_message("failed to setup symlinks\n",2); + return -1; + } + + output = yaffs_symlink(FILE_PATH,ELOOP_PATH "/file"); + 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("created a symlink in a non-existing directory (which is a bad thing)\n",2); + return -1; + } + +} + +int test_yaffs_symlink_ELOOP_dir_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 */ + } +} + + + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_ELOOP_dir.h b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ELOOP_dir.h new file mode 100644 index 0000000..7b63716 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ELOOP_dir.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_symlink_ELOOP_dir_h__ +#define __test_yaffs_symlink_ELOOP_dir_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_symlink_ELOOP_dir(void); +int test_yaffs_symlink_ELOOP_dir_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ELOOP_dir.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ELOOP_dir.c new file mode 100644 index 0000000..6f03a45 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ELOOP_dir.c @@ -0,0 +1,46 @@ +/* + * 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_truncate_ELOOP_dir.h" + + + +int test_yaffs_truncate_ELOOP_dir(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",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_dir_clean(void) +{ + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ELOOP_dir.h b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ELOOP_dir.h new file mode 100644 index 0000000..552aab6 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ELOOP_dir.h @@ -0,0 +1,23 @@ +/* + * 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_truncate_ELOOP_dir_h__ +#define __test_yaffs_truncate_ELOOP_dir_h__ +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" +int test_yaffs_truncate_ELOOP_dir(void); +int test_yaffs_truncate_ELOOP_dir_clean(void); +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ELOOP_dir.c b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ELOOP_dir.c new file mode 100644 index 0000000..f7d04e8 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ELOOP_dir.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_open_ELOOP_dir.h" + + +int test_yaffs_unlink_ELOOP_dir(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_unlink(ELOOP_PATH "/file"); + if (output==-1){ + 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 existant directory opened.(which is a bad thing)\n",2); + return -1; + } + + +} +int test_yaffs_unlink_ELOOP_dir_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ELOOP_dir.h b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ELOOP_dir.h new file mode 100644 index 0000000..a9802ac --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ELOOP_dir.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_unlink_ELOOP_dir_h__ +#define __test_yaffs_unlink_ELOOP_dir_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_unlink_ELOOP_dir(void); +int test_yaffs_unlink_ELOOP_dir_clean(void); + +#endif