test_yaffs_read.o \
test_yaffs_lseek.o \
test_yaffs_access.o \
- test_yaffs_stat.o
+ test_yaffs_stat.o \
+ test_yaffs_close_EBADF.o
YAFFSTESTOBJS = $(COMMONTESTOBJS) $(TESTFILES)
--- /dev/null
+
+Made by Timothy Manning <timothy@yaffs.net> on 04/11/2010
+
+
+
+
+How to add a test
+ First create the test .c and .h file.
+ The file name and test function name should be the same.
+ This name should follow one of these formats:
+ Test_yaffs_[function of yaffs which is been tested]
+ Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated]
+
+ The .c file needs to contain two functions.
+ The first function needs to contain the code for the main test and will return -1 on a failure and 0 or greater on a success.
+ The second function needs contain the code for cleaning up after the test. Cleaning up may include closing some open handles, recreating a file, ect.
+ This second function needs to return -1 on a failure and 0 or greater on success.
+
+ The name of first function needs to be called the same as the file name (without the .c or .h)
+ The second function's name needs be the same as the first function but with "_clean" added on the end.
+
+ So if a test is been created for the yaffs function yaffs_fish() then create these files
+ Test_yaffs_fish.c
+ Contains int test_yaffs_fish(void); int test_yaffs_fish_clean(void);
+ Test_yaffs_fish.h
+ Which includes "lib.h", "yaffsfs.h" header files.
+
+ Next write the test code in these files then add these files to the Makefile.
+
+ Add the name of the test files' object file (test_yaffs_fish.o ) to the TESTFILES tag around line 50 of the Makefile.
+
+
+
+ Now add the test functions to the test_list[] array in quick_tests.h
+ The order of the tests matters. The idea is to test each yaffs_function individualy and only using tested yaffs_components before using this new yaffs_function.
+ This array consists of: {[test function], [the clean function], [name of the tests which will be printed when the test fails]},
+
+ So add this line to the test_list[]: {test_yaffs_fish, test_yaffs_fish_clean, "test_yaffs_fish"},
+
+ Also include the test's .h file in the quick_test.h file: #include "test_yaffs_fish.h"
+
+ The test file should now make and run.
+
+
+
+
+
+
+ PS: yaffs_fish() is a made up function for this README (in case you want to try and find this function in yaffs).
+
+
+BUGS
+ Needing to include int random_seed; and int simulate_power_failure = 0; in any main program using yaffsfs.h
+ ENOSPC error in programs test_yaffs_open_ENOTDIR and test_yaffs_open_ENOENT.
+ ENOENT been returned by yaffs_read but the handle is good and the yaffs_open function does not return an error.
+
+
+
+
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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 "lib.h"
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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 _lib_h__
#define _lib_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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 "quick_tests.h"
-typedef struct test {
- int (*p_function)(void); /*pointer to test function*/
- int (*p_function_clean)(void);
- /*char pass_message[50]; will not need a pass message*/
- char *fail_message; /*pointer to fail message, needs to include name of test*/
-}test_template;
-
-
-int dummy_test_pass(void){
- //printf("running dummy_test_pass\n");
- return 1;
-}
-void dummy_test_pass_clean(void){
-
-}
-int dummy_test_fail(void){
- //printf("running dummy_test_fail\n");
- return -1;
-}
-void dummy_test_fail_clean(void){
-}
-test_template test_list[]={
- //{dummy_test_pass,dummy_test_pass_clean,"dummy_test_pass"},
- //{dummy_test_fail,dummy_test_fail_clean,"dummy_test_fail"},
- {mount_yaffs_test,mount_yaffs_test_clean,"mount_yaffs_test"},
- {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"},
- {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"},
- {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"},
- {test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"},
- {test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"},
-
- {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"},
- {test_yaffs_unlinking, test_yaffs_unlinking_clean,"test_yaffs_unlinking"},
-
- {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
- {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
- {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
-
-
- {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
- {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
- {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"}
- };
-unsigned int num_of_tests_pass=0;
-unsigned int num_of_tests_failed=0;
-unsigned int total_number_of_tests=(sizeof(test_list)/sizeof(test_template));
+static unsigned int num_of_tests_pass=0;
+static unsigned int num_of_tests_failed=0;
+static unsigned int total_number_of_tests=(sizeof(test_list)/sizeof(test_template));
int main(){
int output=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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 __quick_tests_h__
#define __quick_tests_h__
#include <stdio.h>
#include "test_mount_yaffs.h"
+
#include "test_yaffs_open.h"
#include "test_yaffs_open_EISDIR.h"
#include "test_yaffs_open_EEXIST.h"
#include "test_yaffs_open_ENOENT.h"
#include "test_yaffs_open_ENOTDIR.h"
+
+#include "test_yaffs_close_EBADF.h"
+
+
#include "test_yaffs_unlinking.h"
#include "test_yaffs_ftruncate.h"
#include "test_yaffs_truncate.h"
#include "yaffs_error_converter.h"
#include "lib.h"
+typedef struct test {
+ int (*p_function)(void); /*pointer to test function*/
+ int (*p_function_clean)(void);
+ /*char pass_message[50]; will not need a pass message*/
+ char *fail_message; /*pointer to fail message, needs to include name of test*/
+}test_template;
+
+
+test_template test_list[]={
+ {mount_yaffs_test,mount_yaffs_test_clean,"mount_yaffs_test"},
+ {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"},
+ {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"},
+ {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"},
+// {test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"},
+// {test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"},
+
+ {test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
+
+ {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"},
+ {test_yaffs_unlinking, test_yaffs_unlinking_clean,"test_yaffs_unlinking"},
+
+ {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
+ {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
+ {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
+
+
+ {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
+ {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
+ {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"}
-#define YAFFS_MOUNT_POINT "/yaffs2/"
+ };
void init_quick_tests(void);
-int dummy_test_pass(void);
-int dummy_test_fail(void);
void quit_quick_tests(int exit_code);
#endif
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_mount_yaffs.h"
-#include "yaffsfs.h"
-#include "lib.h"
int mount_yaffs_test(void){
int output=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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 __mount_yaffs_test__
#define __mount_yaffs_test__
+#include "yaffsfs.h"
+#include "lib.h"
int mount_yaffs_test(void);
int mount_yaffs_test_clean(void);
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.h"
int test_yaffs_access(void){
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_h__
#define __test_yaffs_access_h__
#include "lib.h"
--- /dev/null
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.
+ */
+
+/* generates a EBADF error by closing a handle twice */
+
+#include "test_yaffs_open.h"
+
+static int handle=0;
+
+int test_yaffs_close_EBADF(void){
+ int output=0;
+ int error_code=0;
+ handle=test_yaffs_open();
+ if (handle>=0){
+ output=yaffs_close(handle);
+ if (output>=0){
+ output=yaffs_close(handle);
+ if (output<0){
+ /*error has happened */
+ error_code=yaffs_get_error();
+ printf("EEXIST def %d, Error code %d\n",(- EBADF),error_code);
+ if (abs(error_code)== EBADF){
+ return 1;
+ }
+ else {
+ printf("different error than expected\n");
+ return -1;
+ }
+ }
+ else {
+ printf("closed the same handle twice. (which is a bad thing)\n");
+ return -1;
+ }
+ }
+ else {
+ printf("failed to close the handle the firs time\n");
+ return -1;
+ }
+ }
+ else {
+ printf("failed to open file\n");
+ return -1;
+ }
+
+}
+
+
+int test_yaffs_close_EBADF_clean(void){
+ /* there is nothing that needs to be recreated */
+ return 1;
+}
+
--- /dev/null
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_close_EBADF_h__
+#define __test_yaffs_close_EBADF_h__
+
+#include "lib.h"
+#include "yaffsfs.h"
+
+int test_yaffs_close_EBADF(void);
+int test_yaffs_close_EBADF_clean(void);
+#endif
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_ftruncate.h"
static int handle=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_ftruncate_h__
#define __test_yaffs_ftruncate_h__
#include "lib.h"
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_lseek.h"
static int handle=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_lseek_h__
#define __test_yaffs_lseek_h__
#include "lib.h"
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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"
static int handle=0;
int test_yaffs_open_clean(void){
+ handle=0;
if (handle >=0){
return yaffs_close(handle);
}
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_open_h__
#define __test_yaffs_open_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_EEXIST.h"
static int handle=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_open_EEXIST_h__
#define __test_yaffs_open_EEXIST_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_EISDIR.h"
/*EISDIR is caused by trying to open a directory */
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_open_EISDIR_h__
#define __test_yaffs_open_EISDIR_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_ENOENT.h"
static int handle=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_open_ENOENT_h__
#define __test_yaffs_open_ENOENT_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_ENOTDIR.h"
static int handle=0;
handle=yaffs_open("/nonexisting_dir/foo", O_TRUNC| O_RDWR,FILE_MODE );
if (handle==-1){
error_code=yaffs_get_error();
+ printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
if (abs(error_code)==ENOTDIR){
return 1;
}
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_open_ENOTDIR_h__
#define __test_yaffs_open_ENOTDIR_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_read.h"
static int handle=0;
char text[20]="\0";
int output=0;
printf("handle %d\n",handle);
- if (handle>0){
+ if (handle>=0){
output=yaffs_read(handle, text, FILE_TEXT_NBYTES);
printf("yaffs_test_read output: %d\n",output);
printf("text in file is: %s\n",text);
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_read_h__
#define __test_yaffs_read_h__
#include "lib.h"
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.h"
int test_yaffs_stat(void){
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_h__
#define __test_yaffs_stat_h__
#include "lib.h"
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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.h"
static int handle=0;
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_h__
#define __test_yaffs_truncate_h__
#include "lib.h"
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_unlinking.h"
int test_yaffs_unlinking(void){
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_unlinking_h__
#define __test_yaffs_unlinking_h__
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_write.h"
static int handle=0;
int test_yaffs_write(void){
handle=test_yaffs_open();
- if (handle>0){
+ if (handle>=0){
return yaffs_write(handle, FILE_TEXT, FILE_TEXT_NBYTES);
}
else {
+/*
+ * 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 <timothy@yaffs.net>
+ *
+ * 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_write_h__
#define __test_yaffs_write_h__
#include "lib.h"