yaffs Added more tests to direct/timothy_tests/quick_tests
[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 #include "test_yaffs_unlink_ENOENT2.h"
49
50 #include "test_yaffs_ftruncate.h"
51 #include "test_yaffs_ftruncate_EBADF.h"
52 #include "test_yaffs_ftruncate_EINVAL.h"
53 #include "test_yaffs_ftruncate_big_file.h"
54
55
56 #include "test_yaffs_truncate.h"
57 #include "test_yaffs_truncate_ENOTDIR.h"
58 #include "test_yaffs_truncate_EISDIR.h"
59 #include "test_yaffs_truncate_ENOENT.h"
60 #include "test_yaffs_truncate_EINVAL.h"
61 #include "test_yaffs_truncate_big_file.h"
62 #include "test_yaffs_truncate_ENOENT2.h"
63
64 #include "test_yaffs_write.h"
65 #include "test_yaffs_write_EBADF.h"
66 #include "test_yaffs_write_big_file.h"
67
68 #include "test_yaffs_read.h"
69 #include "test_yaffs_read_EBADF.h"
70 #include "test_yaffs_read_EINVAL.h"
71
72 #include "test_yaffs_lseek.h"
73 #include "test_yaffs_lseek_EBADF.h"
74 #include "test_yaffs_lseek_EINVAL.h"
75 #include "test_yaffs_lseek_big_file.h"
76
77 #include "test_yaffs_access.h"
78 #include "test_yaffs_access_EINVAL.h"
79 #include "test_yaffs_access_ENOTDIR.h"
80 #include "test_yaffs_access_ENOENT.h"
81 #include "test_yaffs_access_ENOENT2.h"
82
83 #include "test_yaffs_stat.h"
84 #include "test_yaffs_stat_ENOENT.h"
85 #include "test_yaffs_stat_ENOTDIR.h"
86 #include "test_yaffs_stat_ENOENT2.h"
87
88 #include "test_yaffs_fstat.h"
89 #include "test_yaffs_fstat_EBADF.h"
90
91 #include "test_yaffs_chmod.h"
92 #include "test_yaffs_chmod_ENOENT.h"
93 #include "test_yaffs_chmod_ENOTDIR.h"
94 #include "test_yaffs_chmod_EINVAL.h"
95 #include "test_yaffs_chmod_ENOENT2.h"
96
97
98 #include "test_yaffs_fchmod.h"
99 #include "test_yaffs_fchmod_EBADF.h"
100 #include "test_yaffs_fchmod_EINVAL.h"
101
102 #include "test_yaffs_fsync.h"
103 #include "test_yaffs_fsync_EBADF.h"
104
105 #include "test_yaffs_fdatasync.h"
106 #include "test_yaffs_fdatasync_EBADF.h"
107
108 #include "test_yaffs_mkdir.h"
109 #include "test_yaffs_mkdir_EEXIST.h"
110 #include "test_yaffs_mkdir_ENOTDIR.h"
111 #include "test_yaffs_mkdir_ENOENT.h"
112
113 #include "test_yaffs_symlink.h"
114 #include "test_yaffs_symlink_ENOTDIR.h"
115 #include "test_yaffs_symlink_EEXIST.h"
116 #include "test_yaffs_symlink_ENOENT.h"
117 #include "test_yaffs_symlink_ENOENT2.h"
118
119 #include "test_yaffs_mount2.h"
120 #include "test_yaffs_mount2_ENODEV.h"
121
122 #include "test_yaffs_unmount2.h"
123 #include "test_yaffs_unmount2_ENODEV.h"
124 #include "test_yaffs_unmount2_EINVAL.h"
125 #include "test_yaffs_unmount2_with_handle_open_and_forced_mode_on.h"
126 #include "test_yaffs_unmount2_with_handle_open_and_forced_mode_off.h"
127
128 #include "test_yaffs_sync.h"
129 #include "test_yaffs_sync_ENODEV.h"
130
131 #include "test_yaffs_remount_force_off_read_only_off.h"
132 #include "test_yaffs_remount_force_on_read_only_off.h"
133 #include "test_yaffs_remount_ENODEV.h"
134 #include "test_yaffs_remount_EINVAL.h"
135
136 #include "test_yaffs_freespace.h"
137 #include "test_yaffs_freespace_EINVAL.h"
138
139 #include "test_yaffs_totalspace.h"
140 #include "test_yaffs_totalspace_EINVAL.h"
141
142 #include "test_yaffs_inodecount.h"
143 #include "test_yaffs_inodecount_EINVAL.h"
144
145 #include "test_yaffs_link.h"
146 #include "test_yaffs_link_ENOENT.h"
147 #include "test_yaffs_link_EEXIST.h"
148 #include "test_yaffs_link_ENOTDIR.h"
149 #include "test_yaffs_link_ENOTDIR2.h"
150 #include "test_yaffs_link_ENOENT2.h"
151 #include "test_yaffs_link_ENOENT3.h"
152
153 #include "test_yaffs_rmdir.h"
154 #include "test_yaffs_rmdir_EBUSY.h"
155 #include "test_yaffs_rmdir_EINVAL.h"
156 #include "test_yaffs_rmdir_ENOENT.h"
157 #include "test_yaffs_rmdir_ENOTDIR.h"
158
159 #include "test_yaffs_rename.h"
160 #include "test_yaffs_rename_ENOENT.h"
161 #include "test_yaffs_rename_ENOTDIR.h"
162 #include "test_yaffs_rename_EINVAL.h"
163 #include "test_yaffs_rename_dir.h"
164 #include "test_yaffs_rename_dir_ENOENT.h"
165 #include "test_yaffs_rename_dir_ENOENT2.h"
166 #include "test_yaffs_rename_dir_to_file.h"
167 #include "test_yaffs_rename_file_to_dir.h"
168 #include "test_yaffs_rename_EEXISTS.h"
169
170 #include "yaffsfs.h"
171 #include "yaffs_error_converter.h"
172 #include "lib.h"
173
174
175
176
177 typedef struct test {
178         int (*p_function)(void);        /*pointer to test function*/
179         int (*p_function_clean)(void);
180         /*char pass_message[50]; will not need a pass message*/
181         char *name_of_test;     /*pointer to fail message, needs to include name of test*/
182 }test_template;
183
184
185 test_template test_list[]={
186         {test_yaffs_mount,test_yaffs_mount_clean,"test_yaffs_mount"},
187         {test_yaffs_mount_ENODEV,test_yaffs_mount_ENODEV_clean,"test_yaffs_mount_ENODEV"},
188         {test_yaffs_mount_ENAMETOOLONG,test_yaffs_mount_ENAMETOOLONG_clean,"test_yaffs_mount_ENAMETOOLONG"},
189         {test_yaffs_mount_EBUSY,test_yaffs_mount_EBUSY_clean,"test_yaffs_mount_EBUSY"},
190
191         {test_yaffs_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"},
192         {test_yaffs_unmount_ENODEV,test_yaffs_unmount_ENODEV_clean,"test_yaffs_unmount_ENODEV"},
193         {test_yaffs_unmount_ENAMETOOLONG,test_yaffs_unmount_ENAMETOOLONG_clean,"test_yaffs_unmount_ENAMETOOLONG"},
194         {test_yaffs_unmount_EBUSY,test_yaffs_unmount_EBUSY_clean,"test_yaffs_unmount_EBUSY"},
195
196         {test_yaffs_open,test_yaffs_open_clean,"test_yaffs_open"},
197         {test_yaffs_open_EISDIR,test_yaffs_open_EISDIR_clean,"test_yaffs_open_EISDIR"},
198         {test_yaffs_open_EEXIST,test_yaffs_open_EEXIST_clean,"test_yaffs_open_EEXIST"},
199         {test_yaffs_open_ENOTDIR,test_yaffs_open_ENOTDIR_clean,"test_yaffs_open_ENOTDIR"},
200         {test_yaffs_open_ENOENT,test_yaffs_open_ENOENT_clean,"test_yaffs_open_ENOENT"},
201         {test_yaffs_open_ENAMETOOLONG,test_yaffs_open_ENAMETOOLONG_clean,"test_yaffs_open_ENAMETOOLONG"},
202         {test_yaffs_open_EINVAL,test_yaffs_open_EINVAL_clean,"test_yaffs_open_EINVAL"},
203         {test_yaffs_open_EINVAL2,test_yaffs_open_EINVAL2_clean,"test_yaffs_open_EINVAL2"},
204         
205         {test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
206
207         {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"},
208         {test_yaffs_access_EINVAL,test_yaffs_access_EINVAL_clean,"test_yaffs_access_EINVAL"},
209         {test_yaffs_access_ENOTDIR,test_yaffs_access_ENOTDIR_clean,"test_yaffs_access_ENOTDIR"},
210         {test_yaffs_access_ENOENT,test_yaffs_access_ENOENT_clean,"test_yaffs_access_ENOENT"},
211         {test_yaffs_access_ENOENT2,test_yaffs_access_ENOENT2_clean,"test_yaffs_access_ENOENT2"},
212
213         {test_yaffs_unlink, test_yaffs_unlink_clean,"test_yaffs_unlink"},
214         {test_yaffs_unlink_EISDIR,test_yaffs_unlink_EISDIR_clean,"test_yaffs_unlink_EISDIR"},
215         {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"},
216         {test_yaffs_unlink_ENAMETOOLONG,test_yaffs_unlink_ENAMETOOLONG_clean,"test_yaffs_unlink_ENAMETOOLONG"},
217         {test_yaffs_unlink_ENOTDIR,test_yaffs_unlink_ENOTDIR_clean,"test_yaffs_unlink_ENOTDIR"},
218         {test_yaffs_unlink_ENOENT,test_yaffs_unlink_ENOENT_clean,"test_yaffs_unlink_ENOENT"},
219         {test_yaffs_unlink_ENOENT2,test_yaffs_unlink_ENOENT2_clean,"test_yaffs_unlink_ENOENT2"},
220
221
222         {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
223         {test_yaffs_lseek_EBADF,test_yaffs_lseek_EBADF_clean,"test_yaffs_lseek_EBADF"},
224         {test_yaffs_lseek_EINVAL,test_yaffs_lseek_EINVAL_clean,"test_yaffs_lseek_EINVAL"},
225 //      {test_yaffs_lseek_big_file,test_yaffs_lseek_big_file_clean,"test_yaffs_lseek_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled.
226
227         {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
228         {test_yaffs_write_EBADF,test_yaffs_write_EBADF_clean,"test_yaffs_write_EBADF"},
229         {test_yaffs_write_big_file,test_yaffs_write_big_file_clean,"test_yaffs_write_big_file"},
230
231         {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
232         {test_yaffs_read_EBADF,test_yaffs_read_EBADF_clean,"test_yaffs_read_EBADF"},
233         {test_yaffs_read_EINVAL,test_yaffs_read_EINVAL_clean,"test_yaffs_read_EINVAL"},
234
235         {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
236         {test_yaffs_stat_ENOENT,test_yaffs_stat_ENOENT_clean,"test_yaffs_stat_ENOENT"},
237         {test_yaffs_stat_ENOTDIR,test_yaffs_stat_ENOTDIR_clean,"test_yaffs_stat_ENOTDIR"},
238         {test_yaffs_stat_ENOENT2,test_yaffs_stat_ENOENT2_clean,"test_yaffs_stat_ENOENT2"},
239
240         {test_yaffs_fstat,test_yaffs_fstat_clean,"test_yaffs_fstat"},
241         {test_yaffs_fstat_EBADF,test_yaffs_fstat_EBADF_clean,"test_yaffs_fstat_EBADF"},
242
243         {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
244         {test_yaffs_ftruncate_EBADF,test_yaffs_ftruncate_EBADF_clean,"test_yaffs_ftruncate_EBADF"},
245         {test_yaffs_ftruncate_EINVAL,test_yaffs_ftruncate_EINVAL_clean,"test_yaffs_ftruncate_EINVAL"},
246         {test_yaffs_ftruncate_big_file,test_yaffs_ftruncate_big_file_clean,"test_yaffs_ftruncate_big_file"},
247
248         {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"},
249         {test_yaffs_truncate_ENOTDIR,test_yaffs_truncate_ENOTDIR_clean,"test_yaffs_truncate_ENOTDIR"},
250         {test_yaffs_truncate_EISDIR,test_yaffs_truncate_EISDIR_clean,"test_yaffs_truncate_EISDIR"},
251         {test_yaffs_truncate_EINVAL,test_yaffs_truncate_EINVAL_clean,"test_yaffs_truncate_EINVAL"},
252         {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"},
253         {test_yaffs_truncate_ENOENT2,test_yaffs_truncate_ENOENT2_clean,"test_yaffs_truncate_ENOENT2"},
254 //      {test_yaffs_truncate_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled.
255
256         {test_yaffs_chmod,test_yaffs_chmod_clean,"test_yaffs_chmod"},
257         {test_yaffs_chmod_ENOENT,test_yaffs_chmod_ENOENT_clean,"test_yaffs_chmod_ENOENT"},
258         {test_yaffs_chmod_ENOTDIR,test_yaffs_chmod_ENOTDIR_clean,"test_yaffs_chmod_ENOTDIR"},
259         {test_yaffs_chmod_EINVAL,test_yaffs_chmod_EINVAL_clean,"test_yaffs_chmod_EINVAL"},
260
261         {test_yaffs_fchmod,test_yaffs_fchmod_clean,"test_yaffs_fchmod"},
262         {test_yaffs_fchmod_EBADF,test_yaffs_fchmod_EBADF_clean,"test_yaffs_fchmod_EBADF"},
263         {test_yaffs_fchmod_EINVAL,test_yaffs_fchmod_EINVAL_clean,"test_yaffs_fchmod_EINVAL"},
264
265         {test_yaffs_fsync,test_yaffs_fsync_clean,"test_yaffs_fsync"},
266         {test_yaffs_fsync_EBADF,test_yaffs_fsync_EBADF_clean,"test_yaffs_fsync_EBADF"},
267
268         {test_yaffs_fdatasync,test_yaffs_fdatasync_clean,"test_yaffs_fdatasync"},
269         {test_yaffs_fdatasync_EBADF,test_yaffs_fdatasync_EBADF_clean,"test_yaffs_fdatasync_EBADF"},
270
271         {test_yaffs_mkdir,test_yaffs_mkdir_clean,"test_yaffs_mkdir"},
272         {test_yaffs_mkdir_EEXIST,test_yaffs_mkdir_EEXIST_clean,"test_yaffs_mkdir_EEXIST"},
273         {test_yaffs_mkdir_ENOTDIR,test_yaffs_mkdir_ENOTDIR_clean,"test_yaffs_mkdir_ENOTDIR"},
274         {test_yaffs_mkdir_ENOENT,test_yaffs_mkdir_ENOENT_clean,"test_yaffs_mkdir_ENOENT"},
275
276         {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"},
277         {test_yaffs_symlink_ENOTDIR,test_yaffs_symlink_ENOTDIR_clean,"test_yaffs_symlink_ENOTDIR"},
278         {test_yaffs_symlink_EEXIST,test_yaffs_symlink_EEXIST_clean,"test_yaffs_symlink_EEXIST"},
279         {test_yaffs_symlink_ENOENT,test_yaffs_symlink_ENOENT_clean,"test_yaffs_symlink_ENOENT"},
280         {test_yaffs_symlink_ENOENT2,test_yaffs_symlink_ENOENT2_clean,"test_yaffs_symlink_ENOENT2"},
281
282         {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"},
283         {test_yaffs_mount2_ENODEV,test_yaffs_mount2_ENODEV_clean,"test_yaffs_mount2_ENODEV"},
284         
285
286         {test_yaffs_unmount2,test_yaffs_unmount2_clean,"test_yaffs_unmount2"},
287         {test_yaffs_unmount2_ENODEV,test_yaffs_unmount2_ENODEV_clean,"test_yaffs_unmount2_ENODEV"},
288         {test_yaffs_unmount2_EINVAL,test_yaffs_unmount2_EINVAL_clean,"test_yaffs_unmount2_EINVAL"},     {test_yaffs_unmount2_with_handle_open_and_forced_mode_on,test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_on"},
289 {test_yaffs_unmount2_with_handle_open_and_forced_mode_off,test_yaffs_unmount2_with_handle_open_and_forced_mode_off_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_off"},
290
291         {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"},
292         {test_yaffs_sync_ENODEV,test_yaffs_sync_ENODEV_clean,"test_yaffs_sync_ENODEV"},
293
294
295
296         {test_yaffs_remount_force_off_read_only_off,test_yaffs_remount_force_off_read_only_off_clean,"test_yaffs_remount_force_off_read_only_off"},
297 {test_yaffs_remount_force_on_read_only_off,test_yaffs_remount_force_on_read_only_off_clean,"test_yaffs_remount_force_on_read_only_off"},
298         {test_yaffs_remount_ENODEV,test_yaffs_remount_ENODEV_clean,"test_yaffs_remount_ENODEV"},
299         {test_yaffs_remount_EINVAL,test_yaffs_remount_EINVAL_clean,"test_yaffs_remount_EINVAL"},
300
301         {test_yaffs_freespace,test_yaffs_freespace_clean,"test_yaffs_freespace"},
302         {test_yaffs_freespace_EINVAL,test_yaffs_freespace_EINVAL_clean,"test_yaffs_freespace_EINVAL"},
303
304         {test_yaffs_totalspace,test_yaffs_totalspace_clean,"test_yaffs_totalspace"},
305         {test_yaffs_totalspace_EINVAL,test_yaffs_totalspace_EINVAL_clean,"test_yaffs_totalspace_EINVAL"},
306
307         {test_yaffs_inodecount,test_yaffs_inodecount_clean,"test_yaffs_inodecount"},
308         {test_yaffs_inodecount_EINVAL,test_yaffs_inodecount_EINVAL_clean,"test_yaffs_inodecount_EINVAL"},
309
310         {test_yaffs_link,test_yaffs_link_clean,"test_yaffs_link"},
311         {test_yaffs_link_ENOENT,test_yaffs_link_ENOENT_clean,"test_yaffs_link_ENOENT"},
312         {test_yaffs_link_EEXIST,test_yaffs_link_EEXIST_clean,"test_yaffs_link_EEXIST"},
313         {test_yaffs_link_ENOTDIR,test_yaffs_link_ENOTDIR_clean,"test_yaffs_link_ENOTDIR"},
314         {test_yaffs_link_ENOTDIR2,test_yaffs_link_ENOTDIR2_clean,"test_yaffs_link_ENOTDIR2"},
315         {test_yaffs_link_ENOENT2,test_yaffs_link_ENOENT2_clean,"test_yaffs_link_ENOENT2"},
316         {test_yaffs_link_ENOENT3,test_yaffs_link_ENOENT3_clean,"test_yaffs_link_ENOENT3"},
317
318         {test_yaffs_rmdir,test_yaffs_rmdir_clean,"test_yaffs_rmdir"},
319         {test_yaffs_rmdir_EBUSY,test_yaffs_rmdir_EBUSY_clean,"test_yaffs_rmdir_EBUSY"},
320         {test_yaffs_rmdir_EINVAL,test_yaffs_rmdir_EINVAL_clean,"test_yaffs_rmdir_EINVAL"},
321         {test_yaffs_rmdir_ENOENT,test_yaffs_rmdir_ENOENT_clean,"test_yaffs_rmdir_ENOENT"},
322         {test_yaffs_rmdir_ENOTDIR,test_yaffs_rmdir_ENOTDIR_clean,"test_yaffs_rmdir_ENOTDIR"},
323
324         {test_yaffs_rename,test_yaffs_rename_clean,"test_yaffs_rename"},
325         {test_yaffs_rename_ENOENT,test_yaffs_rename_ENOENT_clean,"test_yaffs_rename_ENOENT"},
326         {test_yaffs_rename_ENOTDIR,test_yaffs_rename_ENOTDIR_clean,"test_yaffs_rename_ENOTDIR"},
327         {test_yaffs_rename_EINVAL,test_yaffs_rename_EINVAL_clean,"test_yaffs_rename_EINVAL"},
328         {test_yaffs_rename_dir,test_yaffs_rename_dir_clean,"test_yaffs_rename_dir"},
329         {test_yaffs_rename_dir_ENOENT,test_yaffs_rename_dir_ENOENT_clean,"test_yaffs_rename_dir_ENOENT"},
330         {test_yaffs_rename_dir_ENOENT2,test_yaffs_rename_dir_ENOENT2_clean,"test_yaffs_rename_dir_ENOENT2"},
331         {test_yaffs_rename_dir_to_file,test_yaffs_rename_dir_to_file_clean,"test_yaffs_rename_dir_to_file"},
332         {test_yaffs_rename_file_to_dir,test_yaffs_rename_file_to_dir_clean,"test_yaffs_rename_file_to_dir"},
333         {test_yaffs_rename_EEXISTS,test_yaffs_rename_EEXISTS_clean,"test_yaffs_rename_EEXISTS"}
334         };
335
336 void init_quick_tests(int argc, char *argv[]);
337 void quit_quick_tests(int exit_code);
338 void get_error(void);
339 #endif