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