Changeset 132ab5d1 in mainline for uspace/lib/pcut/src/os/helenos.c


Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (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.
Message:

Merge commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

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

    r8bfb163 r132ab5d1  
    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        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;
    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
     
    213214
    214215        aoff64_t pos = 0;
    215         vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE);
     216        size_t nread;
     217        vfs_read(tempfile, &pos, extra_output_buffer, OUTPUT_BUFFER_SIZE, &nread);
    216218
    217219leave_close_tempfile:
     
    220222
    221223        pcut_report_test_done_unparsed(test, status, extra_output_buffer, OUTPUT_BUFFER_SIZE);
     224
     225        return status;
    222226}
    223227
Note: See TracChangeset for help on using the changeset viewer.