yaffs Added more tests to direct/timothy_tests/quick_tests
[yaffs2.git] / direct / timothy_tests / quick_tests / README.txt
1
2 Made by Timothy Manning <timothy@yaffs.net> on 04/11/2010
3
4
5 Tests made
6
7 test_yaffs_access.c
8 test_yaffs_access_EINVAL.c
9 test_yaffs_access_ENOENT2.c
10 test_yaffs_access_ENOENT.c
11 test_yaffs_access_ENOTDIR.c
12
13 test_yaffs_chmod.c
14 test_yaffs_chmod_EINVAL.c
15 test_yaffs_chmod_ENOENT2.c
16 test_yaffs_chmod_ENOENT.c
17 test_yaffs_chmod_ENOTDIR.c
18
19 test_yaffs_close.c
20 test_yaffs_close_EBADF.c
21
22 test_yaffs_fchmod.c
23 test_yaffs_fchmod_EBADF.c
24 test_yaffs_fchmod_EINVAL.c
25
26 test_yaffs_fdatasync.c
27 test_yaffs_fdatasync_EBADF.c
28
29 test_yaffs_freespace.c
30 test_yaffs_freespace_EINVAL.c
31
32 test_yaffs_fstat.c
33 test_yaffs_fstat_EBADF.c
34
35 test_yaffs_fsync.c
36 test_yaffs_fsync_EBADF.c
37
38 test_yaffs_ftruncate_big_file.c
39 test_yaffs_ftruncate.c
40 test_yaffs_ftruncate_EBADF.c
41 test_yaffs_ftruncate_EINVAL.c
42
43 test_yaffs_inodecount.c
44 test_yaffs_inodecount_EINVAL.c
45
46 test_yaffs_link.c
47 test_yaffs_link_EEXIST.c
48 test_yaffs_link_ENOENT2.c
49 test_yaffs_link_ENOENT3.c
50 test_yaffs_link_ENOENT.c
51 test_yaffs_link_ENOTDIR2.c
52 test_yaffs_link_ENOTDIR.c
53
54 test_yaffs_lseek_big_file.c
55 test_yaffs_lseek.c
56 test_yaffs_lseek_EBADF.c
57 test_yaffs_lseek_EINVAL.c
58
59 test_yaffs_lstat
60 test_yaffs_lstat_ENOENT
61 test_yaffs_lstat_ENOTDIR
62
63 test_yaffs_mkdir.c
64 test_yaffs_mkdir_EEXIST.c
65 test_yaffs_mkdir_ENOENT.c
66 test_yaffs_mkdir_ENOTDIR.c
67
68 test_yaffs_mknode.c
69
70 test_yaffs_mount2.c
71 test_yaffs_mount2_ENODEV.c
72
73 test_yaffs_mount.c
74 test_yaffs_mount_EBUSY.c
75 test_yaffs_mount_ENAMETOOLONG.c
76 test_yaffs_mount_ENODEV.c
77
78 test_yaffs_open.c
79 test_yaffs_open_EEXIST.c
80 test_yaffs_open_EINVAL2.c
81 test_yaffs_open_EINVAL.c
82 test_yaffs_open_EISDIR.c
83 test_yaffs_open_ENAMETOOLONG.c
84 test_yaffs_open_ENOENT.c
85 test_yaffs_open_ENOTDIR.c
86
87 test_yaffs_read.c
88 test_yaffs_read_EBADF.c
89 test_yaffs_read_EINVAL.c
90
91 test_yaffs_remount_EINVAL.c
92 test_yaffs_remount_ENODEV.c
93 test_yaffs_remount_force_off_read_only_off.c
94 test_yaffs_remount_force_off_read_only_on.c
95 test_yaffs_remount_force_on_read_only_off.c
96 test_yaffs_remount_force_on_read_only_on.c
97
98 test_yaffs_rename
99 test_yaffs_rename_ENOENT
100 test_yaffs_rename_ENOTDIR
101 test_yaffs_rename_EINVAL
102
103 test_yaffs_rmdir.c
104 test_yaffs_rmdir_EBUSY
105 test_yaffs_rmdir_EINVAL
106 test_yaffs_rmdir_ENOENT
107 test_yaffs_rmdir_ENOTDIR
108
109 test_yaffs_stat.c
110 test_yaffs_stat_ENOENT2.c
111 test_yaffs_stat_ENOENT.c
112 test_yaffs_stat_ENOTDIR.c
113
114 test_yaffs_symlink.c
115 test_yaffs_symlink_EEXIST.c
116 test_yaffs_symlink_ENOENT2.c
117 test_yaffs_symlink_ENOENT.c
118 test_yaffs_symlink_ENOTDIR.c
119
120 test_yaffs_sync.c
121 test_yaffs_sync_ENODEV.c
122
123 test_yaffs_totalspace.c
124 test_yaffs_totalspace_EINVAL.c
125
126 test_yaffs_truncate.c
127 test_yaffs_truncate_big_file.c
128 test_yaffs_truncate_EINVAL.c
129 test_yaffs_truncate_EISDIR.c
130 test_yaffs_truncate_ENOENT2.c
131 test_yaffs_truncate_ENOENT.c
132 test_yaffs_truncate_ENOTDIR.c
133
134 test_yaffs_unlink.c
135 test_yaffs_unlink_EISDIR.c
136 test_yaffs_unlink_ENAMETOOLONG.c
137 test_yaffs_unlink_ENOENT2.c
138 test_yaffs_unlink_ENOENT.c
139 test_yaffs_unlink_ENOTDIR.c
140
141 test_yaffs_unmount2.c
142 test_yaffs_unmount2_EINVAL.c
143 test_yaffs_unmount2_ENODEV.c
144 test_yaffs_unmount2_with_handle_open_and_forced_mode_off.c
145 test_yaffs_unmount2_with_handle_open_and_forced_mode_on.c
146
147 test_yaffs_unmount.c
148 test_yaffs_unmount_EBUSY.c
149 test_yaffs_unmount_ENAMETOOLONG.c
150 test_yaffs_unmount_ENODEV.c
151
152 test_yaffs_write.c
153 test_yaffs_write_big_file.c
154 test_yaffs_write_EBADF.c
155
156         
157
158 Tests to add
159         test_yaffs_fchmod_EACCES
160
161         test_yaffs_chmod_EACCES
162         test_yaffs_chmod_ELOOP
163         test_yaffs_chmod_ENAMETOOLONG
164
165         
166         test_yaffs_lstat_EACCES
167         test_yaffs_lstat_ENAMETOOLONG
168         test_yaffs_lstat_ELOOP
169
170         test_yaffs_readlink
171         test_yaffs_readlink_ENOENT
172         test_yaffs_readlink_ENOTDIR
173         test_yaffs_readlink_ELOOP
174         test_yaffs_readlink_ENAMETOOLONG
175
176         
177         test_yaffs_mkdir_EACCES
178         test_yaffs_mkdir_ELOOP
179         test_yaffs_mkdir_ENAMETOOLONG
180         test_yaffs_mkdir_EROFS
181
182
183         test_yaffs_symlink_EACCES
184         test_yaffs_symlink_ELOOP
185         test_yaffs_symlink_ENAMETOOLONG
186         test_yaffs_symlink_EROFS
187
188         test_yaffs_mount2_ENAMETOOLONG
189         test_yaffs_mount2_with read only set
190
191         test_yaffs_unmount2_ENAMETOOLONG
192
193         test_yaffs_remount_force_off_read_only_on
194         test_yaffs_remount_force_on_read_only_on
195
196         test_yaffs_freespace_ENAMETOOLONG
197         test_yaffs_totalspace_ENAMETOOLONG
198         test_yaffs_inodecount_ENAMETOOLONG
199
200         test_yaffs_opendir
201
202         test_yaffs_readdir
203
204         test_yaffs_rewinddir
205
206         test_yaffs_closedir
207
208         test_yaffs_link_EACCES
209
210         test_yaffs_link_ELOOP
211
212         test_yaffs_link_ENAMETOOLONG
213         test_yaffs_link_EPERM
214         test_yaffs_link_EROFS
215
216
217         test_yaffs_rmdir_EACCES
218         test_yaffs_rmdir_ENOTEMPTY
219         test_yaffs_rmdir_EROFS
220         test_yaffs_emdir_ELOOP
221
222
223
224         test_yaffs_rename_EACCES
225         test_yaffs_rename_ELOOP
226         test_yaffs_rename_EMLINK
227         test_yaffs_rename_EEXISTS or EPERM
228         test_yaffs_rename_EROFS
229
230         test_yaffs_dup
231         test_yaffs_dup_EBADF            
232
233         test_yaffs_flush
234         test_yaffs_flush_EBADF  
235         
236         test_yaffs_fchmod_EACCES
237         test_yaffs_fchmod_ELOOP
238
239
240         test_yaffs_open_EACCES
241         test_yaffs_open_ENOSPC
242         test_yaffs_open_ELOOP   
243         test yaffs_open_running_out_of_handles error
244
245         test_yaffs_close        //This function has already been called by the time this test is reached.
246         
247         test_yaffs_stat_ELOOP
248         test_yaffs_stat_EACCES
249         test_yaffs_stat_ENAMETOOLONG
250
251         test_yaffs_read_big_file
252         test what happens if you read off the end of the file?
253
254         test_yaffs_pread
255         test_yaffs_pread_EBADF
256         test_yaffs_pread_EINVAL
257         test_yaffs_pread_big_file
258
259         test_yaffs_write_big_file
260         test_yaffs_write_EINVAL
261         What happens when you run out of space?
262         
263         test_yaffs_write_EBADF
264         test_yaffs_write
265         test_yaffs_pwrite_big_file
266         test_yaffs_pwrite_EINVAL
267
268         test_yaffs_unlink_EACCES
269         test_yaffs_unlink_ELOOP
270         test_yaffs_unlink_ENOMEM
271
272         test_yaffs_stat_EACCES
273         test_yaffs_stat_ELOOP
274
275         test_yaffs_access_EACCESS
276         test_yaffs_access_ELOOP
277         test_yaffs_access_ENAMETOOLONG
278         test_yaffs_access_ENOENT_generated_with_a_dangling_symbloic_link
279
280         test_yaffs_ftruncate_EACCES     
281
282
283         test_yaffs_truncate_EACCES
284         test_yaffs_truncate_ELOOP
285         test_yaffs_truncate_ENAMETOOLONG
286         Add a truncate function for truncating a file size to -1.
287
288         What happens if a handle is opened to a file and the file is then deleted?
289         Check to see if yaffs generates an error code for no reason.
290         What happens when a file is opened with no modes set?
291         Add a test where a directory is moved. /fluffy/box. move "fluffy" to "/fluffy/frog". 
292         What happens when yaffs is unmounted twice?
293
294         What happens when open a handle, unmount yaffs and then try to use the handle? 
295
296         What happens when a mount point is mounted using mount2 with read only mode set and then a file is chmoded? 
297
298         Try to remove lost and found dir and replace it with a file of the same name.
299
300         Change the mode of the lost and found dir to read only.
301
302 Tests which do not exist in yaffs:
303         
304         test_yaffs_link_EMLINK          //should not happen on yaffs
305         test_yaffs_link_ELOOP
306         
307         test_yaffs_lstat_ELOOP
308
309         test_yaffs_mkdir_ELOOP
310
311         //the yaffs_mknod function does not exist in yaffsfs, so these tests will not be added.
312         test_yaffs_mknod
313         test_yaffs_mknod_EACCES
314         test_yaffs_mknod_EEXIST
315         test_yaffs_mknod_EINVAL
316         test_yaffs_mknod_ELOOP
317         test_yaffs_mknod_ENAMETOOLONG
318         test_yaffs_mknod_ENOENT
319         test_yaffs_mknod_ENOTDIR
320         test_yaffs_mknod_EROFS
321
322         teat_yaffs_mount_ELOOP
323
324         test_yaffs_mount2_EINVAL        //cannot happen in yaffs since the mode is not checked.
325         test_yaffs_mount2_ENOTDIR       //cannot be generated in yaffs.
326         test_yaffs_mount2_ENOENT        //cannot be generated in yaffs.
327         test_yaffs_mount2_ELOOP
328
329         test_yaffs_remount_ENOENT       //cannot be generated in yaffs
330         test_yaffs_remount_ENOTDIR      //cannot be generated in yaffs
331
332         test_yaffs_unmount2_ENOENT      //cannot be generated in yaffs.
333         test_yaffs_unmount2_ENOTDIR     //cannot be generated in yaffs.
334
335 How to add a test
336         First create the test .c and .h file.
337         The file name and test function name should be the same. 
338         This name should follow one of these formats: 
339         Test_yaffs_[function of yaffs which is been tested]
340         Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated]
341         
342         The .c file needs to contain two functions.
343         The first function needs to contain the code for the main test and will 
344         return -1 on a failure and 0 or greater on a success.
345         The second function needs contain the code for cleaning up after the test. 
346         Cleaning up may include closing some open handles, recreating a file, ect. 
347         This second function needs to return -1 on a failure and 0 or greater on success.
348
349         The name of first function needs to be called the same as the file 
350         name (without the .c or .h)
351         The second function's name needs be the same as the first function but 
352         with "_clean" added on the end.
353         
354         So if a test is been created for the yaffs function yaffs_foo() then 
355         create these files
356         test_yaffs_foo.c
357                 Contains int test_yaffs_foo(void); int test_yaffs_foo_clean(void);
358         test_yaffs_foo.h
359                 Which includes "lib.h", "yaffsfs.h" header files.
360
361         Next write the test code in these files then add these files to the Makefile.
362
363         Add the name of the test files' object file (test_yaffs_foo.o ) to the 
364         TESTFILES tag around line 50 of the Makefile.   
365
366         Now add the test functions to the test_list[] array in quick_tests.h
367         The order of the tests matters. The idea is to test each yaffs_function 
368         individualy and only using tested yaffs_components before using this new 
369         yaffs_function. 
370         This array consists of: 
371         {[test function], [the clean function], [name of the tests which will be printed when the test fails]}, 
372         
373         So add this line to the test_list[]: {test_yaffs_foo, test_yaffs_foo_clean, "test_yaffs_foo"},
374
375         Also include the test's .h file in the quick_test.h file: #include "test_yaffs_foo.h"
376         
377         The test file should now make and run(you may need to make clean first). 
378
379
380
381         PS: yaffs_foo() is a made up function for this README (in case you want 
382         to find this function in yaffs). 
383
384
385
386
387
388