Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/pcut/src/os/helenos.c

    r6afc9d7 rce04ea44  
    4141#include <stdio.h>
    4242#include <task.h>
    43 #include <fcntl.h>
    4443#include <fibril_synch.h>
     44#include <vfs/vfs.h>
    4545#include "../internal.h"
    4646
     
    161161        char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
    162162        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);
    164164        if (tempfile < 0) {
    165165                pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to create temporary file.", NULL, NULL);
     
    169169        char test_number_argument[MAX_TEST_NUMBER_WIDTH];
    170170        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;
    178171
    179172        const char *const arguments[3] = {
     
    186179
    187180        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);
    189183        if (rc != EOK) {
    190184                status = TEST_OUTCOME_ERROR;
     
    220214        fibril_mutex_unlock(&forced_termination_mutex);
    221215
    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);
    223218
    224219leave_close_tempfile:
    225         close(tempfile);
    226         unlink(tempfile_name);
     220        vfs_put(tempfile);
     221        vfs_unlink_path(tempfile_name);
    227222
    228223        pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
Note: See TracChangeset for help on using the changeset viewer.