Changeset 9eb1ff5 in mainline for uspace/lib/pcut/src/os/unix.c
- Timestamp:
- 2017-12-08T14:47:08Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1694b6b
- Parents:
- 6fb8b2c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/unix.c
r6fb8b2c r9eb1ff5 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_SOURCE 41 38 42 #include <stdlib.h> 39 43 #include <unistd.h> 40 #include <s tddef.h>44 #include <sys/types.h> 41 45 #include <signal.h> 42 46 #include <errno.h> … … 120 124 if (WIFEXITED(status)) { 121 125 if (WEXITSTATUS(status) != 0) { 122 return TEST_OUTCOME_FAIL;126 return PCUT_OUTCOME_FAIL; 123 127 } else { 124 return TEST_OUTCOME_PASS;128 return PCUT_OUTCOME_PASS; 125 129 } 126 130 } 127 131 128 132 if (WIFSIGNALED(status)) { 129 return TEST_OUTCOME_ERROR;133 return PCUT_OUTCOME_INTERNAL_ERROR; 130 134 } 131 135 … … 138 142 * @param test Test to be run. 139 143 */ 140 voidpcut_run_test_forking(const char *self_path, pcut_item_t *test) {144 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) { 141 145 int link_stdout[2], link_stderr[2]; 142 int rc, status ;146 int rc, status, outcome; 143 147 size_t stderr_size; 144 148 … … 152 156 snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 153 157 "pipe() failed: %s.", strerror(rc)); 154 pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL);155 return ;158 pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL); 159 return PCUT_OUTCOME_INTERNAL_ERROR; 156 160 } 157 161 rc = pipe(link_stderr); … … 159 163 snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 160 164 "pipe() failed: %s.", strerror(rc)); 161 pcut_report_test_done(test, TEST_OUTCOME_ERROR, error_message_buffer, NULL, NULL);162 return ;165 pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, error_message_buffer, NULL, NULL); 166 return PCUT_OUTCOME_INTERNAL_ERROR; 163 167 } 164 168 … … 167 171 snprintf(error_message_buffer, OUTPUT_BUFFER_SIZE - 1, 168 172 "fork() failed: %s.", strerror(rc)); 169 rc = TEST_OUTCOME_ERROR;173 outcome = PCUT_OUTCOME_INTERNAL_ERROR; 170 174 goto leave_close_pipes; 171 175 } … … 178 182 close(link_stderr[0]); 179 183 180 rc= pcut_run_test_forked(test);181 182 exit( rc);184 outcome = pcut_run_test_forked(test); 185 186 exit(outcome); 183 187 } 184 188 … … 195 199 alarm(0); 196 200 197 rc= convert_wait_status_to_outcome(status);201 outcome = convert_wait_status_to_outcome(status); 198 202 199 203 goto leave_close_parent_pipe; … … 206 210 close(link_stderr[0]); 207 211 208 pcut_report_test_done_unparsed(test, rc, extra_output_buffer, OUTPUT_BUFFER_SIZE); 212 pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE); 213 214 return outcome; 209 215 } 210 216
Note:
See TracChangeset
for help on using the changeset viewer.