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