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