Changes in uspace/lib/pcut/src/os/unix.c [9eb1ff5:8d2dd7f2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/unix.c
r9eb1ff5 r8d2dd7f2 36 36 /** We need _BSD_SOURCE because of snprintf() when compiling under C89. */ 37 37 #define _BSD_SOURCE 38 39 /** Newer versions of features.h needs _DEFAULT_SOURCE. */40 #define _DEFAULT_SOURCE41 42 38 #include <stdlib.h> 43 39 #include <unistd.h> 44 #include <s ys/types.h>40 #include <stddef.h> 45 41 #include <signal.h> 46 42 #include <errno.h> … … 124 120 if (WIFEXITED(status)) { 125 121 if (WEXITSTATUS(status) != 0) { 126 return PCUT_OUTCOME_FAIL;122 return TEST_OUTCOME_FAIL; 127 123 } else { 128 return PCUT_OUTCOME_PASS;124 return TEST_OUTCOME_PASS; 129 125 } 130 126 } 131 127 132 128 if (WIFSIGNALED(status)) { 133 return PCUT_OUTCOME_INTERNAL_ERROR;129 return TEST_OUTCOME_ERROR; 134 130 } 135 131 … … 142 138 * @param test Test to be run. 143 139 */ 144 intpcut_run_test_forking(const char *self_path, pcut_item_t *test) {140 void pcut_run_test_forking(const char *self_path, pcut_item_t *test) { 145 141 int link_stdout[2], link_stderr[2]; 146 int rc, status , outcome;142 int rc, status; 147 143 size_t stderr_size; 148 144 … … 156 152 snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 157 153 "pipe() failed: %s.", strerror(rc)); 158 pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);159 return PCUT_OUTCOME_INTERNAL_ERROR;154 pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL); 155 return; 160 156 } 161 157 rc = pipe(link_stderr); … … 163 159 snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 164 160 "pipe() failed: %s.", strerror(rc)); 165 pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL);166 return PCUT_OUTCOME_INTERNAL_ERROR;161 pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL); 162 return; 167 163 } 168 164 … … 171 167 snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 172 168 "fork() failed: %s.", strerror(rc)); 173 outcome = PCUT_OUTCOME_INTERNAL_ERROR;169 rc = TEST_OUTCOME_ERROR; 174 170 goto leave_close_pipes; 175 171 } … … 182 178 close(link_stderr[0]); 183 179 184 outcome= pcut_run_test_forked(test);185 186 exit( outcome);180 rc = pcut_run_test_forked(test); 181 182 exit(rc); 187 183 } 188 184 … … 199 195 alarm(0); 200 196 201 outcome= convert_wait_status_to_outcome(status);197 rc = convert_wait_status_to_outcome(status); 202 198 203 199 goto leave_close_parent_pipe; … … 210 206 close(link_stderr[0]); 211 207 212 pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE); 213 214 return outcome; 208 pcut_report_test_done_unparsed(test, rc, extra_output_buffer, OUTPUT_BUFFER_SIZE); 215 209 } 216 210
Note:
See TracChangeset
for help on using the changeset viewer.