Changes in uspace/lib/pcut/src/os/helenos.c [8e3498b:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/helenos.c
r8e3498b rb7fd2a0 68 68 } 69 69 70 void pcut_str_error( int error, char *buffer, int size) {70 void pcut_str_error(errno_t error, char *buffer, int size) { 71 71 const char *str = str_error(error); 72 72 if (str == NULL) { … … 130 130 * @return EOK Always. 131 131 */ 132 static int test_timeout_handler_fibril(void *arg) {132 static errno_t test_timeout_handler_fibril(void *arg) { 133 133 pcut_item_t *test = arg; 134 134 int timeout_sec = pcut_get_test_timeout(test); … … 139 139 goto leave_no_kill; 140 140 } 141 int rc = fibril_condvar_wait_timeout(&forced_termination_cv,141 errno_t rc = fibril_condvar_wait_timeout(&forced_termination_cv, 142 142 &forced_termination_mutex, timeout_us); 143 143 if (rc == ETIMEOUT) { … … 154 154 * @param test Test to be run. 155 155 */ 156 voidpcut_run_test_forking(const char *self_path, pcut_item_t *test) {156 int pcut_run_test_forking(const char *self_path, pcut_item_t *test) { 157 157 before_test_start(test); 158 158 159 159 char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE]; 160 160 snprintf(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1, "pcut_%lld.tmp", (unsigned long long) task_get_id()); 161 int tempfile = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE); 162 if (tempfile < 0) { 163 pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to create temporary file.", NULL, NULL); 164 return; 161 int tempfile; 162 errno_t rc = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE, &tempfile); 163 if (rc != EOK) { 164 pcut_report_test_done(test, PCUT_OUTCOME_INTERNAL_ERROR, "Failed to create temporary file.", NULL, NULL); 165 return PCUT_OUTCOME_INTERNAL_ERROR; 165 166 } 166 167 … … 174 175 }; 175 176 176 int status = TEST_OUTCOME_PASS;177 int status = PCUT_OUTCOME_PASS; 177 178 178 179 task_wait_t test_task_wait; 179 intrc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,180 rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments, 180 181 fileno(stdin), tempfile, tempfile); 181 182 if (rc != EOK) { 182 status = TEST_OUTCOME_ERROR;183 status = PCUT_OUTCOME_INTERNAL_ERROR; 183 184 goto leave_close_tempfile; 184 185 } … … 198 199 rc = task_wait(&test_task_wait, &task_exit, &task_retval); 199 200 if (rc != EOK) { 200 status = TEST_OUTCOME_ERROR;201 status = PCUT_OUTCOME_INTERNAL_ERROR; 201 202 goto leave_close_tempfile; 202 203 } 203 204 if (task_exit == TASK_EXIT_UNEXPECTED) { 204 status = TEST_OUTCOME_ERROR;205 status = PCUT_OUTCOME_INTERNAL_ERROR; 205 206 } else { 206 status = task_retval == 0 ? TEST_OUTCOME_PASS : TEST_OUTCOME_FAIL;207 status = task_retval == 0 ? PCUT_OUTCOME_PASS : PCUT_OUTCOME_FAIL; 207 208 } 208 209 … … 221 222 222 223 pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE); 224 225 return status; 223 226 } 224 227
Note:
See TracChangeset
for help on using the changeset viewer.