From 1d34c75c7f1f69ce5a746917b76d90c22e91ffe2 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Wed, 17 Nov 2010 13:45:53 +1300 Subject: [PATCH] yaffs Still hunting the bug. Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/Makefile | 4 +- direct/timothy_tests/quick_tests/README.txt | 11 ++++- direct/timothy_tests/quick_tests/lib.h | 2 + .../timothy_tests/quick_tests/quick_tests.h | 8 +++- .../quick_tests/test_yaffs_sync.c | 28 +++++++++++++ .../quick_tests/test_yaffs_sync.h | 25 +++++++++++ .../quick_tests/test_yaffs_sync_ENOTDIR.c | 41 +++++++++++++++++++ .../quick_tests/test_yaffs_sync_ENOTDIR.h | 25 +++++++++++ .../quick_tests/test_yaffs_unmount2.c | 27 ++++++++++++ .../quick_tests/test_yaffs_unmount2.h | 25 +++++++++++ 10 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_sync.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_sync.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.h create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_unmount2.c create mode 100644 direct/timothy_tests/quick_tests/test_yaffs_unmount2.h diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index 94614fb..dca2eed 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -67,7 +67,9 @@ 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_mount2.o \ + test_yaffs_unmount2.o \ + test_yaffs_sync.o diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt index 41efeee..5033e12 100644 --- a/direct/timothy_tests/quick_tests/README.txt +++ b/direct/timothy_tests/quick_tests/README.txt @@ -16,6 +16,8 @@ Tests made test_yaffs_mount_ENAMETOOLONG test_yaffs_mount_EBUSY //caused by trying to mount a new mount point with a mount point already mounted. + test_yaffs_mount2 + test_yaffs_access test_yaffs_access_ENIVAL test_yaffs_access_ENOTDIR @@ -86,6 +88,8 @@ Tests made test_yaffs_unmount_ENAMETOOLONG test_yaffs_umount_EBUSY //cause by having a file handle open and then trying to unmount yaffs. + test_yaffs_unmount2 + test_yaffs_write test_yaffs_write_EBADF @@ -124,7 +128,7 @@ Tests to add test_yaffs_symlink_EROFS - //the yaffs_mknod function does not exist in yaffsfs, so these tests will be ignored. + //the yaffs_mknod function does not exist in yaffsfs, so these tests will not be added. test_yaffs_mknod test_yaffs_mknod_EACCES test_yaffs_mknod_EEXIST @@ -135,13 +139,16 @@ Tests to add test_yaffs_mknod_ENOTDIR test_yaffs_mknod_EROFS - test_yaffs_mount2 + test_yaffs_mount2_EINVAL test_yaffs_mount2_ENOTDIR test_yaffs_mount2_ENOENT test_yaffs_mount2_ENODEV test_yaffs_mount2_ENAMETOOLONG + + 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 diff --git a/direct/timothy_tests/quick_tests/lib.h b/direct/timothy_tests/quick_tests/lib.h index 2906312..bf7001f 100644 --- a/direct/timothy_tests/quick_tests/lib.h +++ b/direct/timothy_tests/quick_tests/lib.h @@ -36,6 +36,8 @@ #define NODE_PATH "/yaffs2/node" + + /* warning do not define anything as FILE because there seems to be a conflict with stdio.h */ #define FILE_PATH "/yaffs2/foo" diff --git a/direct/timothy_tests/quick_tests/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 16776c1..0a6cf06 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -111,6 +111,10 @@ #include "test_yaffs_mount2.h" +#include "test_yaffs_unmount2.h" + +#include "test_yaffs_sync.h" + #include "yaffsfs.h" #include "yaffs_error_converter.h" #include "lib.h" @@ -217,9 +221,11 @@ test_template test_list[]={ {test_yaffs_symlink_EEXIST,test_yaffs_symlink_EEXIST_clean,"test_yaffs_symlink_EEXIST"}, {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"}, - {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"} + {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"}, + {test_yaffs_unmount2,test_yaffs_unmount2_clean,"test_yaffs_unmount2"}, + {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync.c b/direct/timothy_tests/quick_tests/test_yaffs_sync.c new file mode 100644 index 0000000..9f7b03e --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_sync.c @@ -0,0 +1,28 @@ +/* + * 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_sync.h" + + +int test_yaffs_sync(void) +{ + return yaffs_sync(FILE_PATH); + +} + + +int test_yaffs_sync_clean(void) +{ + return 1; +} + diff --git a/direct/timothy_tests/quick_tests/test_yaffs_sync.h b/direct/timothy_tests/quick_tests/test_yaffs_sync.h new file mode 100644 index 0000000..82a7c9c --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_sync.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_h__ +#define __test_yaffs_sync_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_sync(void); +int test_yaffs_sync_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_ENOTDIR.c new file mode 100644 index 0000000..97fb2b1 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_sync_ENOTDIR.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_sync_ENOTDIR.h" + + +int test_yaffs_sync_ENOTDIR(void) +{ + int output = yaffs_sync("non-existing-dir/foo"); + if (output<0){ + error_code=yaffs_get_error(); + if (abs(error_code)==ENOTDIR){ + 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_ENOTDIR_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_sync_ENOTDIR.h new file mode 100644 index 0000000..4b11cab --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_sync_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_sync_ENOTDIR_h__ +#define __test_yaffs_sync_ENOTDIR_h__ + +#include "lib.h" +#include "yaffsfs.h" + +int test_yaffs_sync_ENOTDIR(void); +int test_yaffs_sync_ENOTDIR_clean(void); + +#endif diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2.c b/direct/timothy_tests/quick_tests/test_yaffs_unmount2.c new file mode 100644 index 0000000..d0b1408 --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2.c @@ -0,0 +1,27 @@ +/* + * 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.h" + +int test_yaffs_unmount2(void) +{ + int output = -1; + + output = yaffs_unmount2(YAFFS_MOUNT_POINT,1); + return output; +} + +int test_yaffs_unmount2_clean(void) +{ + return test_yaffs_mount(); +} diff --git a/direct/timothy_tests/quick_tests/test_yaffs_unmount2.h b/direct/timothy_tests/quick_tests/test_yaffs_unmount2.h new file mode 100644 index 0000000..fc2e13b --- /dev/null +++ b/direct/timothy_tests/quick_tests/test_yaffs_unmount2.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_unmount2__ +#define __test_yaffs_unmount2__ + +#include "yaffsfs.h" +#include "lib.h" +#include "test_yaffs_mount.h" + +int test_yaffs_unmount2(void); +int test_yaffs_unmount2_clean(void); +#endif -- 2.30.2