From fadebbf369cec12be83899d0570f05e4f99ca01a Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Mon, 22 Nov 2010 10:33:48 +1300 Subject: [PATCH] yaffs More tests added to direct/timothy_tests/quick_tests/ Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/Makefile | 13 ++++--- direct/timothy_tests/quick_tests/README.txt | 5 +-- .../timothy_tests/quick_tests/quick_tests.h | 5 ++- .../quick_tests/test_yaffs_rmdir.c | 35 +++++++++++++++++++ .../quick_tests/test_yaffs_rmdir.h | 25 +++++++++++++ 5 files changed, 76 insertions(+), 7 deletions(-) create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_rmdir.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_rmdir.h diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index c13265a..4d83a7e 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -47,11 +47,14 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsf TESTFILES = quick_tests.o lib.o \ test_yaffs_mount.o test_yaffs_mount_ENODEV.o test_yaffs_mount_ENAMETOOLONG.o test_yaffs_mount_EBUSY.o \ test_yaffs_unmount.o test_yaffs_unmount_ENODEV.o test_yaffs_unmount_ENAMETOOLONG.o test_yaffs_unmount_EBUSY.o \ - test_yaffs_open.o test_yaffs_open_ENOENT.o test_yaffs_open_ENOTDIR.o test_yaffs_open_EEXIST.o test_yaffs_open_EISDIR.o test_yaffs_open_ENAMETOOLONG.o \ + test_yaffs_open.o test_yaffs_open_ENOENT.o test_yaffs_open_ENOTDIR.o test_yaffs_open_EEXIST.o test_yaffs_open_EISDIR.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.o test_yaffs_unlink_EISDIR.o test_yaffs_unlink_ENOENT.o test_yaffs_unlink_ENAMETOOLONG.o \ + test_yaffs_unlink_ENOTDIR.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.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_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\ @@ -76,7 +79,9 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_freespace.o test_yaffs_freespace_EINVAL.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.o test_yaffs_link_ENOENT.o test_yaffs_link_EEXIST.o test_yaffs_link_ENOTDIR.o \ + test_yaffs_link_ENOTDIR2.o \ + test_yaffs_rmdir.o diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt index e19b94a..de90a6c 100644 --- a/direct/timothy_tests/quick_tests/README.txt +++ b/direct/timothy_tests/quick_tests/README.txt @@ -45,9 +45,10 @@ Tests made test_yaffs_link test_yaffs_link_EEXIST - test_yaffs_link_ENOENT + test_yaffs_link_ENOENT //note ENOENT2 does not exist because the second path is trying to create a file. test_yaffs_link_ENOTDIR - + test_yaffs_link_ENOTDIR2 + test_yaffs_lseek test_yaffs_lseek_EBADF test_yaffs_lseek_EINVAL diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 2135663..12bfe49 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -141,6 +141,8 @@ #include "test_yaffs_link_ENOTDIR.h" #include "test_yaffs_link_ENOTDIR2.h" +#include "test_yaffs_rmdir.h" + #include "yaffsfs.h" #include "yaffs_error_converter.h" #include "lib.h" @@ -279,8 +281,9 @@ test_template test_list[]={ {test_yaffs_link_ENOENT,test_yaffs_link_ENOENT_clean,"test_yaffs_link_ENOENT"}, {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_ENOTDIR2,test_yaffs_link_ENOTDIR2_clean,"test_yaffs_link_ENOTDIR2"}, + {test_yaffs_rmdir,test_yaffs_rmdir_clean,"test_yaffs_rmdir"} }; void init_quick_tests(int argc, char *argv[]); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rmdir.c b/direct/timothy_tests/quick_tests/test_yaffs_rmdir.c new file mode 100644 index 0000000..3d8dbae --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_rmdir.c @@ -0,0 +1,35 @@ +/* + * 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.h" + + +int test_yaffs_rmdir(void) +{ + int output=0; + 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 yaffs_rmdir(DIR_PATH); +} + + +int test_yaffs_rmdir_clean(void) +{ + return -1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_rmdir.h b/direct/timothy_tests/quick_tests/test_yaffs_rmdir.h new file mode 100644 index 0000000..e0445bc --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_rmdir.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_rmdir_h__ +#define __test_yaffs_rmdir_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_rmdir(void); +int test_yaffs_rmdir_clean(void); + +#endif -- 2.30.2