From 3914530ecd6bcaa511b8d74550eca2afc81b47ea Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Tue, 23 Nov 2010 11:19:58 +1300 Subject: [PATCH] yaffs Adding new tests to direct/timothy_tests/quicktests/ Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/Makefile | 16 +++--- .../timothy_tests/quick_tests/quick_tests.h | 17 ++++++ .../quick_tests/test_yaffs_access_ENOENT2.c | 42 ++++++++++++++ .../quick_tests/test_yaffs_access_ENOENT2.h | 24 ++++++++ .../quick_tests/test_yaffs_access_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_chmod_ENOENT2.c | 39 +++++++++++++ .../quick_tests/test_yaffs_chmod_ENOENT2.h | 25 +++++++++ .../quick_tests/test_yaffs_chmod_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_link_ENOENT2.c | 56 +++++++++++++++++++ .../quick_tests/test_yaffs_link_ENOENT2.h | 25 +++++++++ .../quick_tests/test_yaffs_link_ENOENT3.c | 56 +++++++++++++++++++ .../quick_tests/test_yaffs_link_ENOENT3.h | 25 +++++++++ .../quick_tests/test_yaffs_link_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_link_ENOTDIR2.c | 2 +- .../quick_tests/test_yaffs_mkdir_ENOENT.c | 47 ++++++++++++++++ .../quick_tests/test_yaffs_mkdir_ENOENT.h | 25 +++++++++ .../quick_tests/test_yaffs_mkdir_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_stat_ENOENT2.c | 41 ++++++++++++++ .../quick_tests/test_yaffs_stat_ENOENT2.h | 26 +++++++++ .../quick_tests/test_yaffs_stat_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_symlink_ENOENT2.c | 47 ++++++++++++++++ .../quick_tests/test_yaffs_symlink_ENOENT2.h | 25 +++++++++ .../quick_tests/test_yaffs_symlink_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_truncate_ENOENT2.c | 42 ++++++++++++++ .../quick_tests/test_yaffs_truncate_ENOENT2.h | 23 ++++++++ .../quick_tests/test_yaffs_truncate_ENOTDIR.c | 2 +- .../quick_tests/test_yaffs_unlink_ENOENT2.c | 42 ++++++++++++++ .../quick_tests/test_yaffs_unlink_ENOENT2.h | 25 +++++++++ .../quick_tests/test_yaffs_unlink_ENOTDIR.c | 2 +- 29 files changed, 670 insertions(+), 16 deletions(-) create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.h diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 4d83a7e..1270940 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -51,25 +51,27 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_open_ENAMETOOLONG.o \ test_yaffs_open_EINVAL.o test_yaffs_open_EINVAL2.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_ENOTDIR.o test_yaffs_unlink_ENOENT2.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_EINVAL.o test_yaffs_truncate_big_file.o test_yaffs_truncate_ENOENT2.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_stat.o test_yaffs_stat_ENOENT.o test_yaffs_stat_ENOTDIR.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_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_chmod.o test_yaffs_chmod_ENOENT.o test_yaffs_chmod_ENOTDIR.o test_yaffs_chmod_EINVAL.o \ + test_yaffs_chmod_ENOENT2.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 \ - test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o \ + test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.o test_yaffs_mkdir_ENOENT.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_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\ @@ -80,7 +82,7 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_totalspace.o test_yaffs_totalspace_EINVAL.o \ test_yaffs_inodecount.o test_yaffs_inodecount_EINVAL.o \ test_yaffs_link.o test_yaffs_link_ENOENT.o test_yaffs_link_EEXIST.o test_yaffs_link_ENOTDIR.o \ - test_yaffs_link_ENOTDIR2.o \ + test_yaffs_link_ENOTDIR2.o test_yaffs_link_ENOENT2.o test_yaffs_link_ENOENT3.o test_yaffs_link_ENOENT3.o \ test_yaffs_rmdir.o diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 12bfe49..f475d1c 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -45,6 +45,7 @@ #include "test_yaffs_unlink_ENAMETOOLONG.h" #include "test_yaffs_unlink_ENOTDIR.h" #include "test_yaffs_unlink_ENOENT.h" +#include "test_yaffs_unlink_ENOENT2.h" #include "test_yaffs_ftruncate.h" #include "test_yaffs_ftruncate_EBADF.h" @@ -58,6 +59,7 @@ #include "test_yaffs_truncate_ENOENT.h" #include "test_yaffs_truncate_EINVAL.h" #include "test_yaffs_truncate_big_file.h" +#include "test_yaffs_truncate_ENOENT2.h" #include "test_yaffs_write.h" #include "test_yaffs_write_EBADF.h" @@ -76,10 +78,12 @@ #include "test_yaffs_access_EINVAL.h" #include "test_yaffs_access_ENOTDIR.h" #include "test_yaffs_access_ENOENT.h" +#include "test_yaffs_access_ENOENT2.h" #include "test_yaffs_stat.h" #include "test_yaffs_stat_ENOENT.h" #include "test_yaffs_stat_ENOTDIR.h" +#include "test_yaffs_stat_ENOENT2.h" #include "test_yaffs_fstat.h" #include "test_yaffs_fstat_EBADF.h" @@ -88,6 +92,7 @@ #include "test_yaffs_chmod_ENOENT.h" #include "test_yaffs_chmod_ENOTDIR.h" #include "test_yaffs_chmod_EINVAL.h" +#include "test_yaffs_chmod_ENOENT2.h" #include "test_yaffs_fchmod.h" @@ -103,11 +108,13 @@ #include "test_yaffs_mkdir.h" #include "test_yaffs_mkdir_EEXIST.h" #include "test_yaffs_mkdir_ENOTDIR.h" +#include "test_yaffs_mkdir_ENOENT.h" #include "test_yaffs_symlink.h" #include "test_yaffs_symlink_ENOTDIR.h" #include "test_yaffs_symlink_EEXIST.h" #include "test_yaffs_symlink_ENOENT.h" +#include "test_yaffs_symlink_ENOENT2.h" #include "test_yaffs_mount2.h" #include "test_yaffs_mount2_ENODEV.h" @@ -140,6 +147,8 @@ #include "test_yaffs_link_EEXIST.h" #include "test_yaffs_link_ENOTDIR.h" #include "test_yaffs_link_ENOTDIR2.h" +#include "test_yaffs_link_ENOENT2.h" +#include "test_yaffs_link_ENOENT3.h" #include "test_yaffs_rmdir.h" @@ -184,6 +193,7 @@ test_template test_list[]={ {test_yaffs_access_EINVAL,test_yaffs_access_EINVAL_clean,"test_yaffs_access_EINVAL"}, {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_unlink, test_yaffs_unlink_clean,"test_yaffs_unlink"}, {test_yaffs_unlink_EISDIR,test_yaffs_unlink_EISDIR_clean,"test_yaffs_unlink_EISDIR"}, @@ -191,6 +201,7 @@ test_template test_list[]={ {test_yaffs_unlink_ENAMETOOLONG,test_yaffs_unlink_ENAMETOOLONG_clean,"test_yaffs_unlink_ENAMETOOLONG"}, {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_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, @@ -209,6 +220,7 @@ test_template test_list[]={ {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"}, {test_yaffs_stat_ENOENT,test_yaffs_stat_ENOENT_clean,"test_yaffs_stat_ENOENT"}, {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_fstat,test_yaffs_fstat_clean,"test_yaffs_fstat"}, {test_yaffs_fstat_EBADF,test_yaffs_fstat_EBADF_clean,"test_yaffs_fstat_EBADF"}, @@ -223,6 +235,7 @@ test_template test_list[]={ {test_yaffs_truncate_EISDIR,test_yaffs_truncate_EISDIR_clean,"test_yaffs_truncate_EISDIR"}, {test_yaffs_truncate_EINVAL,test_yaffs_truncate_EINVAL_clean,"test_yaffs_truncate_EINVAL"}, {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"}, + {test_yaffs_truncate_ENOENT2,test_yaffs_truncate_ENOENT2_clean,"test_yaffs_truncate_ENOENT2"}, // {test_yaffs_truncate_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled. {test_yaffs_chmod,test_yaffs_chmod_clean,"test_yaffs_chmod"}, @@ -243,11 +256,13 @@ test_template test_list[]={ {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"}, {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_mkdir_ENOENT,test_yaffs_mkdir_ENOENT_clean,"test_yaffs_mkdir_ENOENT"}, {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"}, {test_yaffs_symlink_ENOTDIR,test_yaffs_symlink_ENOTDIR_clean,"test_yaffs_symlink_ENOTDIR"}, {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_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"}, {test_yaffs_mount2_ENODEV,test_yaffs_mount2_ENODEV_clean,"test_yaffs_mount2_ENODEV"}, @@ -282,6 +297,8 @@ test_template test_list[]={ {test_yaffs_link_EEXIST,test_yaffs_link_EEXIST_clean,"test_yaffs_link_EEXIST"}, {test_yaffs_link_ENOTDIR,test_yaffs_link_ENOTDIR_clean,"test_yaffs_link_ENOTDIR"}, {test_yaffs_link_ENOTDIR2,test_yaffs_link_ENOTDIR2_clean,"test_yaffs_link_ENOTDIR2"}, + {test_yaffs_link_ENOENT2,test_yaffs_link_ENOENT2_clean,"test_yaffs_link_ENOENT2"}, + {test_yaffs_link_ENOENT3,test_yaffs_link_ENOENT3_clean,"test_yaffs_link_ENOENT3"}, {test_yaffs_rmdir,test_yaffs_rmdir_clean,"test_yaffs_rmdir"} }; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.c new file mode 100644 index 0000000..a436dbb --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.c @@ -0,0 +1,42 @@ +/* + * 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_access_ENOENT2.h" + +static int handle=0; + +int test_yaffs_access_ENOENT2(void) +{ + int output=0; + int error_code=0; + + output=yaffs_access("/nonexisting_dir/foo",0); + if (output==-1){ + 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("non existant directory accessed.(which is a bad thing)\n",2); + return -1; + } + +} +int test_yaffs_access_ENOENT2_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.h new file mode 100644 index 0000000..41afd09 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.h @@ -0,0 +1,24 @@ +/* + * 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_access_ENOENT2_h__ +#define __test_yaffs_access_ENOENT2_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_access_ENOENT2(void); +int test_yaffs_access_ENOENT2_clean(void); +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_access_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_access_ENOTDIR.c index c494f18..2dda915 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_access_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_access_ENOTDIR.c @@ -20,7 +20,7 @@ int test_yaffs_access_ENOTDIR(void) int output=0; int error_code=0; - output=yaffs_access("/nonexisting_dir/foo",0); + output=yaffs_access("/yaffs2/foo/file",0); if (output==-1){ error_code=yaffs_get_error(); if (abs(error_code)==ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.c new file mode 100644 index 0000000..a070a8a --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.c @@ -0,0 +1,39 @@ +/* + * 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_chmod_ENOENT2.h" + +int test_yaffs_chmod_ENOENT2(void) +{ + int error=0; + int output=yaffs_chmod("/non_existing_directory/foo",S_IREAD|S_IWRITE); + + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==ENOENT){ + return 1; + } else { + print_message("different error than expected\n",2); + return -1; + } + } else { + print_message("chmoded the file (which is a bad thing)\n",2); + return -1; + } + +} + +int test_yaffs_chmod_ENOENT2_clean(void) +{ + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.h new file mode 100644 index 0000000..583c8b1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOENT2.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_chmod_ENOENT2_h__ +#define __test_yaffs_chmod_ENOENT2_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_chmod_ENOENT2(void); +int test_yaffs_chmod_ENOENT2_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOTDIR.c index 2390d0c..7915422 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_chmod_ENOTDIR.c @@ -16,7 +16,7 @@ int test_yaffs_chmod_ENOTDIR(void) { int error=0; - int output=yaffs_chmod("/non_existing_directory/foo",S_IREAD|S_IWRITE); + int output=yaffs_chmod("/yaffs2/foo/file",S_IREAD|S_IWRITE); if (output<0){ error=yaffs_get_error(); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.c new file mode 100644 index 0000000..533f18d --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.c @@ -0,0 +1,56 @@ +/* + * 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_ENOENT2.h" + + + +int test_yaffs_link_ENOENT2(void) +{ + int output=0; + int error =0; + output = yaffs_link("/non-existing-dir/foo",HARD_LINK_PATH); + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==ENOENT){ + 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_ENOENT2_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_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.h new file mode 100644 index 0000000..39f712e --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT2.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_ENOENT2_h__ +#define __test_yaffs_link_ENOENT2_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_ENOENT2(void); +int test_yaffs_link_ENOENT2_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.c b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.c new file mode 100644 index 0000000..2976178 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.c @@ -0,0 +1,56 @@ +/* + * 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_ENOENT3.h" + + + +int test_yaffs_link_ENOENT3(void) +{ + int output=0; + int error =0; + output = yaffs_link(FILE_PATH,"non-existing-directory/hard_link"); + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==ENOENT){ + 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_ENOENT3_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_ENOENT3.h b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.h new file mode 100644 index 0000000..5ea7a4f --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT3.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_ENOENT3_h__ +#define __test_yaffs_link_ENOENT32_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_ENOENT3(void); +int test_yaffs_link_ENOENT3_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.c index 333c7a7..6bfad08 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.c @@ -19,7 +19,7 @@ int test_yaffs_link_ENOTDIR(void) { int output=0; int error =0; - output = yaffs_link("/non-existing-dir/foo",HARD_LINK_PATH); + output = yaffs_link("/yaffs2/foo/file",HARD_LINK_PATH); if (output<0){ error=yaffs_get_error(); if (abs(error)==ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.c b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.c index 754acc2..5602f3c 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.c @@ -19,7 +19,7 @@ int test_yaffs_link_ENOTDIR2(void) { int output=0; int error =0; - output = yaffs_link(FILE_PATH,"non-existing-directory/hard_link"); + output = yaffs_link(FILE_PATH,"yaffs2/foo/hard_link"); if (output<0){ error=yaffs_get_error(); if (abs(error)==ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.c new file mode 100644 index 0000000..84cc3d1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.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_mkdir_ENOENT.h" + +static int output = -1; + +int test_yaffs_mkdir_ENOENT(void) +{ + int error_code = 0; + + + output = yaffs_mkdir("/non_existing_directory/new_directory/",O_CREAT | O_RDWR); + 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("created a new directory on top of an non-existing directory (which is a bad thing)\n", 2); + return -1; + } +} + + +int test_yaffs_mkdir_ENOENT_clean(void) +{ + if (output >= 0){ + return yaffs_rmdir(DIR_PATH); + } else { + return 1; + } +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.h new file mode 100644 index 0000000..4be6ecd --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOENT.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_mkdir_ENOENT_h__ +#define __test_yaffs_mkdir_ENOENT_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_mkdir_ENOENT(void); +int test_yaffs_mkdir_ENOENT_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c index 4b36abc..f626230 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_mkdir_ENOTDIR.c @@ -20,7 +20,7 @@ int test_yaffs_mkdir_ENOTDIR(void) int error_code = 0; - output = yaffs_mkdir("/non_existing_directory/new_directory/",O_CREAT | O_RDWR); + output = yaffs_mkdir("/yaffs2/foo/new_directory/",O_CREAT | O_RDWR); if (output < 0){ error_code = yaffs_get_error(); if (abs(error_code) == ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.c new file mode 100644 index 0000000..1b4cce8 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.c @@ -0,0 +1,41 @@ +/* + * 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_ENOENT2.h" + +int test_yaffs_stat_ENOENT2(void) +{ + int error_code=0; + struct yaffs_stat stat; + int output=0; + char text[100]; + text[0] ='\0'; + output=yaffs_stat("/non-existing-dir/foo", &stat);; + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code)==ENOENT){ + return 1; + } else { + print_message("returned error does not match the the expected error\n",2); + return -1; + } + } else { + print_message("stated a non-existing file (which is a bad thing)\n",2); + return -1; + } +} + +int test_yaffs_stat_ENOENT2_clean(void) +{ + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.h new file mode 100644 index 0000000..ea5d586 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.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_ENOENT2_h__ +#define __test_yaffs_stat_ENOENT2_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" + +int test_yaffs_stat_ENOENT2(void); +int test_yaffs_stat_ENOENT2_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOTDIR.c index d0ab0e7..c4a5910 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_stat_ENOTDIR.c @@ -20,7 +20,7 @@ int test_yaffs_stat_ENOTDIR(void) int output=0; char text[100]; text[0] ='\0'; - output=yaffs_stat("/non-existing-dir/foo", &stat);; + output=yaffs_stat("/yaffs2/foo/file", &stat);; if (output<0){ error_code=yaffs_get_error(); if (abs(error_code)==ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.c new file mode 100644 index 0000000..cd4b60a --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.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_symlink_ENOENT2.h" + +static int output = 0; + +int test_yaffs_symlink_ENOENT2(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)==ENOENT){ + 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_ENOENT2_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_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.h new file mode 100644 index 0000000..9633140 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOENT2.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_ENOENT2_h__ +#define __test_yaffs_symlink_ENOENT2_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_symlink_ENOENT2(void); +int test_yaffs_symlink_ENOENT2_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c index b2f7867..3844b0e 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_symlink_ENOTDIR.c @@ -18,7 +18,7 @@ static int output = 0; int test_yaffs_symlink_ENOTDIR(void) { int error_code = 0; - output = yaffs_symlink(FILE_PATH,"non-existing-dir/sym_link"); + output = yaffs_symlink(FILE_PATH,"yaffs2/foo/sym_link"); if (output<0){ error_code=yaffs_get_error(); if (abs(error_code)==ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.c new file mode 100644 index 0000000..67da0ad --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.c @@ -0,0 +1,42 @@ +/* + * 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_ENOENT2.h" + + + +int test_yaffs_truncate_ENOENT2(void) +{ + int error=0; + int output=0; + + + output= yaffs_truncate("/non_existing_dir/foo",FILE_SIZE_TRUNCATED ); + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==ENOENT){ + 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_ENOENT2_clean(void) +{ + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.h new file mode 100644 index 0000000..a2a7da9 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOENT2.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_ENOENT2_h__ +#define __test_yaffs_truncate_ENOENT2_h__ +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" +int test_yaffs_truncate_ENOENT2(void); +int test_yaffs_truncate_ENOENT2_clean(void); +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOTDIR.c index d8ef155..0263ca1 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate_ENOTDIR.c @@ -21,7 +21,7 @@ int test_yaffs_truncate_ENOTDIR(void) int output=0; - output= yaffs_truncate("/non_existing_dir/foo",FILE_SIZE_TRUNCATED ); + output= yaffs_truncate("/yaffs2/foo/file",FILE_SIZE_TRUNCATED ); if (output<0){ error=yaffs_get_error(); if (abs(error)==ENOTDIR){ diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.c b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.c new file mode 100644 index 0000000..b08989f --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.c @@ -0,0 +1,42 @@ +/* + * 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_unlink_ENOENT2.h" + + +int test_yaffs_unlink_ENOENT2(void) +{ + int output=0; + int error_code=0; + + output=yaffs_unlink("/nonexisting_dir/foo"); + if (output==-1){ + 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("non existant directory opened.(which is a bad thing)\n",2); + return -1; + } + + +} +int test_yaffs_unlink_ENOENT2_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.h b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.h new file mode 100644 index 0000000..a436614 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOENT2.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_ENOENT2_h__ +#define __test_yaffs_unlink_ENOENT2_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_unlink_ENOENT2(void); +int test_yaffs_unlink_ENOENT2_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOTDIR.c index 5eaff8c..78d9cef 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_unlink_ENOTDIR.c @@ -19,7 +19,7 @@ int test_yaffs_unlink_ENOTDIR(void) int output=0; int error_code=0; - output=yaffs_unlink("/nonexisting_dir/foo"); + output=yaffs_unlink("/yaffs2/foo/file"); if (output==-1){ error_code=yaffs_get_error(); if (abs(error_code)==ENOTDIR){ -- 2.30.2