1 #ifndef __TestSuite_H__
2 #define __TestSuite_H__
5 #include <TThreadDynarray.h>
8 * Declaration of the s_TestSuite, which represents
11 typedef struct s_TestSuite {
12 TestCaseContext_t test_case_context; /* the context of the current test case */
13 Stream_t stream; /* stdin or file stream */
14 size_t testCaseCount; /* test case count */
15 size_t successCount; /* test case success count */
16 size_t failureCount; /* test case failure count */
18 char currentTime[30]; /* the current time */
19 #endif /* #ifdef __VERBOSE */
20 ThreadDynarray_t threads;
21 } s_TestSuite_t, *TestSuite_t;
24 * s_TestSuite connected functions.
28 * Create a new s_TestSuite an returns a pointer to self.
30 TestSuite_t TestSuite_new(void);
33 * Free the s_TestSuite pointed to by ptr.
35 void TestSuite_free(TestSuite_t ptr);
38 * Initialize the s_TestSuite structure.
40 errno_t TestSuite_initialize(TestSuite_t ptr, int argc, char *argv[]);
44 * This function reads an entire line, storing
45 * the address of the buffer containing the text into
46 * s_TestSuite.current_line.
48 ssize_t TestSuite_getline(TestSuite_t ptr, size_t * len);
51 * Launch the test suite.
53 void TestSuite_run(TestSuite_t ptr);
56 * Meta command processing.
58 errno_t TestSuite_processMetaCommand(TestSuite_t testSuite);
61 * Set the timeout of the test case context of the
64 void TestSuite_setTimeout(TestSuite_t testSuite);
67 * Enable output checking for the current test case context.
69 void TestSuite_enableOutputChecking(TestSuite_t testSuite);
72 * Disable output checking for the current test case context.
74 void TestSuite_disableOutputChecking(TestSuite_t testSuite);
77 * Enable post output checking for the current test case context.
79 void TestSuite_enablePostOutputChecking(TestSuite_t testSuite);
82 * Disable post output checking for the current test case context.
84 void TestSuite_disablePostOutputChecking(TestSuite_t testSuite);
87 * Set the expected exit code of the current test case context of the test suite.
89 void TestSuite_setExpectedExitCode(TestSuite_t testSuite);
92 * Export a variable in the environment of the current test_runner.exe process.
94 errno_t TestSuite_export(TestSuite_t testSuite);
97 * Expected child output processing.
99 errno_t TestSuite_processExpectedChildOutput(TestSuite_t testSuite);
102 * Child input processing.
104 errno_t TestSuite_processChildInput(TestSuite_t testSuite);
107 * Check the child output.
109 errno_t TestSuite_checkChildOutput(TestCaseContext_t context);
114 void TestSuite_print(const char *str);
117 * Check the child process exit code.
119 errno_t TestSuite_checkChildExitCode(TestCaseContext_t context);
121 errno_t TestSuite_unset(TestSuite_t testSuite);
123 void TestSuite_createConsole(TestSuite_t testSuite);
125 void TestSuite_createNoConsole(TestSuite_t testSuite);
127 void TestSuite_enableExitCodeChecking(TestSuite_t testSuite);
129 void TestSuite_disableExitCodeChecking(TestSuite_t testSuite);
131 unsigned long WINAPI TestSuite_runSyncTestCase(void *param);
133 errno_t TestSuite_runAsyncTestCase(TestSuite_t testSuite);
136 * Terminate the test suite.
138 void TestSuite_terminate(TestSuite_t testSuite);
140 unsigned long WINAPI TestSuite_asyncReadChildOutput(void *param);
142 bool TestSuite_iSPostOutputCheckingEnabled(TestCaseContext_t context);
144 bool TestSuite_iSExitCodeCheckingEnabled(TestCaseContext_t context);
146 errno_t TestSuite_changeDir(TestSuite_t testSuite);
148 void TestSuite_setCommandLine(TestSuite_t testSuite);
153 * Update the current time.
155 void TestSuite_update_current_time(TestSuite_t ptr);
156 #endif /* #ifdef __VERBOSE */
160 #endif /* #ifndef __TestSuite_H__ */