2009-07-16 17:39:16 +00:00
|
|
|
/*
|
|
|
|
* Check: a unit test framework for C
|
|
|
|
* Copyright (C) 2001, 2002 Arien Malec
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "check.h"
|
|
|
|
#include "check_error.h"
|
|
|
|
#include "check_list.h"
|
|
|
|
#include "check_impl.h"
|
|
|
|
#include "check_msg.h"
|
|
|
|
|
|
|
|
#ifndef DEFAULT_TIMEOUT
|
|
|
|
#define DEFAULT_TIMEOUT 4
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int check_major_version = CHECK_MAJOR_VERSION;
|
|
|
|
int check_minor_version = CHECK_MINOR_VERSION;
|
|
|
|
int check_micro_version = CHECK_MICRO_VERSION;
|
|
|
|
|
|
|
|
static int non_pass (int val);
|
|
|
|
static Fixture *fixture_create (SFun fun, int ischecked);
|
2009-10-12 11:49:35 +00:00
|
|
|
static void tcase_add_fixture (TCase * tc, SFun setup, SFun teardown,
|
|
|
|
int ischecked);
|
|
|
|
static void tr_init (TestResult * tr);
|
|
|
|
static void suite_free (Suite * s);
|
|
|
|
static void tcase_free (TCase * tc);
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
#undef malloc
|
|
|
|
#undef realloc
|
|
|
|
#undef strsignal
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
void *malloc (size_t n);
|
|
|
|
void *realloc (void *p, size_t n);
|
2009-10-12 11:49:35 +00:00
|
|
|
char *strsignal (int sig);
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
void *rpl_malloc (size_t n);
|
|
|
|
void *rpl_realloc (void *p, size_t n);
|
2009-10-12 11:49:35 +00:00
|
|
|
static const char *rpl_strsignal (int sig);
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
/* Allocate an N-byte block of memory from the heap. If N is zero,
|
|
|
|
allocate a 1-byte block. */
|
|
|
|
void *
|
|
|
|
rpl_malloc (size_t n)
|
|
|
|
{
|
|
|
|
if (n == 0)
|
|
|
|
n = 1;
|
|
|
|
return malloc (n);
|
2009-10-12 11:49:35 +00:00
|
|
|
}
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
/* AC_FUNC_REALLOC in configure defines realloc to rpl_realloc if
|
|
|
|
realloc(0,0) is NULL to make it GNU compatible and always return a
|
|
|
|
valid pointer, same for AC_FUNC_MALLOC, malloc, and rpl_malloc.
|
|
|
|
rpl means `replacement'.
|
|
|
|
|
|
|
|
If this ever turns out to be a problem, it might be easiest to just
|
|
|
|
kill the configure macro calls.
|
|
|
|
*/
|
|
|
|
void *
|
|
|
|
rpl_realloc (void *p, size_t n)
|
|
|
|
{
|
|
|
|
if (n == 0)
|
|
|
|
n = 1;
|
|
|
|
if (p == 0)
|
|
|
|
return malloc (n);
|
|
|
|
return realloc (p, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We simply don't have strsignal on some platforms. This function
|
|
|
|
should get used if AC_REPLACE_FUNCS([strsignal]) cannot find
|
|
|
|
something acceptable. Note that Gnulib has a much much much more
|
|
|
|
advanced version of strsignal, but we don't really care.
|
|
|
|
*/
|
|
|
|
static const char *
|
|
|
|
rpl_strsignal (int sig)
|
|
|
|
{
|
|
|
|
static char signame[40];
|
2009-10-12 11:49:35 +00:00
|
|
|
|
|
|
|
sprintf (signame, "SIG #%d", sig);
|
2009-07-16 17:39:16 +00:00
|
|
|
return signame;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
Suite *
|
|
|
|
suite_create (const char *name)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
Suite *s;
|
2009-10-12 11:49:35 +00:00
|
|
|
s = emalloc (sizeof (Suite)); /* freed in suite_free */
|
2009-07-16 17:39:16 +00:00
|
|
|
if (name == NULL)
|
|
|
|
s->name = "";
|
|
|
|
else
|
|
|
|
s->name = name;
|
2009-10-12 11:49:35 +00:00
|
|
|
s->tclst = check_list_create ();
|
2009-07-16 17:39:16 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
static void
|
|
|
|
suite_free (Suite * s)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
List *l;
|
|
|
|
if (s == NULL)
|
|
|
|
return;
|
|
|
|
l = s->tclst;
|
2009-10-12 11:49:35 +00:00
|
|
|
for (list_front (l); !list_at_end (l); list_advance (l)) {
|
|
|
|
tcase_free (list_val (l));
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
list_free (s->tclst);
|
2009-10-12 11:49:35 +00:00
|
|
|
free (s);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
TCase *
|
|
|
|
tcase_create (const char *name)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
char *env;
|
|
|
|
int timeout = DEFAULT_TIMEOUT;
|
2009-10-12 11:49:35 +00:00
|
|
|
TCase *tc = emalloc (sizeof (TCase)); /*freed in tcase_free */
|
2009-07-16 17:39:16 +00:00
|
|
|
if (name == NULL)
|
|
|
|
tc->name = "";
|
|
|
|
else
|
|
|
|
tc->name = name;
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
env = getenv ("CK_DEFAULT_TIMEOUT");
|
2009-07-16 17:39:16 +00:00
|
|
|
if (env != NULL) {
|
2009-10-12 11:49:35 +00:00
|
|
|
int tmp = atoi (env);
|
2009-07-16 17:39:16 +00:00
|
|
|
if (tmp >= 0) {
|
|
|
|
timeout = tmp;
|
|
|
|
}
|
|
|
|
}
|
2009-10-12 11:49:35 +00:00
|
|
|
|
2009-07-16 17:39:16 +00:00
|
|
|
tc->timeout = timeout;
|
2009-10-12 11:49:35 +00:00
|
|
|
tc->tflst = check_list_create ();
|
|
|
|
tc->unch_sflst = check_list_create ();
|
|
|
|
tc->ch_sflst = check_list_create ();
|
|
|
|
tc->unch_tflst = check_list_create ();
|
|
|
|
tc->ch_tflst = check_list_create ();
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
return tc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
static void
|
|
|
|
tcase_free (TCase * tc)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
list_apply (tc->tflst, free);
|
|
|
|
list_apply (tc->unch_sflst, free);
|
|
|
|
list_apply (tc->ch_sflst, free);
|
|
|
|
list_apply (tc->unch_tflst, free);
|
|
|
|
list_apply (tc->ch_tflst, free);
|
2009-10-12 11:49:35 +00:00
|
|
|
list_free (tc->tflst);
|
|
|
|
list_free (tc->unch_sflst);
|
|
|
|
list_free (tc->ch_sflst);
|
|
|
|
list_free (tc->unch_tflst);
|
|
|
|
list_free (tc->ch_tflst);
|
|
|
|
|
|
|
|
free (tc);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
suite_add_tcase (Suite * s, TCase * tc)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
if (s == NULL || tc == NULL)
|
|
|
|
return;
|
|
|
|
list_add_end (s->tclst, tc);
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
_tcase_add_test (TCase * tc, TFun fn, const char *name, int _signal, int start,
|
|
|
|
int end)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
2009-10-12 11:49:35 +00:00
|
|
|
TF *tf;
|
2009-07-16 17:39:16 +00:00
|
|
|
if (tc == NULL || fn == NULL || name == NULL)
|
|
|
|
return;
|
2009-10-12 11:49:35 +00:00
|
|
|
tf = emalloc (sizeof (TF)); /* freed in tcase_free */
|
2009-07-16 17:39:16 +00:00
|
|
|
tf->fn = fn;
|
|
|
|
tf->loop_start = start;
|
|
|
|
tf->loop_end = end;
|
2009-10-12 11:49:35 +00:00
|
|
|
tf->signal = _signal; /* 0 means no signal expected */
|
2009-07-16 17:39:16 +00:00
|
|
|
tf->name = name;
|
|
|
|
list_add_end (tc->tflst, tf);
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
static Fixture *
|
|
|
|
fixture_create (SFun fun, int ischecked)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
Fixture *f;
|
2009-10-12 11:49:35 +00:00
|
|
|
f = emalloc (sizeof (Fixture));
|
2009-07-16 17:39:16 +00:00
|
|
|
f->fun = fun;
|
|
|
|
f->ischecked = ischecked;
|
|
|
|
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
tcase_add_unchecked_fixture (TCase * tc, SFun setup, SFun teardown)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
2009-10-12 11:49:35 +00:00
|
|
|
tcase_add_fixture (tc, setup, teardown, 0);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
tcase_add_checked_fixture (TCase * tc, SFun setup, SFun teardown)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
2009-10-12 11:49:35 +00:00
|
|
|
tcase_add_fixture (tc, setup, teardown, 1);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
static void
|
|
|
|
tcase_add_fixture (TCase * tc, SFun setup, SFun teardown, int ischecked)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
if (setup) {
|
|
|
|
if (ischecked)
|
2009-10-12 11:49:35 +00:00
|
|
|
list_add_end (tc->ch_sflst, fixture_create (setup, ischecked));
|
2009-07-16 17:39:16 +00:00
|
|
|
else
|
2009-10-12 11:49:35 +00:00
|
|
|
list_add_end (tc->unch_sflst, fixture_create (setup, ischecked));
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add teardowns at front so they are run in reverse order. */
|
|
|
|
if (teardown) {
|
|
|
|
if (ischecked)
|
2009-10-12 11:49:35 +00:00
|
|
|
list_add_front (tc->ch_tflst, fixture_create (teardown, ischecked));
|
2009-07-16 17:39:16 +00:00
|
|
|
else
|
2009-10-12 11:49:35 +00:00
|
|
|
list_add_front (tc->unch_tflst, fixture_create (teardown, ischecked));
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
tcase_set_timeout (TCase * tc, int timeout)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
if (timeout >= 0)
|
|
|
|
tc->timeout = timeout;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
tcase_fn_start (const char *fname, const char *file, int line)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
send_ctx_info (CK_CTX_TEST);
|
|
|
|
send_loc_info (file, line);
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
_mark_point (const char *file, int line)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
send_loc_info (file, line);
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
_fail_unless (int result, const char *file, int line, const char *expr, ...)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
const char *msg;
|
2009-10-12 11:49:35 +00:00
|
|
|
|
2009-07-16 17:39:16 +00:00
|
|
|
send_loc_info (file, line);
|
|
|
|
if (!result) {
|
|
|
|
va_list ap;
|
|
|
|
char buf[BUFSIZ];
|
2009-10-12 11:49:35 +00:00
|
|
|
|
|
|
|
va_start (ap, expr);
|
|
|
|
msg = (const char *) va_arg (ap, char *);
|
2009-07-16 17:39:16 +00:00
|
|
|
if (msg == NULL)
|
|
|
|
msg = expr;
|
2009-10-12 11:49:35 +00:00
|
|
|
vsnprintf (buf, BUFSIZ, msg, ap);
|
|
|
|
va_end (ap);
|
2009-07-16 17:39:16 +00:00
|
|
|
send_failure_info (buf);
|
2009-10-12 11:49:35 +00:00
|
|
|
if (cur_fork_status () == CK_FORK)
|
|
|
|
exit (1);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
SRunner *
|
|
|
|
srunner_create (Suite * s)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
2009-10-12 11:49:35 +00:00
|
|
|
SRunner *sr = emalloc (sizeof (SRunner)); /* freed in srunner_free */
|
|
|
|
sr->slst = check_list_create ();
|
2009-07-16 17:39:16 +00:00
|
|
|
if (s != NULL)
|
2009-10-12 11:49:35 +00:00
|
|
|
list_add_end (sr->slst, s);
|
|
|
|
sr->stats = emalloc (sizeof (TestStats)); /* freed in srunner_free */
|
2009-07-16 17:39:16 +00:00
|
|
|
sr->stats->n_checked = sr->stats->n_failed = sr->stats->n_errors = 0;
|
2009-10-12 11:49:35 +00:00
|
|
|
sr->resultlst = check_list_create ();
|
2009-07-16 17:39:16 +00:00
|
|
|
sr->log_fname = NULL;
|
|
|
|
sr->xml_fname = NULL;
|
|
|
|
sr->loglst = NULL;
|
|
|
|
sr->fstat = CK_FORK_GETENV;
|
|
|
|
return sr;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
srunner_add_suite (SRunner * sr, Suite * s)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
if (s == NULL)
|
|
|
|
return;
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
list_add_end (sr->slst, s);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
srunner_free (SRunner * sr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
List *l;
|
|
|
|
TestResult *tr;
|
|
|
|
if (sr == NULL)
|
|
|
|
return;
|
2009-10-12 11:49:35 +00:00
|
|
|
|
2009-07-16 17:39:16 +00:00
|
|
|
free (sr->stats);
|
|
|
|
l = sr->slst;
|
2009-10-12 11:49:35 +00:00
|
|
|
for (list_front (l); !list_at_end (l); list_advance (l)) {
|
|
|
|
suite_free (list_val (l));
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
2009-10-12 11:49:35 +00:00
|
|
|
list_free (sr->slst);
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
l = sr->resultlst;
|
2009-10-12 11:49:35 +00:00
|
|
|
for (list_front (l); !list_at_end (l); list_advance (l)) {
|
|
|
|
tr = list_val (l);
|
|
|
|
free (tr->file);
|
|
|
|
free (tr->msg);
|
|
|
|
free (tr);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
list_free (sr->resultlst);
|
|
|
|
|
|
|
|
free (sr);
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
int
|
|
|
|
srunner_ntests_failed (SRunner * sr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return sr->stats->n_failed + sr->stats->n_errors;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
int
|
|
|
|
srunner_ntests_run (SRunner * sr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return sr->stats->n_checked;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
TestResult **
|
|
|
|
srunner_failures (SRunner * sr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
TestResult **trarray;
|
|
|
|
List *rlst;
|
2009-10-12 11:49:35 +00:00
|
|
|
trarray = malloc (sizeof (trarray[0]) * srunner_ntests_failed (sr));
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
rlst = sr->resultlst;
|
2009-10-12 11:49:35 +00:00
|
|
|
for (list_front (rlst); !list_at_end (rlst); list_advance (rlst)) {
|
|
|
|
TestResult *tr = list_val (rlst);
|
|
|
|
if (non_pass (tr->rtype))
|
2009-07-16 17:39:16 +00:00
|
|
|
trarray[i++] = tr;
|
2009-10-12 11:49:35 +00:00
|
|
|
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
return trarray;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
TestResult **
|
|
|
|
srunner_results (SRunner * sr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
TestResult **trarray;
|
|
|
|
List *rlst;
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
trarray = malloc (sizeof (trarray[0]) * srunner_ntests_run (sr));
|
2009-07-16 17:39:16 +00:00
|
|
|
|
|
|
|
rlst = sr->resultlst;
|
2009-10-12 11:49:35 +00:00
|
|
|
for (list_front (rlst); !list_at_end (rlst); list_advance (rlst)) {
|
|
|
|
trarray[i++] = list_val (rlst);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
return trarray;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
static int
|
|
|
|
non_pass (int val)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return val != CK_PASS;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
TestResult *
|
|
|
|
tr_create (void)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
TestResult *tr;
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
tr = emalloc (sizeof (TestResult));
|
2009-07-16 17:39:16 +00:00
|
|
|
tr_init (tr);
|
|
|
|
return tr;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
tr_reset (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
2009-10-12 11:49:35 +00:00
|
|
|
tr_init (tr);
|
2009-07-16 17:39:16 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
static void
|
|
|
|
tr_init (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
tr->ctx = CK_CTX_INVALID;
|
|
|
|
tr->line = -1;
|
|
|
|
tr->rtype = CK_TEST_RESULT_INVALID;
|
|
|
|
tr->msg = NULL;
|
|
|
|
tr->file = NULL;
|
|
|
|
tr->tcname = NULL;
|
|
|
|
tr->tname = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
const char *
|
|
|
|
tr_msg (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return tr->msg;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
int
|
|
|
|
tr_lno (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return tr->line;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
const char *
|
|
|
|
tr_lfile (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return tr->file;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
int
|
|
|
|
tr_rtype (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return tr->rtype;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
enum ck_result_ctx
|
|
|
|
tr_ctx (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return tr->ctx;
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
const char *
|
|
|
|
tr_tcname (TestResult * tr)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return tr->tcname;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int _fstat = CK_FORK;
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
void
|
|
|
|
set_fork_status (enum fork_status fstat)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
if (fstat == CK_FORK || fstat == CK_NOFORK || fstat == CK_FORK_GETENV)
|
|
|
|
_fstat = fstat;
|
|
|
|
else
|
|
|
|
eprintf ("Bad status in set_fork_status", __FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
|
2009-10-12 11:49:35 +00:00
|
|
|
enum fork_status
|
|
|
|
cur_fork_status (void)
|
2009-07-16 17:39:16 +00:00
|
|
|
{
|
|
|
|
return _fstat;
|
|
|
|
}
|