Ignore:
File:
1 edited

Legend:

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

    r8e3498b rb7fd2a0  
    6868}
    6969
    70 void pcut_str_error(int error, char *buffer, int size) {
     70void pcut_str_error(errno_t error, char *buffer, int size) {
    7171        const char *str = str_error(error);
    7272        if (str == NULL) {
     
    130130 * @return EOK Always.
    131131 */
    132 static int test_timeout_handler_fibril(void *arg) {
     132static errno_t test_timeout_handler_fibril(void *arg) {
    133133        pcut_item_t *test = arg;
    134134        int timeout_sec = pcut_get_test_timeout(test);
     
    139139                goto leave_no_kill;
    140140        }
    141         int rc = fibril_condvar_wait_timeout(&forced_termination_cv,
     141        errno_t rc = fibril_condvar_wait_timeout(&forced_termination_cv,
    142142                &forced_termination_mutex, timeout_us);
    143143        if (rc == ETIMEOUT) {
     
    154154 * @param test Test to be run.
    155155 */
    156 void pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
     156int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
    157157        before_test_start(test);
    158158
    159159        char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
    160160        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;
    165166        }
    166167
     
    174175        };
    175176
    176         int status = TEST_OUTCOME_PASS;
     177        int status = PCUT_OUTCOME_PASS;
    177178
    178179        task_wait_t test_task_wait;
    179         int rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,
     180        rc = task_spawnvf(&test_task_id, &test_task_wait, self_path, arguments,
    180181            fileno(stdin), tempfile, tempfile);
    181182        if (rc != EOK) {
    182                 status = TEST_OUTCOME_ERROR;
     183                status = PCUT_OUTCOME_INTERNAL_ERROR;
    183184                goto leave_close_tempfile;
    184185        }
     
    198199        rc = task_wait(&test_task_wait, &task_exit, &task_retval);
    199200        if (rc != EOK) {
    200                 status = TEST_OUTCOME_ERROR;
     201                status = PCUT_OUTCOME_INTERNAL_ERROR;
    201202                goto leave_close_tempfile;
    202203        }
    203204        if (task_exit == TASK_EXIT_UNEXPECTED) {
    204                 status = TEST_OUTCOME_ERROR;
     205                status = PCUT_OUTCOME_INTERNAL_ERROR;
    205206        } else {
    206                 status = task_retval == 0 ? TEST_OUTCOME_PASS : TEST_OUTCOME_FAIL;
     207                status = task_retval == 0 ? PCUT_OUTCOME_PASS : PCUT_OUTCOME_FAIL;
    207208        }
    208209
     
    221222
    222223        pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
     224
     225        return status;
    223226}
    224227
Note: See TracChangeset for help on using the changeset viewer.