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