Changeset 9eb1ff5 in mainline for uspace/lib/pcut/src/os/generic.c


Ignore:
Timestamp:
2017-12-08T14:47:08Z (8 years ago)
Author:
Vojtech Horky <vojtech.horky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1694b6b
Parents:
6fb8b2c
Message:

Update PCUT

Updated PCUT to commit 7ce059f.

Notable changes include:

  • overall summary is printed when tests finish
  • when tests passed, the status message does not use the word 'failure'
  • program exit code is zero only when all tests passed

These changes fixes tickets 713 and 714.

http://www.helenos.org/ticket/713
http://www.helenos.org/ticket/714

File:
1 edited

Legend:

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

    r6fb8b2c r9eb1ff5  
    3434#include <stdlib.h>
    3535#include <stdio.h>
     36#include <sys/types.h>
    3637#include <errno.h>
    3738#include <assert.h>
     
    9495static int convert_wait_status_to_outcome(int status) {
    9596        if (status < 0) {
    96                 return TEST_OUTCOME_ERROR;
     97                return PCUT_OUTCOME_INTERNAL_ERROR;
    9798        } else if (status == 0) {
    98                 return TEST_OUTCOME_PASS;
     99                return PCUT_OUTCOME_PASS;
    99100        } else {
    100                 return TEST_OUTCOME_FAIL;
     101                return PCUT_OUTCOME_FAIL;
    101102        }
    102103}
     
    107108 * @param test Test to be run.
    108109 */
    109 void pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
    110         int rc;
     110int pcut_run_test_forking(const char *self_path, pcut_item_t *test) {
     111        int rc, outcome;
    111112        FILE *tempfile;
    112113        char tempfile_name[PCUT_TEMP_FILENAME_BUFFER_SIZE];
     
    126127        PCUT_DEBUG("system() returned 0x%04X", rc);
    127128
    128         rc = convert_wait_status_to_outcome(rc);
     129        outcome = convert_wait_status_to_outcome(rc);
    129130
    130131        tempfile = fopen(tempfile_name, "rb");
    131132        if (tempfile == NULL) {
    132133                pcut_report_test_done(test, TEST_OUTCOME_ERROR, "Failed to open temporary file.", NULL, NULL);
    133                 return;
     134                return PCUT_OUTCOME_INTERNAL_ERROR;
    134135        }
    135136
    136137        fread(extra_output_buffer, 1, OUTPUT_BUFFER_SIZE, tempfile);
    137138        fclose(tempfile);
    138         unlink(tempfile_name);
     139        remove(tempfile_name);
    139140
    140         pcut_report_test_done_unparsed(test, rc, extra_output_buffer, OUTPUT_BUFFER_SIZE);
     141        pcut_report_test_done_unparsed(test, outcome, extra_output_buffer, OUTPUT_BUFFER_SIZE);
     142
     143        return outcome;
    141144}
    142145
Note: See TracChangeset for help on using the changeset viewer.