Changeset 1433ecda in mainline for uspace/lib/pcut/src/os/windows.c
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/windows.c
r47b2d7e3 r1433ecda 61 61 * @param test Test that is about to be run. 62 62 */ 63 static void before_test_start(pcut_item_t *test) { 63 static void before_test_start(pcut_item_t *test) 64 { 64 65 pcut_report_test_start(test); 65 66 … … 73 74 * @param failed_function_name Name of the failed function. 74 75 */ 75 static void report_func_fail(pcut_item_t *test, const char *failed_function_name) { 76 static void report_func_fail(pcut_item_t *test, const char *failed_function_name) 77 { 76 78 /* TODO: get error description. */ 77 79 sprintf_s(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 78 80 "%s failed: %s.", failed_function_name, "unknown reason"); 79 81 pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL); 80 82 } … … 91 93 * @return Number of actually read bytes. 92 94 */ 93 static size_t read_all(HANDLE fd, char *buffer, size_t buffer_size) { 95 static size_t read_all(HANDLE fd, char *buffer, size_t buffer_size) 96 { 94 97 DWORD actually_read; 95 98 char *buffer_start = buffer; … … 125 128 }; 126 129 127 static DWORD WINAPI read_test_output_on_background(LPVOID test_output_data_ptr) { 130 static DWORD WINAPI read_test_output_on_background(LPVOID test_output_data_ptr) 131 { 128 132 size_t stderr_size = 0; 129 133 struct test_output_data *test_output_data = (struct test_output_data *) test_output_data_ptr; 130 134 131 135 stderr_size = read_all(test_output_data->pipe_stderr, 132 133 136 test_output_data->output_buffer, 137 test_output_data->output_buffer_size - 1); 134 138 read_all(test_output_data->pipe_stdout, 135 136 139 test_output_data->output_buffer, 140 test_output_data->output_buffer_size - 1 - stderr_size); 137 141 138 142 return 0; … … 144 148 * @param test Test to be run. 145 149 */ 146 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) { 150 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) 151 { 147 152 /* TODO: clean-up if something goes wrong "in the middle" */ 148 153 BOOL okay = FALSE; … … 216 221 /* Format the command line. */ 217 222 sprintf_s(command, PCUT_COMMAND_LINE_BUFFER_SIZE - 1, 218 223 "\"%s\" -t%d", self_path, test->id); 219 224 220 225 /* Run the process. */ 221 226 okay = CreateProcess(NULL, command, NULL, NULL, TRUE, 0, NULL, NULL, 222 227 &start_info, &process_info); 223 228 224 229 if (!okay) { … … 262 267 263 268 test_output_thread_reader = CreateThread(NULL, 0, 264 265 269 read_test_output_on_background, &test_output_data, 270 0, NULL); 266 271 267 272 if (test_output_thread_reader == NULL) { … … 317 322 } 318 323 319 void pcut_hook_before_test(pcut_item_t *test) { 324 void pcut_hook_before_test(pcut_item_t *test) 325 { 320 326 PCUT_UNUSED(test); 321 327
Note:
See TracChangeset
for help on using the changeset viewer.