From: Charles Manning Date: Sun, 21 Nov 2010 21:08:38 +0000 (+1300) Subject: Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2 X-Git-Tag: linux-mainline-patchset-4~70 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=41a1d28042b2fe3ca48a53de7c902389c7b51169;hp=af90cc3cb182162b1b3751eabbad81db084cedc2 Merge branch 'master' of ssh://aleph1.co.uk/home/aleph1/git/yaffs2 --- diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 0604e1d..c13265a 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -67,9 +67,16 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_mkdir.o test_yaffs_mkdir_EEXIST.o test_yaffs_mkdir_ENOTDIR.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_mount2.o \ - test_yaffs_unmount2.o \ - test_yaffs_sync.o test_yaffs_sync_ENOTDIR.o test_yaffs_sync_ENOENT.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\ + test_yaffs_sync.o test_yaffs_sync_ENODEV.o \ + test_yaffs_remount_force_off_read_only_off.o test_yaffs_remount_force_on_read_only_off.o test_yaffs_remount_ENODEV.o \ + test_yaffs_remount_EINVAL.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 diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt index 398512a..e19b94a 100644 --- a/direct/timothy_tests/quick_tests/README.txt +++ b/direct/timothy_tests/quick_tests/README.txt @@ -17,6 +17,7 @@ Tests made test_yaffs_mount_EBUSY //caused by trying to mount a new mount point with a mount point already mounted. test_yaffs_mount2 + test_yaffs_mount2_ENODEV //when a bad mount point is used. test_yaffs_access test_yaffs_access_ENIVAL @@ -28,6 +29,9 @@ Tests made test_yaffs_fdatasync test_yaffs_fdatasync_EBADF + test_yaffs_freespace + test_yaffs_freespace_EINVAL + test_yaffs_fsync test_yaffs_fsync_EBADF @@ -36,6 +40,14 @@ Tests made test_yaffs_ftruncate_ENIVAL test_yaffs_ftruncate_big_file + test_yaffs_inodecount + test_yaffs_inodecount_ENOTDIR + + test_yaffs_link + test_yaffs_link_EEXIST + test_yaffs_link_ENOENT + test_yaffs_link_ENOTDIR + test_yaffs_lseek test_yaffs_lseek_EBADF test_yaffs_lseek_EINVAL @@ -58,6 +70,7 @@ Tests made test_yaffs_mkdir_EEXISTS test_yaffs_mkdir_ENOTDIR + test_yaffs_stat test_yaffs_stat_ENOENT test_yaffs_stat_ENOTDIR @@ -73,6 +86,14 @@ Tests made test_yaffs_fstat test_yaffs_fstat_EBADF + test_yaffs_remount_force_off_read_only_off + test_yaffs_remount_force_on_read_only_off + test_yaffs_remount_ENODEV + test_yaffs_remount_EINVAL + + test_yaffs_totalspace + test_yaffs_totalspace_EINVAL + test_yaffs_truncate test_yaffs_truncate_ENOTDIR test_yaffs_truncate_EISDIR @@ -89,9 +110,13 @@ Tests made test_yaffs_unmount test_yaffs_unmount_ENODEV test_yaffs_unmount_ENAMETOOLONG - test_yaffs_umount_EBUSY //cause by having a file handle open and then trying to unmount yaffs. + test_yaffs_umount_EBUSY //caused by having a file handle open and then trying to unmount yaffs. test_yaffs_unmount2 + test_yaffs_unmount2_ENODEV + test_yaffs_unmount2_with handle open and forced mode on + test_yaffs_unmount2_with handle open and forced mode off. should give EBUSY. + test_yaffs_unmount2_EINVAL //should be caused when the file system is alredy unmounted. test_yaffs_write test_yaffs_write_EBADF @@ -143,41 +168,28 @@ Tests to add test_yaffs_mknod_EROFS - test_yaffs_mount2_EINVAL - test_yaffs_mount2_ENOTDIR - test_yaffs_mount2_ENOENT - test_yaffs_mount2_ENODEV + test_yaffs_mount2_EINVAL //cannot happen in yaffs since the mode is not checked. + test_yaffs_mount2_ENOTDIR //cannot be generated in yaffs. + test_yaffs_mount2_ENOENT //cannot be generated in yaffs. test_yaffs_mount2_ENAMETOOLONG + test_yaffs_mount2_with read only set - test_yaffs_unmount2_with handle open and forced mode on - test_yaffs_unmount2_with handle open and forced mode off. should give EBUSY. - test_yaffs_unmount2 - test_yaffs_unmount2_ENOENT - test_yaffs_unmount2_ENOTDIR - test_yaffs_unmount2_ENODEV - test_yaffs_unmount2_EINVAL - test_yaffs_remount2 - test_yaffs_remount2_ENOENT - test_yaffs_remount2_ENOTDIR - test_yaffs_remount2_ENODEV - test_yaffs_remount2_EINVAL - - - test_yaffs_sync_ENOENT + test_yaffs_unmount2_ENOENT //cannot be generated in yaffs. + test_yaffs_unmount2_ENOTDIR //cannot be generated in yaffs. + test_yaffs_unmount2_ENAMETOOLONG + - test_yaffs_freespace - test_yaffs_freespace_ENOENT - test_yaffs_freespace_ENOTDIR + test_yaffs_remount_force_off_read_only_on + test_yaffs_remount_force_on_read_only_on + test_yaffs_remount_ENOENT //cannot be generated in yaffs + test_yaffs_remount_ENOTDIR //cannot be generated in yaffs - test_yaffs_totalspace - test_yaffs_totalspace_ENOTDIR - test_yaffs_totalspace_ENOENT - test_yaffs_inodecount - test_yaffs_inodecount_ENOTDIR - test_yaffs_inodecount_ENOENT + test_yaffs_freespace_ENAMETOOLONG + test_yaffs_totalspace_ENAMETOOLONG + test_yaffs_inodecount_ENAMETOOLONG test_yaffs_opendir @@ -187,14 +199,12 @@ Tests to add test_yaffs_closedir - test_yaffs_link + test_yaffs_link_EACCES - test_yaffs_link_EEXISTS + test_yaffs_link_ELOOP test_yaffs_link_EMLINK //should not happen on yaffs test_yaffs_link_ENAMETOOLONG - test_yaffs_link_ENOENT - test_yaffs_link_ENOTDIR test_yaffs_link_EPERM test_yaffs_link_EROFS diff --git a/direct/timothy_tests/quick_tests/lib.h b/direct/timothy_tests/quick_tests/lib.h index bf7001f..dec04bf 100644 --- a/direct/timothy_tests/quick_tests/lib.h +++ b/direct/timothy_tests/quick_tests/lib.h @@ -34,6 +34,8 @@ #define SYMLINK_PATH "/yaffs2/sym_foo" +#define HARD_LINK_PATH "/yaffs2/hard_link" + #define NODE_PATH "/yaffs2/node" diff --git a/direct/timothy_tests/quick_tests/quick_tests.c b/direct/timothy_tests/quick_tests/quick_tests.c index a943f4d..79a7aae 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.c +++ b/direct/timothy_tests/quick_tests/quick_tests.c @@ -89,7 +89,7 @@ void quit_quick_tests(int exit_code) char message[30]; message[0]='\0'; if (num_of_tests_pass==total_number_of_tests && num_of_tests_failed==0){ - printf("\t OK \n"); + printf("\t OK --all tests passed\n"); } printf("out of %d tests, %d ran: %d passed and %d failed\n\n\n", total_number_of_tests,(num_of_tests_pass+num_of_tests_failed) ,num_of_tests_pass,num_of_tests_failed); yaffs_unmount(YAFFS_MOUNT_POINT); diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 5d41e80..2135663 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -110,13 +110,36 @@ #include "test_yaffs_symlink_ENOENT.h" #include "test_yaffs_mount2.h" +#include "test_yaffs_mount2_ENODEV.h" #include "test_yaffs_unmount2.h" +#include "test_yaffs_unmount2_ENODEV.h" +#include "test_yaffs_unmount2_EINVAL.h" +#include "test_yaffs_unmount2_with_handle_open_and_forced_mode_on.h" +#include "test_yaffs_unmount2_with_handle_open_and_forced_mode_off.h" #include "test_yaffs_sync.h" -#include "test_yaffs_sync_ENOTDIR.h" -#include "test_yaffs_sync_ENOENT.h" +#include "test_yaffs_sync_ENODEV.h" +#include "test_yaffs_remount_force_off_read_only_off.h" +#include "test_yaffs_remount_force_on_read_only_off.h" +#include "test_yaffs_remount_ENODEV.h" +#include "test_yaffs_remount_EINVAL.h" + +#include "test_yaffs_freespace.h" +#include "test_yaffs_freespace_EINVAL.h" + +#include "test_yaffs_totalspace.h" +#include "test_yaffs_totalspace_EINVAL.h" + +#include "test_yaffs_inodecount.h" +#include "test_yaffs_inodecount_EINVAL.h" + +#include "test_yaffs_link.h" +#include "test_yaffs_link_ENOENT.h" +#include "test_yaffs_link_EEXIST.h" +#include "test_yaffs_link_ENOTDIR.h" +#include "test_yaffs_link_ENOTDIR2.h" #include "yaffsfs.h" #include "yaffs_error_converter.h" @@ -171,7 +194,7 @@ test_template test_list[]={ {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, {test_yaffs_lseek_EBADF,test_yaffs_lseek_EBADF_clean,"test_yaffs_lseek_EBADF"}, {test_yaffs_lseek_EINVAL,test_yaffs_lseek_EINVAL_clean,"test_yaffs_lseek_EINVAL"}, - {test_yaffs_lseek_big_file,test_yaffs_lseek_big_file_clean,"test_yaffs_lseek_big_file"}, +// {test_yaffs_lseek_big_file,test_yaffs_lseek_big_file_clean,"test_yaffs_lseek_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled. {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"}, {test_yaffs_write_EBADF,test_yaffs_write_EBADF_clean,"test_yaffs_write_EBADF"}, @@ -198,7 +221,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_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"}, +// {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"}, {test_yaffs_chmod_ENOENT,test_yaffs_chmod_ENOENT_clean,"test_yaffs_chmod_ENOENT"}, @@ -225,14 +248,38 @@ test_template test_list[]={ {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"}, {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"}, + {test_yaffs_mount2_ENODEV,test_yaffs_mount2_ENODEV_clean,"test_yaffs_mount2_ENODEV"}, + {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_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"}, - {test_yaffs_sync_ENOTDIR,test_yaffs_sync_ENOTDIR_clean,"test_yaffs_sync_ENOTDIR"}, - {test_yaffs_sync_ENOENT,test_yaffs_sync_ENOENT_clean,"test_yaffs_sync_ENOENT"} + {test_yaffs_sync_ENODEV,test_yaffs_sync_ENODEV_clean,"test_yaffs_sync_ENODEV"}, + + + + {test_yaffs_remount_force_off_read_only_off,test_yaffs_remount_force_off_read_only_off_clean,"test_yaffs_remount_force_off_read_only_off"}, +{test_yaffs_remount_force_on_read_only_off,test_yaffs_remount_force_on_read_only_off_clean,"test_yaffs_remount_force_on_read_only_off"}, + {test_yaffs_remount_ENODEV,test_yaffs_remount_ENODEV_clean,"test_yaffs_remount_ENODEV"}, + {test_yaffs_remount_EINVAL,test_yaffs_remount_EINVAL_clean,"test_yaffs_remount_EINVAL"}, + + {test_yaffs_freespace,test_yaffs_freespace_clean,"test_yaffs_freespace"}, + {test_yaffs_freespace_EINVAL,test_yaffs_freespace_EINVAL_clean,"test_yaffs_freespace_EINVAL"}, + + {test_yaffs_totalspace,test_yaffs_totalspace_clean,"test_yaffs_totalspace"}, + {test_yaffs_totalspace_EINVAL,test_yaffs_totalspace_EINVAL_clean,"test_yaffs_totalspace_EINVAL"}, + {test_yaffs_inodecount,test_yaffs_inodecount_clean,"test_yaffs_inodecount"}, + {test_yaffs_inodecount_EINVAL,test_yaffs_inodecount_EINVAL_clean,"test_yaffs_inodecount_EINVAL"}, + {test_yaffs_link,test_yaffs_link_clean,"test_yaffs_link"}, + {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"} }; diff --git a/direct/timothy_tests/quick_tests/test_yaffs_freespace.c b/direct/timothy_tests/quick_tests/test_yaffs_freespace.c new file mode 100644 index 0000000..8d714d8 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_freespace.c @@ -0,0 +1,30 @@ +/* + * 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_freespace.h" + + + +int test_yaffs_freespace(void) +{ + int output=0; + output = yaffs_freespace(YAFFS_MOUNT_POINT); + return output; +} + + +int test_yaffs_freespace_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_freespace.h similarity index 79% rename from direct/timothy_tests/quick_tests/test_yaffs_sync_ENOENT.h rename to direct/timothy_tests/quick_tests/test_yaffs_freespace.h index 55cf61b..8644be7 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOENT.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_freespace.h @@ -13,13 +13,13 @@ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ -#ifndef __test_yaffs_sync_ENOENT_h__ -#define __test_yaffs_sync_ENOENT_h__ +#ifndef __test_yaffs_freespace_h__ +#define __test_yaffs_freespace_h__ #include "lib.h" #include "yaffsfs.h" -int test_yaffs_sync_ENOENT(void); -int test_yaffs_sync_ENOENT_clean(void); +int test_yaffs_freespace(void); +int test_yaffs_freespace_clean(void); #endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_freespace_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_freespace_EINVAL.c new file mode 100644 index 0000000..29f3cd0 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_freespace_EINVAL.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_freespace_EINVAL.h" + + + +int test_yaffs_freespace_EINVAL(void) +{ + int output=0; + int error=0; + output = yaffs_freespace("non-existing-mount-point"); + 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("got the free space of a non existing mountpoint (which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_freespace_EINVAL_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_freespace_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_freespace_EINVAL.h new file mode 100644 index 0000000..068664b --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_freespace_EINVAL.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_freespace_EINVAL_h__ +#define __test_yaffs_freespace_EINVAL_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_freespace_EINVAL(void); +int test_yaffs_freespace_EINVAL_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_inodecount.c b/direct/timothy_tests/quick_tests/test_yaffs_inodecount.c new file mode 100644 index 0000000..7fe80f6 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_inodecount.c @@ -0,0 +1,30 @@ +/* + * 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_inodecount.h" + + + +int test_yaffs_inodecount(void) +{ + int output=0; + output = yaffs_inodecount(YAFFS_MOUNT_POINT); + return output; +} + + +int test_yaffs_inodecount_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_inodecount.h similarity index 78% rename from direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h rename to direct/timothy_tests/quick_tests/test_yaffs_inodecount.h index 4b11cab..8db7c7f 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h +++ b/direct/timothy_tests/quick_tests/test_yaffs_inodecount.h @@ -13,13 +13,13 @@ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL. */ -#ifndef __test_yaffs_sync_ENOTDIR_h__ -#define __test_yaffs_sync_ENOTDIR_h__ +#ifndef __test_yaffs_inodecount_h__ +#define __test_yaffs_inodecount_h__ #include "lib.h" #include "yaffsfs.h" -int test_yaffs_sync_ENOTDIR(void); -int test_yaffs_sync_ENOTDIR_clean(void); +int test_yaffs_inodecount(void); +int test_yaffs_inodecount_clean(void); #endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_inodecount_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_inodecount_EINVAL.c new file mode 100644 index 0000000..36ae0d9 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_inodecount_EINVAL.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_inodecount_EINVAL.h" + + + +int test_yaffs_inodecount_EINVAL(void) +{ + int output=0; + int error=0; + output = yaffs_inodecount("non-existing-mount-point"); + 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("got the inodecount of a non existing mountpoint (which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_inodecount_EINVAL_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_inodecount_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_inodecount_EINVAL.h new file mode 100644 index 0000000..16e1858 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_inodecount_EINVAL.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_inodecount_EINVAL_h__ +#define __test_yaffs_inodecount_EINVAL_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_inodecount_EINVAL(void); +int test_yaffs_inodecount_EINVAL_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link.c b/direct/timothy_tests/quick_tests/test_yaffs_link.c new file mode 100644 index 0000000..5a88c40 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link.c @@ -0,0 +1,44 @@ +/* + * 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.h" + + + +int test_yaffs_link(void) +{ + int output=0; + output = yaffs_link(FILE_PATH,HARD_LINK_PATH); + return output; +} + + +int test_yaffs_link_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.h b/direct/timothy_tests/quick_tests/test_yaffs_link.h new file mode 100644 index 0000000..ec6630f --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link.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_h__ +#define __test_yaffs_link_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link(void); +int test_yaffs_link_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_EEXIST.c b/direct/timothy_tests/quick_tests/test_yaffs_link_EEXIST.c new file mode 100644 index 0000000..848c9b4 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_EEXIST.c @@ -0,0 +1,63 @@ +/* + * 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_EEXIST.h" + + + +int test_yaffs_link_EEXIST(void) +{ + int output=0; + int error =0; + + output = yaffs_link(FILE_PATH,HARD_LINK_PATH); + if (output<0){ + print_message("failed to create the first hard link\n",2); + return -1; + } + + output = yaffs_link(FILE_PATH,HARD_LINK_PATH); + if (output<0){ + error=yaffs_get_error(); + if (abs(error)==EEXIST){ + return 1; + } else { + print_message("different error than expected\n",2); + return -1; + } + } else { + print_message("created a hard link to a non-existing-file (which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_link_EEXIST_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_EEXIST.h b/direct/timothy_tests/quick_tests/test_yaffs_link_EEXIST.h new file mode 100644 index 0000000..afb32a2 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_EEXIST.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_EEXIST_h__ +#define __test_yaffs_link_EEXIST_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_EEXIST(void); +int test_yaffs_link_EEXIST_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT.c new file mode 100644 index 0000000..4c109b1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT.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_ENOENT.h" + + + +int test_yaffs_link_ENOENT(void) +{ + int output=0; + int error =0; + output = yaffs_link("/yaffs2/non-existing-file",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-file (which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_link_ENOENT_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_ENOENT.h b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOENT.h new file mode 100644 index 0000000..5603901 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_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_link_ENOENT_h__ +#define __test_yaffs_link_ENOENT_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_ENOENT(void); +int test_yaffs_link_ENOENT_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 new file mode 100644 index 0000000..333c7a7 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.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_ENOTDIR.h" + + + +int test_yaffs_link_ENOTDIR(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)==ENOTDIR){ + 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_ENOTDIR_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_ENOTDIR.h b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.h new file mode 100644 index 0000000..7b0b537 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR.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_ENOTDIR_h__ +#define __test_yaffs_link_ENOTDIR_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_ENOTDIR(void); +int test_yaffs_link_ENOTDIR_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.c b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.c new file mode 100644 index 0000000..754acc2 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.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_ENOTDIR2.h" + + + +int test_yaffs_link_ENOTDIR2(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)==ENOTDIR){ + 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_ENOTDIR2_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_ENOTDIR2.h b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.h new file mode 100644 index 0000000..bafee35 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_link_ENOTDIR2.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_ENOTDIR2_h__ +#define __test_yaffs_link_ENOTDIR2_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_link_ENOTDIR2(void); +int test_yaffs_link_ENOTDIR2_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount2_ENODEV.c b/direct/timothy_tests/quick_tests/test_yaffs_mount2_ENODEV.c new file mode 100644 index 0000000..92a1e74 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mount2_ENODEV.c @@ -0,0 +1,55 @@ +/* + * 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_mount2_ENODEV.h" + +int test_yaffs_mount2_ENODEV(void) +{ + int output = -1; + int error_code =0; + output= yaffs_unmount(YAFFS_MOUNT_POINT); + if (output < 0) { + print_message("failed to unmount current_mountpoint\n",2); + return -1; + } + + output = yaffs_mount2("/non-existing-dir/mountpoint",255); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == ENODEV){ + return 1; + } else { + print_message("different_error than expected\n",2); + return -1; + } + } else { + print_message("mounted a non-existing mountpoint\n",2); + return -1; + } +} + +int test_yaffs_mount2_ENODEV_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_mount2_ENODEV.h b/direct/timothy_tests/quick_tests/test_yaffs_mount2_ENODEV.h new file mode 100644 index 0000000..dfaec01 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_mount2_ENODEV.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_mount2_ENODEV__ +#define __test_yaffs_mount2_ENODEV__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_mount2_ENODEV(void); +int test_yaffs_mount2_ENODEV_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_remount_EINVAL.c new file mode 100644 index 0000000..1f89ee7 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_EINVAL.c @@ -0,0 +1,55 @@ +/* + * 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_remount_EINVAL.h" + +int test_yaffs_remount_EINVAL(void) +{ + int output = -1; + int error_code =0; + output = yaffs_unmount(YAFFS_MOUNT_POINT); + if (output<0){ + print_message("failed to unmount mount point\n",2); + return -1; + } + + output = yaffs_remount(YAFFS_MOUNT_POINT,0,0); + if (output<0){ + error_code = yaffs_get_error(); + if (abs(error_code) == EINVAL){ + return 1; + } else { + print_message("returned error does not match the the expected error\n",2); + return -1; + } + } else { + print_message("remounted a non-existing-dir\n",2); + return -1; + } +} + +int test_yaffs_remount_EINVAL_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_remount_EINVAL.h new file mode 100644 index 0000000..b425da4 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_EINVAL.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_remount_EINVAL__ +#define __test_yaffs_remount_EINVAL__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_remount_EINVAL(void); +int test_yaffs_remount_EINVAL_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_ENODEV.c b/direct/timothy_tests/quick_tests/test_yaffs_remount_ENODEV.c new file mode 100644 index 0000000..813de5c --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_ENODEV.c @@ -0,0 +1,51 @@ +/* + * 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_remount_ENODEV.h" + +int test_yaffs_remount_ENODEV(void) +{ + int output = -1; + int error_code =0; + + + output = yaffs_remount("non-existing-mount-point",0,0); + if (output<0){ + error_code = yaffs_get_error(); + if (abs(error_code) == ENODEV){ + return 1; + } else { + print_message("returned error does not match the the expected error\n",2); + return -1; + } + } else { + print_message("remounted a non-existing-dir\n",2); + return -1; + } +} + +int test_yaffs_remount_ENODEV_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_ENODEV.h b/direct/timothy_tests/quick_tests/test_yaffs_remount_ENODEV.h new file mode 100644 index 0000000..d37a5a1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_ENODEV.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_remount_ENODEV__ +#define __test_yaffs_remount_ENODEV__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_remount_ENODEV(void); +int test_yaffs_remount_ENODEV_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOENT.c b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.c similarity index 55% rename from direct/timothy_tests/quick_tests/test_yaffs_sync_ENOENT.c rename to direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.c index 2f1792d..e86f923 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOENT.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.c @@ -11,33 +11,35 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_sync_ENOENT.h" +#include "test_yaffs_remount_force_off_read_only_off.h" +int test_yaffs_remount_force_off_read_only_off(void) +{ + int output = -1; + int error_code =0; + + + output = yaffs_remount(YAFFS_MOUNT_POINT,0,0); + if (output>=0){ + return 1; + } else { + print_message("failed to remount\n",2); + return -1; + } +} -int test_yaffs_sync_ENOENT(void) +int test_yaffs_remount_force_off_read_only_off_clean(void) { - int error_code=-1; - int output = yaffs_sync("yaffs2/non-existing-file"); - + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); if (output<0){ error_code=yaffs_get_error(); - if (abs(error_code)==ENOENT){ + if (abs(error_code) == EBUSY){ return 1; } else { - print_message("returned error does not match the the expected error\n",2); return -1; } - } else { - print_message("synced a file in a non-existing directory (which is a bad thing)\n",2); - return -1; - } - - -} - - -int test_yaffs_sync_ENOENT_clean(void) -{ + } return 1; } - diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.h b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.h new file mode 100644 index 0000000..6772e7d --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.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_remount_force_off_read_only_off__ +#define __test_yaffs_remount_force_off_read_only_off__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_remount_force_off_read_only_off(void); +int test_yaffs_remount_force_off_read_only_off_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_on.c b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_on.c new file mode 100644 index 0000000..fbb37c1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_on.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_remount.h" + +int test_yaffs_remount(void) +{ + int output = -1; + int error_code =0; + output=test_yaffs_open(); + if (output<0) { + print_message("failed to open file\n",2); + return -1; + } + + output = yaffs_remount(YAFFS_MOUNT_POINT,1,0); + if (output>=0){ + return 1; + } else { + print_message("failed to unmount with a open file with the force mode set\n",2); + return -1; + } +} + +int test_yaffs_remount_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_on.h b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_on.h new file mode 100644 index 0000000..7574695 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_on.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_unmount2_with_handle_open_and_forced_mode_on__ +#define __test_yaffs_unmount2_with_handle_open_and_forced_mode_on__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on(void); +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.c b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.c new file mode 100644 index 0000000..64dcfd7 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.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_remount_force_on_read_only_off.h" + +int test_yaffs_remount_force_on_read_only_off(void) +{ + int output = -1; + int error_code =0; + output=test_yaffs_open(); + if (output<0) { + print_message("failed to open file\n",2); + return -1; + } + + output = yaffs_remount(YAFFS_MOUNT_POINT,1,0); + if (output>=0){ + return 1; + } else { + print_message("failed to unmount with a open file with the force mode set\n",2); + return -1; + } +} + +int test_yaffs_remount_force_on_read_only_off_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.h b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.h new file mode 100644 index 0000000..00646fb --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.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_remount_force_on_read_only_off__ +#define __test_yaffs_remount_force_on_read_only_off__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_remount_force_on_read_only_off(void); +int test_yaffs_remount_force_on_read_only_off_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_on.c b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_on.c new file mode 100644 index 0000000..fbb37c1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_on.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_remount.h" + +int test_yaffs_remount(void) +{ + int output = -1; + int error_code =0; + output=test_yaffs_open(); + if (output<0) { + print_message("failed to open file\n",2); + return -1; + } + + output = yaffs_remount(YAFFS_MOUNT_POINT,1,0); + if (output>=0){ + return 1; + } else { + print_message("failed to unmount with a open file with the force mode set\n",2); + return -1; + } +} + +int test_yaffs_remount_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_on.h b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_on.h new file mode 100644 index 0000000..7574695 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_on.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_unmount2_with_handle_open_and_forced_mode_on__ +#define __test_yaffs_unmount2_with_handle_open_and_forced_mode_on__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on(void); +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENODEV.c similarity index 84% rename from direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c rename to direct/timothy_tests/quick_tests/test_yaffs_sync_ENODEV.c index 0961af2..90ae4a4 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENODEV.c @@ -11,17 +11,17 @@ * published by the Free Software Foundation. */ -#include "test_yaffs_sync_ENOTDIR.h" +#include "test_yaffs_sync_ENODEV.h" -int test_yaffs_sync_ENOTDIR(void) +int test_yaffs_sync_ENODEV(void) { int error_code=-1; int output = yaffs_sync("non-existing-dir/foo"); if (output<0){ error_code=yaffs_get_error(); - if (abs(error_code)==ENOTDIR){ + if (abs(error_code)==ENODEV){ return 1; } else { print_message("returned error does not match the the expected error\n",2); @@ -36,7 +36,7 @@ int test_yaffs_sync_ENOTDIR(void) } -int test_yaffs_sync_ENOTDIR_clean(void) +int test_yaffs_sync_ENODEV_clean(void) { return 1; } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync_ENODEV.h b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENODEV.h new file mode 100644 index 0000000..e3aec49 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENODEV.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_sync_ENODEV_h__ +#define __test_yaffs_sync_ENODEV_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_sync_ENODEV(void); +int test_yaffs_sync_ENODEV_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_totalspace.c b/direct/timothy_tests/quick_tests/test_yaffs_totalspace.c new file mode 100644 index 0000000..c3e054b --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_totalspace.c @@ -0,0 +1,30 @@ +/* + * 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_totalspace.h" + + + +int test_yaffs_totalspace(void) +{ + int output=0; + output = yaffs_totalspace(YAFFS_MOUNT_POINT); + return output; +} + + +int test_yaffs_totalspace_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_totalspace.h b/direct/timothy_tests/quick_tests/test_yaffs_totalspace.h new file mode 100644 index 0000000..f2ec0af --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_totalspace.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_totalspace_h__ +#define __test_yaffs_totalspace_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_totalspace(void); +int test_yaffs_totalspace_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_totalspace_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_totalspace_EINVAL.c new file mode 100644 index 0000000..b4f0c52 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_totalspace_EINVAL.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_totalspace_EINVAL.h" + + + +int test_yaffs_totalspace_EINVAL(void) +{ + int output=0; + int error=0; + output = yaffs_totalspace("non-existing-mount-point"); + 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("got the totalspace of a non existing mountpoint (which is a bad thing)\n",2); + return -1; + } +} + + +int test_yaffs_totalspace_EINVAL_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_totalspace_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_totalspace_EINVAL.h new file mode 100644 index 0000000..4f64395 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_totalspace_EINVAL.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_totalspace_EINVAL_h__ +#define __test_yaffs_totalspace_EINVAL_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_totalspace_EINVAL(void); +int test_yaffs_totalspace_EINVAL_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_EINVAL.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_EINVAL.c new file mode 100644 index 0000000..cafc508 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_EINVAL.c @@ -0,0 +1,55 @@ +/* + * 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_unmount2_EINVAL.h" + +int test_yaffs_unmount2_EINVAL(void) +{ + int output = -1; + int error_code =0; + output=yaffs_unmount(YAFFS_MOUNT_POINT); + if (output<0){ + print_message("failed to unmount the mount poin the first time\n",2); + return -1; + } + + output = yaffs_unmount2(YAFFS_MOUNT_POINT,255); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EINVAL){ + return 1; + } else { + print_message("different_error than expected\n",2); + return -1; + } + } else { + print_message("unmounted a non-existing mountpoint\n",2); + return -1; + } +} + +int test_yaffs_unmount2_EINVAL_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_EINVAL.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_EINVAL.h new file mode 100644 index 0000000..b698dff --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_EINVAL.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_unmount2_EINVAL__ +#define __test_yaffs_unmount2_EINVAL__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_unmount2_EINVAL(void); +int test_yaffs_unmount2_EINVAL_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_ENODEV.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_ENODEV.c new file mode 100644 index 0000000..4311438 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_ENODEV.c @@ -0,0 +1,50 @@ +/* + * 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_unmount2_ENODEV.h" + +int test_yaffs_unmount2_ENODEV(void) +{ + int output = -1; + int error_code =0; + + output = yaffs_unmount2("/non-existing-dir/",255); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == ENODEV){ + return 1; + } else { + print_message("different_error than expected\n",2); + return -1; + } + } else { + print_message("unmounted a non-existing mountpoint\n",2); + return -1; + } +} + +int test_yaffs_unmount2_ENODEV_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_ENODEV.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_ENODEV.h new file mode 100644 index 0000000..dc2b1fa --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_ENODEV.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_unmount2_ENODEV__ +#define __test_yaffs_unmount2_ENODEV__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_unmount2_ENODEV(void); +int test_yaffs_unmount2_ENODEV_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.c new file mode 100644 index 0000000..982f2bd --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.c @@ -0,0 +1,55 @@ +/* + * 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_unmount2_with_handle_open_and_forced_mode_off.h" + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_off(void) +{ + int output = -1; + int error_code =0; + output=test_yaffs_open(); + if (output<0) { + print_message("failed to open file\n",2); + return -1; + } + + output = yaffs_unmount2(YAFFS_MOUNT_POINT,0); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + print_message("different_error than expected\n",2); + return -1; + } + } else { + print_message("unmounted with a open file and force mode off.\n",2); + return -1; + } +} + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_off_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.h new file mode 100644 index 0000000..e60f117 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.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_unmount2_with_handle_open_and_forced_mode_off__ +#define __test_yaffs_unmount2_with_handle_open_and_forced_mode_off__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_off(void); +int test_yaffs_unmount2_with_handle_open_and_forced_mode_off_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.c new file mode 100644 index 0000000..b7f7c12 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.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_unmount2_with_handle_open_and_forced_mode_on.h" + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on(void) +{ + int output = -1; + int error_code =0; + output=test_yaffs_open(); + if (output<0) { + print_message("failed to open file\n",2); + return -1; + } + + output = yaffs_unmount2(YAFFS_MOUNT_POINT,1); + if (output>=0){ + return 1; + } else { + print_message("failed to unmount with a open file with the force mode set\n",2); + return -1; + } +} + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean(void) +{ + int output=0; + int error_code =0; + output= yaffs_mount(YAFFS_MOUNT_POINT); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code) == EBUSY){ + return 1; + } else { + return -1; + } + } + return 1; +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.h new file mode 100644 index 0000000..7574695 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.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_unmount2_with_handle_open_and_forced_mode_on__ +#define __test_yaffs_unmount2_with_handle_open_and_forced_mode_on__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_unmount.h" + +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on(void); +int test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean(void); + +#endif