yaffs Still hunting the bug.
[yaffs2.git] / direct / timothy_tests / quick_tests / quick_tests.h
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system. 
3  *
4  * Copyright (C) 2002-2010 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Timothy Manning <timothy@yaffs.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License version 2.1 as
11  * published by the Free Software Foundation.
12  *
13  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
14  */
15
16 #ifndef __quick_tests_h__
17 #define __quick_tests_h__
18 #include <stdio.h>
19
20 #include "test_yaffs_mount.h"
21 #include "test_yaffs_mount_ENODEV.h"
22 #include "test_yaffs_mount_ENAMETOOLONG.h"
23 #include "test_yaffs_mount_EBUSY.h"
24
25 #include "test_yaffs_unmount.h"
26 #include "test_yaffs_unmount_ENODEV.h"
27 #include "test_yaffs_unmount_ENAMETOOLONG.h"
28 #include "test_yaffs_unmount_EBUSY.h"
29
30 #include "test_yaffs_open.h"
31 #include "test_yaffs_open_EISDIR.h"
32 #include "test_yaffs_open_EEXIST.h"
33 #include "test_yaffs_open_ENOENT.h"
34 #include "test_yaffs_open_ENOTDIR.h"
35 #include "test_yaffs_open_ENAMETOOLONG.h"
36 #include "test_yaffs_open_EINVAL.h"
37 #include "test_yaffs_open_EINVAL2.h"
38
39 #include "test_yaffs_close_EBADF.h"
40
41
42 #include "test_yaffs_unlink.h"
43 #include "test_yaffs_unlink_EISDIR.h"
44 #include "test_yaffs_unlink_ENOENT.h"
45 #include "test_yaffs_unlink_ENAMETOOLONG.h"
46 #include "test_yaffs_unlink_ENOTDIR.h"
47 #include "test_yaffs_unlink_ENOENT.h"
48
49 #include "test_yaffs_ftruncate.h"
50 #include "test_yaffs_ftruncate_EBADF.h"
51 #include "test_yaffs_ftruncate_EINVAL.h"
52 #include "test_yaffs_ftruncate_big_file.h"
53
54
55 #include "test_yaffs_truncate.h"
56 #include "test_yaffs_truncate_ENOTDIR.h"
57 #include "test_yaffs_truncate_EISDIR.h"
58 #include "test_yaffs_truncate_ENOENT.h"
59 #include "test_yaffs_truncate_EINVAL.h"
60 #include "test_yaffs_truncate_big_file.h"
61
62 #include "test_yaffs_write.h"
63 #include "test_yaffs_write_EBADF.h"
64 #include "test_yaffs_write_big_file.h"
65
66 #include "test_yaffs_read.h"
67 #include "test_yaffs_read_EBADF.h"
68 #include "test_yaffs_read_EINVAL.h"
69
70 #include "test_yaffs_lseek.h"
71 #include "test_yaffs_lseek_EBADF.h"
72 #include "test_yaffs_lseek_EINVAL.h"
73 #include "test_yaffs_lseek_big_file.h"
74
75 #include "test_yaffs_access.h"
76 #include "test_yaffs_access_EINVAL.h"
77 #include "test_yaffs_access_ENOTDIR.h"
78 #include "test_yaffs_access_ENOENT.h"
79
80 #include "test_yaffs_stat.h"
81 #include "test_yaffs_stat_ENOENT.h"
82 #include "test_yaffs_stat_ENOTDIR.h"
83
84 #include "test_yaffs_fstat.h"
85 #include "test_yaffs_fstat_EBADF.h"
86
87 #include "test_yaffs_chmod.h"
88 #include "test_yaffs_chmod_ENOENT.h"
89 #include "test_yaffs_chmod_ENOTDIR.h"
90 #include "test_yaffs_chmod_EINVAL.h"
91
92
93 #include "test_yaffs_fchmod.h"
94 #include "test_yaffs_fchmod_EBADF.h"
95 #include "test_yaffs_fchmod_EINVAL.h"
96
97 #include "test_yaffs_fsync.h"
98 #include "test_yaffs_fsync_EBADF.h"
99
100 #include "test_yaffs_fdatasync.h"
101 #include "test_yaffs_fdatasync_EBADF.h"
102
103 #include "test_yaffs_mkdir.h"
104 #include "test_yaffs_mkdir_EEXIST.h"
105 #include "test_yaffs_mkdir_ENOTDIR.h"
106
107 #include "test_yaffs_symlink.h"
108 #include "test_yaffs_symlink_ENOTDIR.h"
109 #include "test_yaffs_symlink_EEXIST.h"
110 #include "test_yaffs_symlink_ENOENT.h"
111
112 #include "test_yaffs_mount2.h"
113
114 #include "test_yaffs_unmount2.h"
115
116 #include "test_yaffs_sync.h"
117
118 #include "yaffsfs.h"
119 #include "yaffs_error_converter.h"
120 #include "lib.h"
121
122
123
124
125 typedef struct test {
126         int (*p_function)(void);        /*pointer to test function*/
127         int (*p_function_clean)(void);
128         /*char pass_message[50]; will not need a pass message*/
129         char *name_of_test;     /*pointer to fail message, needs to include name of test*/
130 }test_template;
131
132
133 test_template test_list[]={
134         {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
135         {test_yaffs_mount_ENODEV,test_yaffs_mount_ENODEV_clean,"test_yaffs_mount_ENODEV"},
136         {test_yaffs_mount_ENAMETOOLONG,test_yaffs_mount_ENAMETOOLONG_clean,"test_yaffs_mount_ENAMETOOLONG"},
137         {test_yaffs_mount_EBUSY,test_yaffs_mount_EBUSY_clean,"test_yaffs_mount_EBUSY"},
138
139         {test_yaffs_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"},
140         {test_yaffs_unmount_ENODEV,test_yaffs_unmount_ENODEV_clean,"test_yaffs_unmount_ENODEV"},
141         {test_yaffs_unmount_ENAMETOOLONG,test_yaffs_unmount_ENAMETOOLONG_clean,"test_yaffs_unmount_ENAMETOOLONG"},
142         {test_yaffs_unmount_EBUSY,test_yaffs_unmount_EBUSY_clean,"test_yaffs_unmount_EBUSY"},
143
144         {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"},
145         {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"},
146         {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"},
147         {test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"},
148         {test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"},
149         {test_yaffs_open_ENAMETOOLONG,test_yaffs_open_ENAMETOOLONG_clean,"test_yaffs_open_ENAMETOOLONG"},
150         {test_yaffs_open_EINVAL,test_yaffs_open_EINVAL_clean,"test_yaffs_open_EINVAL"},
151         {test_yaffs_open_EINVAL2,test_yaffs_open_EINVAL2_clean,"test_yaffs_open_EINVAL2"},
152         
153         {test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
154
155         {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"},
156         {test_yaffs_access_EINVAL,test_yaffs_access_EINVAL_clean,"test_yaffs_access_EINVAL"},
157         {test_yaffs_access_ENOTDIR,test_yaffs_access_ENOTDIR_clean,"test_yaffs_access_ENOTDIR"},
158         {test_yaffs_access_ENOENT,test_yaffs_access_ENOENT_clean,"test_yaffs_access_ENOENT"},
159
160         {test_yaffs_unlink, test_yaffs_unlink_clean,"test_yaffs_unlink"},
161         {test_yaffs_unlink_EISDIR,test_yaffs_unlink_EISDIR_clean,"test_yaffs_unlink_EISDIR"},
162         {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"},
163         {test_yaffs_unlink_ENAMETOOLONG,test_yaffs_unlink_ENAMETOOLONG_clean,"test_yaffs_unlink_ENAMETOOLONG"},
164         {test_yaffs_unlink_ENOTDIR,test_yaffs_unlink_ENOTDIR_clean,"test_yaffs_unlink_ENOTDIR"},
165         {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"},
166
167
168         {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
169         {test_yaffs_lseek_EBADF,test_yaffs_lseek_EBADF_clean,"test_yaffs_lseek_EBADF"},
170         {test_yaffs_lseek_EINVAL,test_yaffs_lseek_EINVAL_clean,"test_yaffs_lseek_EINVAL"},
171         {test_yaffs_lseek_big_file,test_yaffs_lseek_big_file_clean,"test_yaffs_lseek_big_file"},
172
173         {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
174         {test_yaffs_write_EBADF,test_yaffs_write_EBADF_clean,"test_yaffs_write_EBADF"},
175 //      {test_yaffs_write_big_file,test_yaffs_write_big_file_clean,"test_yaffs_write_big_file"},
176
177         {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
178         {test_yaffs_read_EBADF,test_yaffs_read_EBADF_clean,"test_yaffs_read_EBADF"},
179         {test_yaffs_read_EINVAL,test_yaffs_read_EINVAL_clean,"test_yaffs_read_EINVAL"},
180
181         {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
182         {test_yaffs_stat_ENOENT,test_yaffs_stat_ENOENT_clean,"test_yaffs_stat_ENOENT"},
183         {test_yaffs_stat_ENOTDIR,test_yaffs_stat_ENOTDIR_clean,"test_yaffs_stat_ENOTDIR"},
184
185         {test_yaffs_fstat,test_yaffs_fstat_clean,"test_yaffs_fstat"},
186         {test_yaffs_fstat_EBADF,test_yaffs_fstat_EBADF_clean,"test_yaffs_fstat_EBADF"},
187
188         {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
189         {test_yaffs_ftruncate_EBADF,test_yaffs_ftruncate_EBADF_clean,"test_yaffs_ftruncate_EBADF"},
190         {test_yaffs_ftruncate_EINVAL,test_yaffs_ftruncate_EINVAL_clean,"test_yaffs_ftruncate_EINVAL"},
191         {test_yaffs_ftruncate_big_file,test_yaffs_ftruncate_big_file_clean,"test_yaffs_ftruncate_big_file"},
192
193         {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"},
194         {test_yaffs_truncate_ENOTDIR,test_yaffs_truncate_ENOTDIR_clean,"test_yaffs_truncate_ENOTDIR"},
195         {test_yaffs_truncate_EISDIR,test_yaffs_truncate_EISDIR_clean,"test_yaffs_truncate_EISDIR"},
196         {test_yaffs_truncate_EINVAL,test_yaffs_truncate_EINVAL_clean,"test_yaffs_truncate_EINVAL"},
197         {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"},
198         {test_yaffs_truncate_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"},
199
200         {test_yaffs_chmod,test_yaffs_chmod_clean,"test_yaffs_chmod"},
201         {test_yaffs_chmod_ENOENT,test_yaffs_chmod_ENOENT_clean,"test_yaffs_chmod_ENOENT"},
202         {test_yaffs_chmod_ENOTDIR,test_yaffs_chmod_ENOTDIR_clean,"test_yaffs_chmod_ENOTDIR"},
203         {test_yaffs_chmod_EINVAL,test_yaffs_chmod_EINVAL_clean,"test_yaffs_chmod_EINVAL"},
204
205         {test_yaffs_fchmod,test_yaffs_fchmod_clean,"test_yaffs_fchmod"},
206         {test_yaffs_fchmod_EBADF,test_yaffs_fchmod_EBADF_clean,"test_yaffs_fchmod_EBADF"},
207         {test_yaffs_fchmod_EINVAL,test_yaffs_fchmod_EINVAL_clean,"test_yaffs_fchmod_EINVAL"},
208
209         {test_yaffs_fsync,test_yaffs_fsync_clean,"test_yaffs_fsync"},
210         {test_yaffs_fsync_EBADF,test_yaffs_fsync_EBADF_clean,"test_yaffs_fsync_EBADF"},
211
212         {test_yaffs_fdatasync,test_yaffs_fdatasync_clean,"test_yaffs_fdatasync"},
213         {test_yaffs_fdatasync_EBADF,test_yaffs_fdatasync_EBADF_clean,"test_yaffs_fdatasync_EBADF"},
214
215         {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"},
216         {test_yaffs_mkdir_EEXIST,test_yaffs_mkdir_EEXIST_clean,"test_yaffs_mkdir_EEXIST"},
217         {test_yaffs_mkdir_ENOTDIR,test_yaffs_mkdir_ENOTDIR_clean,"test_yaffs_mkdir_ENOTDIR"},
218
219         {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"},
220         {test_yaffs_symlink_ENOTDIR,test_yaffs_symlink_ENOTDIR_clean,"test_yaffs_symlink_ENOTDIR"},
221         {test_yaffs_symlink_EEXIST,test_yaffs_symlink_EEXIST_clean,"test_yaffs_symlink_EEXIST"},
222         {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"},
223
224         {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"},
225
226         {test_yaffs_unmount2,test_yaffs_unmount2_clean,"test_yaffs_unmount2"},
227
228         {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"}
229
230
231
232         };
233
234 void init_quick_tests(int argc, char *argv[]);
235 void quit_quick_tests(int exit_code);
236 void get_error(void);
237 #endif