Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
test case context concept implementation
[simgrid.git] / win32_test_app / include / TTestSuite.h
1 #ifndef __TestSuite_H__
2 #define __TestSuite_H__
3
4 #include <TStream.h>
5 #include <TThreadDynarray.h>
6
7 /*
8  * Declaration of the s_TestSuite, which represents
9  * a suite of tests.
10  */
11 typedef struct s_TestSuite
12 {
13         TestCaseContext_t test_case_context;    /* the context of the current test case */
14         Stream_t stream;                                                /* stdin or file stream                                 */
15         size_t testCaseCount;                                   /* test case count                                              */
16         size_t successCount;                                    /* test case success count                              */
17         size_t failureCount;                                    /* test case failure count                              */
18         #ifdef __VERBOSE
19         char currentTime[30];                                   /* the current time                                             */
20         #endif /* #ifdef __VERBOSE */
21     ThreadDynarray_t threads;
22 }s_TestSuite_t,* TestSuite_t;
23
24 /* 
25  * s_TestSuite connected functions.
26  */
27
28 /*
29  * Create a new s_TestSuite an returns a pointer to self.
30  */
31 TestSuite_t TestSuite_new(void);
32
33 /* 
34  * Free the s_TestSuite pointed to by ptr.
35  */
36  void TestSuite_free(TestSuite_t ptr);
37  
38  /*
39  * Initialize the s_TestSuite structure.
40  */
41 errno_t TestSuite_initialize(TestSuite_t ptr,int argc,char *argv[]);
42
43
44 /*
45  * This function reads an entire line, storing 
46  * the address of the buffer containing the  text into  
47  * s_TestSuite.current_line. 
48  */
49 ssize_t TestSuite_getline(TestSuite_t ptr,size_t* len);
50
51 /* 
52  * Launch the test suite. 
53  */
54 void TestSuite_run(TestSuite_t ptr);
55
56 /* 
57  * Meta command processing.
58  */
59 errno_t TestSuite_processMetaCommand(TestSuite_t testSuite);
60
61 /* 
62  * Set the timeout of the test case context of the
63  * test suite.
64  */
65 void TestSuite_setTimeout(TestSuite_t testSuite);
66
67 /*
68  * Enable output checking for the current test case context.
69  */
70 void TestSuite_enableOutputChecking(TestSuite_t testSuite);
71
72 /*
73  * Disable output checking for the current test case context.
74  */
75 void TestSuite_disableOutputChecking(TestSuite_t testSuite);
76
77 /*
78  * Enable post output checking for the current test case context.
79  */
80 void TestSuite_enablePostOutputChecking(TestSuite_t testSuite);
81
82 /*
83  * Disable post output checking for the current test case context.
84  */
85 void TestSuite_disablePostOutputChecking(TestSuite_t testSuite);
86
87 /*
88  * Set the expected exit code of the current test case context of the test suite.
89  */
90 void TestSuite_setExpectedExitCode(TestSuite_t testSuite);
91
92 /*
93  * Export a variable in the environment of the current test_runner.exe process.
94  */
95 errno_t TestSuite_export(TestSuite_t testSuite);
96
97 /*
98  * Expected child output processing.
99  */
100 errno_t TestSuite_processExpectedChildOutput(TestSuite_t testSuite);
101
102 /*
103  * Child input processing.
104  */
105 errno_t TestSuite_processChildInput(TestSuite_t testSuite);
106
107 /*
108  * Check the child output.
109  */
110 errno_t TestSuite_checkChildOutput(TestCaseContext_t context);
111
112 /*
113  * Print message
114  */
115 void TestSuite_print(const char* str);
116
117 /*
118  * Check the child process exit code.
119  */ 
120 errno_t TestSuite_checkChildExitCode(TestCaseContext_t context);
121
122 errno_t TestSuite_unset(TestSuite_t testSuite);
123
124 void TestSuite_createConsole(TestSuite_t testSuite);
125
126 void TestSuite_createNoConsole(TestSuite_t testSuite);
127
128 void TestSuite_enableExitCodeChecking(TestSuite_t testSuite);
129
130 void TestSuite_disableExitCodeChecking(TestSuite_t testSuite);
131
132 unsigned long WINAPI TestSuite_runSyncTestCase(void* param);
133
134 errno_t  TestSuite_runAsyncTestCase(TestSuite_t testSuite);
135
136 /* 
137  * Terminate the test suite.
138  */
139 void TestSuite_terminate(TestSuite_t testSuite);
140
141 unsigned long WINAPI TestSuite_asyncReadChildOutput(void* param);
142
143 bool TestSuite_iSPostOutputCheckingEnabled(TestCaseContext_t context);
144
145 bool TestSuite_iSExitCodeCheckingEnabled(TestCaseContext_t context);
146
147 errno_t TestSuite_changeDir(TestSuite_t testSuite);
148
149 void TestSuite_setCommandLine(TestSuite_t testSuite);
150
151
152 #ifdef __VERBOSE
153 /* 
154  * Update the current time. 
155  */
156 void TestSuite_update_current_time(TestSuite_t ptr);
157 #endif /* #ifdef __VERBOSE */
158
159
160
161 #endif /* #ifndef __TestSuite_H__ */