2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002-2018 Aleph One Ltd.
6 * Created by Timothy Manning <timothy@yaffs.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include "test_yaffs_write_big_file.h"
16 static char *file_name = NULL;
17 int test_yaffs_write_big_file(void)
21 handle=test_yaffs_open();
24 int file_name_length=20000;
26 printf("failed to open file\n");
29 output=yaffs_lseek(handle,0x7FFFFF00, SEEK_SET);
31 printf("failed to seek\n");
34 file_name = malloc(file_name_length);
36 printf("unable to create file text\n");
40 strcpy(file_name,YAFFS_MOUNT_POINT);
41 for (x=strlen(YAFFS_MOUNT_POINT); x<file_name_length -1; x++){
44 file_name[file_name_length-2]='\0';
49 output= yaffs_write(handle, file_name, file_name_length-1);
51 error_code=yaffs_get_error();
52 //printf("EISDIR def %d, Error code %d\n", ENOTDIR,error_code);
53 if (abs(error_code)==EINVAL){
56 printf("different error than expected\n");
60 printf("wrote a large amount of text to a file.(which is a bad thing)\n");
65 printf("error opening file\n");
71 int test_yaffs_write_big_file_clean(void)
80 output=yaffs_close(handle);
84 output= yaffs_truncate(FILE_PATH,FILE_SIZE );
86 output=test_yaffs_write();
88 return test_yaffs_write_clean();
90 printf("failed to write to file\n");
94 printf("failed to truncate file\n");