Changeset 368ee04 in mainline for uspace/lib/pcut/src/os/helenos.c
- Timestamp:
- 2017-04-05T18:10:39Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 93ad8166
- Parents:
- 39f892a9 (diff), 2166728 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcut/src/os/helenos.c
r39f892a9 r368ee04 41 41 #include <stdio.h> 42 42 #include <task.h> 43 #include <fcntl.h>44 43 #include <fibril_synch.h> 44 #include <vfs/vfs.h> 45 45 #include "../internal.h" 46 46 … … 161 161 char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE]; 162 162 snprintf(tempfile_name, PCUT_TEMP_FILENAME_BUFFER_SIZE - 1, "pcut_%lld.tmp", (unsigned long long) task_get_id()); 163 int tempfile = open(tempfile_name, O_CREAT | O_RDWR);163 int tempfile = vfs_lookup_open(tempfile_name, WALK_REGULAR | WALK_MAY_CREATE, MODE_READ | MODE_WRITE); 164 164 if (tempfile < 0) { 165 165 pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to create temporary file.", NULL, NULL); … … 169 169 char test_number_argument[MAX_TEST_NUMBER_WIDTH]; 170 170 snprintf(test_number_argument, MAX_TEST_NUMBER_WIDTH, "-t%d", test->id); 171 172 int *files[4];173 int fd_stdin = fileno(stdin);174 files[0] = &fd_stdin;175 files[1] = &tempfile;176 files[2] = &tempfile;177 files[3] = NULL;178 171 179 172 const char *const arguments[3] = { … … 186 179 187 180 task_wait_t test_task_wait; 188 int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments, files); 181 int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments, 182 fileno(stdin), tempfile, tempfile); 189 183 if (rc != EOK) { 190 184 status = TEST_OUTCOME_ERROR; … … 220 214 fibril_mutex_unlock(&forced_termination_mutex); 221 215 222 read(tempfile, extra_output_buffer, OUTPUT_BUFFER_SIZE); 216 aoff64_t pos = 0; 217 vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE); 223 218 224 219 leave_close_tempfile: 225 close(tempfile);226 unlink(tempfile_name);220 vfs_put(tempfile); 221 vfs_unlink_path(tempfile_name); 227 222 228 223 pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
Note:
See TracChangeset
for help on using the changeset viewer.