check.c revision a747113422afaa29ce72d2c5ba7f0b7ea9ec2054
/*
* Automated Testing Framework (atf)
*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* ---------------------------------------------------------------------
* Auxiliary functions.
* --------------------------------------------------------------------- */
static
{
atf_config_get("atf_workdir"));
if (atf_is_error(err))
goto out;
if (atf_is_error(err)) {
goto out;
}
out:
return err;
}
static
void
const atf_fs_path_t *errfile)
{
{
if (atf_is_error(err)) {
} else
}
{
if (atf_is_error(err)) {
} else
}
{
}
}
static
int
{
#define UNCONST(a) ((void *)(unsigned long)(const void *)(a))
}
static
{
else
return err;
}
static
{
if (atf_is_error(err))
goto out;
if (atf_is_error(err)) {
goto out;
}
out:
return err;
}
struct exec_data {
const char *const *m_argv;
};
static void exec_child(void *) ATF_DEFS_ATTRIBUTE_NORETURN;
static
void
exec_child(void *v)
{
exit(127);
}
static
{
if (atf_is_error(err))
goto out;
if (atf_is_error(err))
goto out_sbs;
out:
return err;
}
static
void
update_success_from_status(const char *progname,
{
bool s = atf_process_status_exited(status) &&
if (atf_process_status_exited(status)) {
INV(s);
else {
INV(!s);
}
} else if (atf_process_status_signaled(status)) {
INV(!s);
} else {
INV(!s);
}
*success = s;
}
static
array_to_list(const char *const *a, atf_list_t *l)
{
err = atf_list_init(l);
if (atf_is_error(err))
goto out;
while (*a != NULL) {
err = atf_no_memory_error();
goto out;
}
if (atf_is_error(err))
goto out;
a++;
}
out:
return err;
}
static void
{
const char *const *ptr;
printf("\n");
}
static
{
if (atf_is_error(err))
goto out;
out:
return err;
}
/* ---------------------------------------------------------------------
* The "atf_check_result" type.
* --------------------------------------------------------------------- */
struct atf_check_result_impl {
};
static
const atf_fs_path_t *dir)
{
return atf_no_memory_error();
if (atf_is_error(err))
goto out;
if (atf_is_error(err))
goto err_argv;
if (atf_is_error(err))
goto err_dir;
if (atf_is_error(err))
goto err_stdout;
goto out;
out:
return err;
}
void
{
}
const char *
atf_check_result_stdout(const atf_check_result_t *r)
{
}
const char *
atf_check_result_stderr(const atf_check_result_t *r)
{
}
bool
atf_check_result_exited(const atf_check_result_t *r)
{
}
int
atf_check_result_exitcode(const atf_check_result_t *r)
{
}
bool
atf_check_result_signaled(const atf_check_result_t *r)
{
}
int
atf_check_result_termsig(const atf_check_result_t *r)
{
}
/* ---------------------------------------------------------------------
* Free functions.
* --------------------------------------------------------------------- */
/* XXX: This function shouldn't be in this module. It messes with stdout
* and stderr, and it provides a very high-end interface. This belongs,
* probably, somewhere related to test cases (such as in the tc module). */
atf_check_build_c_o(const char *sfile,
const char *ofile,
const char *const optargs[],
bool *success)
{
char **argv;
if (atf_is_error(err))
goto out;
out:
return err;
}
atf_check_build_cpp(const char *sfile,
const char *ofile,
const char *const optargs[],
bool *success)
{
char **argv;
if (atf_is_error(err))
goto out;
out:
return err;
}
atf_check_build_cxx_o(const char *sfile,
const char *ofile,
const char *const optargs[],
bool *success)
{
char **argv;
if (atf_is_error(err))
goto out;
out:
return err;
}
{
if (atf_is_error(err))
goto out;
if (atf_is_error(err)) {
goto out;
}
if (atf_is_error(err)) {
goto out;
}
out:
return err;
}