1 #include "quick_tests.h"
5 int simulate_power_failure = 0;
10 int (*p_function)(void); /*pointer to test function*/
11 int (*p_function_clean)(void);
12 /*char pass_message[50]; will not need a pass message*/
13 char *fail_message; /*pointer to fail message, needs to include name of test*/
17 int dummy_test_pass(void){
18 //printf("running dummy_test_pass\n");
21 void dummy_test_pass_clean(void){
24 int dummy_test_fail(void){
25 //printf("running dummy_test_fail\n");
28 void dummy_test_fail_clean(void){
30 test_template test_list[]={
31 //{dummy_test_pass,dummy_test_pass_clean,"dummy_test_pass"},
32 //{dummy_test_fail,dummy_test_fail_clean,"dummy_test_fail"},
33 {mount_yaffs_test,mount_yaffs_test_clean,"mount_yaffs_test"},
34 {test_open_file,test_open_file_clean,"test_open_file"},
36 {test_yaffs_access,test_yaffs_access_clean,"test_yaffs_access"},
37 {test_yaffs_unlinking, test_yaffs_unlinking_clean,"test_yaffs_unlinking"},
39 {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
40 {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
41 {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
43 {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"},
44 {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"},
45 {test_yaffs_truncate,test_yaffs_truncate_clean,"test_yaffs_truncate"}
49 unsigned int num_of_tests_pass=0;
50 unsigned int num_of_tests_failed=0;
51 unsigned int total_number_of_tests=(sizeof(test_list)/sizeof(test_template));
59 printf("\n\nrunning quick tests for yaffs\n");
60 //printf("testing yaffs\n");
62 //printf("len function %d",(sizeof(test_list)/sizeof(test_template)));
63 for (x=0;x<total_number_of_tests;x++){
65 output=test_list[x].p_function(); /*run test*/
71 /*test is assumed to have failed*/
72 //printf("test failed\n");
73 printf("test: %s failed\n",test_list[x].fail_message);
74 num_of_tests_failed ++;
78 output=test_list[x].p_function_clean(); /*clean the test*/
80 /* if the test failed to clean it's self then */
81 printf("test: %s failed to clean\n",test_list[x].fail_message);
82 num_of_tests_failed ++;
88 /*this is where the loop should break to*/
90 /* the progame should never get here*/
94 void quit_quick_tests(int exit_code){
95 if (num_of_tests_pass==total_number_of_tests && num_of_tests_failed==0){
98 printf("tests: %d passed %d failed\n\n\n",num_of_tests_pass,num_of_tests_failed);
102 void init_quick_tests(void){