From a90a31a0b95c0b884a1e33b8a4c190905940bcad Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Tue, 16 Nov 2010 11:55:35 +1300 Subject: [PATCH] yaffs Added some more tests to quick tests. Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/Makefile | 4 +- direct/timothy_tests/quick_tests/README.txt | 6 +- .../timothy_tests/quick_tests/quick_tests.h | 4 ++ .../quick_tests/test_yaffs_fchmod_EINVAL.c | 57 +++++++++++++++++++ .../quick_tests/test_yaffs_fchmod_EINVAL.h | 27 +++++++++ 5 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 6e298b4..9737cdb 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -64,7 +64,9 @@ TESTFILES = quick_tests.o lib.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.o \ + test_yaffs_fchmod.o test_yaffs_fchmod_EBADF.o test_yaffs_fchmod_EINVAL.o + YAFFSTESTOBJS = $(COMMONTESTOBJS) $(TESTFILES) diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt index 74d512a..f2a9942 100644 --- a/direct/timothy_tests/quick_tests/README.txt +++ b/direct/timothy_tests/quick_tests/README.txt @@ -9,6 +9,7 @@ Tests made test_yaffs_fchmod test_yaffs_fchmod_EBADF + test_yaffs_fchmod_EINVAL test_yaffs_mount test_yaffs_mount_ENODEV @@ -84,8 +85,6 @@ Tests made Tests to add test_yaffs_fchmod_EACCES - test_yaffs_fchmod_EINVAL - test_yaffs_fchmod test_yaffs_chmod_EACCES test_yaffs_chmod_ELOOP @@ -224,11 +223,10 @@ Tests to add test_yaffs_close //This function has already been called by the time this test is reached. - test_yaffs_stat_EBADF test_yaffs_stat_ELOOP test_yaffs_stat_EACCES test_yaffs_stat_ENAMETOOLONG - test_yaffs_stat_ENOTDIR + test_yaffs_read_EFBIG diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 12bd6af..d2bc003 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -92,6 +92,7 @@ #include "test_yaffs_fchmod.h" #include "test_yaffs_fchmod_EBADF.h" +#include "test_yaffs_fchmod_EINVAL.h" #include "test_yaffs_fsync.h" #include "test_yaffs_fsync_EBADF.h" @@ -198,6 +199,9 @@ test_template test_list[]={ {test_yaffs_fdatasync_EBADF,test_yaffs_fdatasync_EBADF_clean,"test_yaffs_fdatasync_EBADF"}, {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"} + + {test_yaffs_fchmod_EINVAL,test_yaffs_fchmod_EINVAL_clean,"test_yaffs_fchmod_EINVAL"} + }; void init_quick_tests(int argc, char *argv[]); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.c new file mode 100644 index 0000000..61bb7b4 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.c @@ -0,0 +1,57 @@ +/* + * 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_fchmod_EINVAL.h" + +static int handle = -1; + +int test_yaffs_fchmod_EINVAL(void) +{ + int error = 0; + int output = 0; + + + handle = test_yaffs_open(); + + if (handle < 0){ + print_message("failed to open file\n",2); + return -1; + } + + + + output = yaffs_fchmod(handle,111111); + + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==EINVAL){ + return 1; + } else { + print_message("different error than expected\n",2); + return -1; + } + } else { + print_message("chmoded an non-existing file (which is a bad thing)\n",2); + return -1; + } + + +} + +int test_yaffs_fchmod_EINVAL_clean(void) +{ + if (handle >= 0) { + return yaffs_close(handle); + } + return test_yaffs_chmod(); +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h new file mode 100644 index 0000000..0c7e2dc --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_fchmod_EINVAL.h @@ -0,0 +1,27 @@ +/* + * 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_fchmod_EINVAL_h__ +#define __test_yaffs_fchmod_EINVAL_h__ + +#include "lib.h" +#include "yaffsfs.h" +#include "test_yaffs_open.h" +#include "test_yaffs_chmod.h" + +int test_yaffs_fchmod_EINVAL(void); +int test_yaffs_fchmod_EINVAL_clean(void); + +#endif -- 2.30.2