int main(int argc, char** argv)
{
    if (argc != 2) {
        fprintf(stderr, "usage: %s <config-file>\n", argv[0]);
        exit(1);
    }
    int result = 0;

    // Call qd_dispatch() first initialize allocator used by other tests.
    qd_dispatch_t *qd = qd_dispatch(0);
    qd_dispatch_load_config(qd, argv[1]);
    if (qd_error_code()) {
        printf("Config failed: %s\n", qd_error_message());
        return 1;
    }
    result += timer_tests();
    result += server_tests(qd);
    result += tool_tests();
    result += parse_tests();
    result += compose_tests();
#if USE_MEMORY_POOL
    result += alloc_tests();
#endif
    result += policy_tests();
    qd_dispatch_free(qd);       // dispatch_free last.

    return result;
}
Beispiel #2
0
/// Reads an ATF test cases list and prints a Kyua definition.
///
/// \param fd A file descriptor from which to read the test cases list of a test
///     program.  Should be connected to the stdout of the latter.  This
///     function grabs ownership of the descriptor and releases it in all cases.
/// \param [in,out] output File to which to write the Kyua definition.
///
/// \return OK if the parsing succeeds; an error otherwise.  Note that, if there
/// is an error, the output may not be consistent and should not be used.
kyua_error_t
atf_list_parse(const int fd, FILE* output)
{
    kyua_error_t error;

    FILE* input = fdopen(fd, "r");
    if (input == NULL) {
        error = kyua_libc_error_new(errno, "fdopen(%d) failed", fd);
        close(fd);
    } else {
        error = parse_header(input);
        if (!kyua_error_is_set(error)) {
            error = parse_tests(input, output);
        }
        fclose(input);
    }

    return error;
}