2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2011 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Timothy Manning <timothy@yaffs.net>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include "test_yaffs_write_big_file.h"
17 static char *file_name = NULL;
18 int test_yaffs_write_big_file(void)
22 handle=test_yaffs_open();
25 int file_name_length=20000;
27 printf("failed to open file\n");
30 output=yaffs_lseek(handle,0x7FFFFF00, SEEK_SET);
32 printf("failed to seek\n");
35 file_name = malloc(file_name_length);
37 printf("unable to create file text\n");
41 strcpy(file_name,YAFFS_MOUNT_POINT);
42 for (x=strlen(YAFFS_MOUNT_POINT); x<file_name_length -1; x++){
45 file_name[file_name_length-2]='\0';
50 output= yaffs_write(handle, file_name, file_name_length-1);
52 error_code=yaffs_get_error();
53 //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
54 if (abs(error_code)==EINVAL){
57 printf("different error than expected\n");
61 printf("wrote a large amount of text to a file.(which is a bad thing)\n");
66 printf("error opening file\n");
72 int test_yaffs_write_big_file_clean(void)
81 output=yaffs_close(handle);
85 output= yaffs_truncate(FILE_PATH,FILE_SIZE );
87 output=test_yaffs_write();
89 return test_yaffs_write_clean();
91 printf("failed to write to file\n");
95 printf("failed to truncate file\n");