Fix unmatched temporary buffer allocations
[yaffs2.git] / direct / test-framework / unit_tests / quick_tests / test_yaffs_stat.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2018 Aleph One Ltd.
5  *
6  * Created by Timothy Manning <timothy@yaffs.net>
7  *
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.
11  */
12
13 #include "test_yaffs_stat.h"
14
15 int test_yaffs_stat(void)
16 {
17         struct yaffs_stat stat;
18
19         if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){
20                 print_message("failed to create file \n",1);
21                 return -1;
22         }
23         return yaffs_stat(FILE_PATH, &stat);
24 }
25
26 int test_yaffs_stat_clean(void)
27 {
28         return 1;
29 }
30
31 int yaffs_test_stat_mode(void)
32 {
33         struct yaffs_stat stat;
34         int output=0;
35         output=yaffs_stat(FILE_PATH, &stat);
36         //printf("output: %d\n",output);
37         if (output>=0){
38                 return stat.st_mode;    
39         } else {
40                 print_message("failed to stat file mode\n",2) ;
41                 return -1;
42         }
43 }
44
45 int yaffs_test_stat_size(void){
46         struct yaffs_stat stat;
47         int output=0;
48         output=yaffs_stat(FILE_PATH, &stat); 
49         if (output>=0){
50                 return stat.st_size;    
51         } else {
52                 print_message("failed to stat file size\n",2) ;
53                 return -1;
54         }
55 }
56
57