a6b984e3d929372315d2b317820827da00e3a340
[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 the yaffs_open function has been covered by tests
6 the yaffs_close function has been covered by tests
7
8 tests made
9         test_yaffs_mount
10         test_yaffs_mount_ENODEV
11         test_yaffs_mount_ENAMETOOLONG
12         test_yaffs_mount_ENOENT
13         test_yaffs_access
14         test_yaffs_close_EBADF
15         test_yaffs_ftruncate
16         test_yaffs_lseek
17         test_yaffs_open
18         test_yaffs_open_EEXIST
19         test_yaffs_open_EISDIR
20         test_yaffs_open_ENAMETOOLONG
21         test_yaffs_open_ENOENT
22         test_yaffs_open_ENOTDIR
23         test_yaffs_read
24         test_yaffs_stat
25         test_yaffs_truncate
26         test_yaffs_unlink
27         test_yaffs_unlink_EISDIR
28         test_yaffs_unlink_ENAMETOOLONG
29         test_yaffs_unlink_ENOENT
30         test_yaffs_unlink_ENOTDIR
31         test_yaffs_unmount
32         test_yaffs_write
33
34
35 tests to add
36         test_yaffs_mount_EACCES         //Cannot be generated with yaffs.
37         test_yaffs_mount_EINVAL         //Cannot be generated with yaffs.
38         test_yaffs_mount_ELOOP          //Cannot be generated with yaffs.
39         test_yaffs_mount_EMFILE         //Cannot be generated with yaffs.
40
41
42         test_yaffs_mount_ENOTDIR        //Cannot be generated with yaffs.
43         test_yaffs_mount_EBUSY          //called when trying to mount a new mount point with a mount point already mounted.
44
45         test_yaffs_unmount ->all error
46
47         test_yaffs_open_EACCES
48         test_yaffs_open_ENOSPC
49         test_yaffs_open_ELOOP   //Too many symbolic links were encountered in resolving pathname
50         test yaffs_open_running_out_of_handles error
51
52         test_yaffs_close        //This function has already been called by the time this test is reached. 
53
54         test_yaffs_unlink_EACCES
55         test_yaffs_unlink_ELOOP
56         test_yaffs_unlink_ENOENT
57         test_yaffs_unlink_ENOMEM
58
59         test_yaffs_access_EACCESS
60         test_yaffs_access_ELOOP
61         test_yaffs_access_ENAMETOOLONG
62         test_yaffs_access_ENOENT
63         test_yaffs_access_ENOTDIR
64         test_yaffs_access_ENIVAL        //mode is incorrect.
65
66         test_yaffs_ftruncate_EACCES
67         test_yaffs_ftruncate_EFBIG
68         test_yaffs_ftruncate_ENIVAL
69         test_yaffs_ftruncate_EISDIR
70         test_yaffs_ftruncate_ELOOP
71         test_yaffs_ftruncate_ENOENT
72         test_yaffs_ftruncate_ENOTDIR
73         test_yaffs_ftruncate_EPERM
74
75         test_yaffs_truncate_EACCES
76         test_yaffs_truncate_EFBIG
77         test_yaffs_truncate_ENIVAL
78         test_yaffs_truncate_EISDIR
79         test_yaffs_truncate_ELOOP
80         test_yaffs_truncate_ENAMETOOLONG
81         test_yaffs_truncate_ENOENT
82         test_yaffs_truncate_ENOTDIR
83         test_yaffs_truncate_EPERM
84
85         check to see if an error code is generated when there isn't an error.
86
87
88 How to add a test
89         First create the test .c and .h file.
90         The file name and test function name should be the same. 
91         This name should follow one of these formats: 
92         Test_yaffs_[function of yaffs which is been tested]
93         Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated]
94         
95         The .c file needs to contain two functions.
96         The first function needs to contain the code for the main test and will return -1 on a failure and 0 or greater on a success.
97         The second function needs contain the code for cleaning up after the test. Cleaning up may include closing some open handles, recreating a file, ect. 
98         This second function needs to return -1 on a failure and 0 or greater on success.
99
100         The name of first function needs to be called the same as the file name (without the .c or .h)
101         The second function's name needs be the same as the first function but with "_clean" added on the end.
102         
103         So if a test is been created for the yaffs function yaffs_fish() then create these files
104         Test_yaffs_fish.c
105                 Contains int test_yaffs_fish(void); int test_yaffs_fish_clean(void);
106         Test_yaffs_fish.h
107                 Which includes "lib.h", "yaffsfs.h" header files.
108
109         Next write the test code in these files then add these files to the Makefile.
110
111         Add the name of the test files' object file (test_yaffs_fish.o ) to the TESTFILES tag around line 50 of the Makefile.   
112
113
114
115         Now add the test functions to the test_list[] array in quick_tests.h
116         The order of the tests matters. The idea is to test each yaffs_function individualy and only using tested yaffs_components before using this new yaffs_function. 
117         This array consists of: {[test function], [the clean function], [name of the tests which will be printed when the test fails]}, 
118         
119         So add this line to the test_list[]: {test_yaffs_fish, test_yaffs_fish_clean, "test_yaffs_fish"},
120
121         Also include the test's .h file in the quick_test.h file: #include "test_yaffs_fish.h"
122         
123         The test file should now make and run(you may need to make clean first). 
124
125
126
127         PS: yaffs_fish() is a made up function for this README (in case you want to try and find this function in yaffs). 
128
129
130 BUGS AND WARNINGS
131         bug with opening a file with a name of 1,000,000 char long with no errors.
132         bug with unlinking a file with 1,000,000 get the error ENOENT but should be geting ENAMETOOLONG. 
133         bug with mounting a too long non-existant mount point. there are two errors here, ENOENT and ENAMETOOLONG.
134         bug with mounting a non-existing mount point get the error ENODEV. should be getting ENOENT.
135
136         WARNING- If yaffs is unmounted then most functions return ENODIR.
137         
138         FIXED-remove the printf which prints yaffs_mounting.
139         FIXED-ENOSPC error in programs test_yaffs_open_ENOTDIR and test_yaffs_open_ENOENT.
140         FIXED-ENOENT been returned by yaffs_read but the handle is good and the yaffs_open function does not return an error.
141
142
143
144