1 2 #ifndef __TEST_CASE_H__ 3 #define __TEST_CASE_H__ 4 5 #include<pthread.h> 6 #include"list.h" 7 8 #define CATEGORY_AUTO 0 9 #define CATEGORY_MANUAL 1 10 11 #define WAIT_COMPLETION 0 12 #define NO_WAIT_COMPLETION 1 13 14 struct testcase_base_info 15 { 16 char name[32]; 17 char display_name[68]; 18 int activated; 19 char binary[20]; 20 int id; 21 int category; /* 0: auto, 1: manual */ 22 int run_type; 23 }; 24 25 struct testcase_info 26 { 27 pthread_t tid; 28 int err; 29 struct testcase_base_info *base_info; 30 int x; //x,y positon and width height on the screen 31 int y; 32 int w; 33 int h; 34 int dev_id; //default 0,but some device have double,such as camera 35 int result; 36 void *msg; //this is for testcase spefic msg struct 37 void* (*func)(void *argv); //test function 38 struct list_head list; 39 }; 40 41 #define INIT_CMD_PIPE() \ 42 FILE *cmd_pipe; \ 43 int test_case_id; \ 44 if (argc < 4) { \ 45 db_error("%s: invalid parameter, #%d\n", argv[0], argc);\ 46 return -1; \ 47 } \ 48 cmd_pipe = fopen(CMD_PIPE_NAME, "w"); \ 49 setlinebuf(cmd_pipe); \ 50 test_case_id = atoi(argv[3]) 51 52 #define SEND_CMD_PIPE_OK() \ 53 fprintf(cmd_pipe, "%d 0\n", test_case_id) 54 55 #define SEND_CMD_PIPE_OK_EX(exdata) \ 56 fprintf(cmd_pipe, "%d 0 %s\n", test_case_id, exdata) 57 58 #define SEND_CMD_PIPE_FAIL() \ 59 fprintf(cmd_pipe, "%d 1\n", test_case_id) 60 61 #define SEND_CMD_PIPE_FAIL_EX(exdata) \ 62 fprintf(cmd_pipe, "%d 1 %s\n", test_case_id, exdata) 63 64 #define EXIT_CMD_PIPE() \ 65 fclose(cmd_pipe) 66 67 68 #endif /* __TEST_CASE_H__ */ 69