Changes in uspace/lib/pcut/src/os/helenos.c [f77c1c9:8d2dd7f2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/helenos.c
rf77c1c9 r8d2dd7f2 154 154 * @param test Test to be run. 155 155 */ 156 intpcut_run_test_forking(const char *self_path, pcut_item_t *test) {156 void 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; 162 int 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; 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; 166 165 } 167 166 … … 175 174 }; 176 175 177 int status = PCUT_OUTCOME_PASS;176 int status = TEST_OUTCOME_PASS; 178 177 179 178 task_wait_t test_task_wait; 180 rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,179 int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments, 181 180 fileno(stdin), tempfile, tempfile); 182 181 if (rc != EOK) { 183 status = PCUT_OUTCOME_INTERNAL_ERROR;182 status = TEST_OUTCOME_ERROR; 184 183 goto leave_close_tempfile; 185 184 } … … 199 198 rc = task_wait(&test_task_wait, &task_exit, &task_retval); 200 199 if (rc != EOK) { 201 status = PCUT_OUTCOME_INTERNAL_ERROR;200 status = TEST_OUTCOME_ERROR; 202 201 goto leave_close_tempfile; 203 202 } 204 203 if (task_exit == TASK_EXIT_UNEXPECTED) { 205 status = PCUT_OUTCOME_INTERNAL_ERROR;204 status = TEST_OUTCOME_ERROR; 206 205 } else { 207 status = task_retval == 0 ? PCUT_OUTCOME_PASS : PCUT_OUTCOME_FAIL;206 status = task_retval == 0 ? TEST_OUTCOME_PASS : TEST_OUTCOME_FAIL; 208 207 } 209 208 … … 214 213 215 214 aoff64_t pos = 0; 216 size_t nread; 217 vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE, &nread); 215 vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE); 218 216 219 217 leave_close_tempfile: … … 222 220 223 221 pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE); 224 225 return status;226 222 } 227 223
Note:
See TracChangeset
for help on using the changeset viewer.