~ubuntu-branches/ubuntu/raring/bind9/raring

« back to all changes in this revision

Viewing changes to unit/atf-src/atf-c/tc.h

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2012-01-19 12:30:31 UTC
  • mfrom: (1.9.1) (26.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20120119123031-0j2wlg66ll5ogpz2
Tags: 1:9.8.1.dfsg.P1-1~build1
preciseĀ upload

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Automated Testing Framework (atf)
 
3
 *
 
4
 * Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
 
5
 * All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions
 
9
 * are met:
 
10
 * 1. Redistributions of source code must retain the above copyright
 
11
 *    notice, this list of conditions and the following disclaimer.
 
12
 * 2. Redistributions in binary form must reproduce the above copyright
 
13
 *    notice, this list of conditions and the following disclaimer in the
 
14
 *    documentation and/or other materials provided with the distribution.
 
15
 *
 
16
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
 
17
 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
 
18
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 
19
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 
20
 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
 
21
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 
23
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
24
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 
25
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 
27
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
28
 */
 
29
 
 
30
#if !defined(ATF_C_TC_H)
 
31
#define ATF_C_TC_H
 
32
 
 
33
#include <stdbool.h>
 
34
#include <stddef.h>
 
35
 
 
36
#include <atf-c/defs.h>
 
37
#include <atf-c/error_fwd.h>
 
38
 
 
39
struct atf_tc;
 
40
 
 
41
typedef void (*atf_tc_head_t)(struct atf_tc *);
 
42
typedef void (*atf_tc_body_t)(const struct atf_tc *);
 
43
typedef void (*atf_tc_cleanup_t)(const struct atf_tc *);
 
44
 
 
45
/* ---------------------------------------------------------------------
 
46
 * The "atf_tc_pack" type.
 
47
 * --------------------------------------------------------------------- */
 
48
 
 
49
/* For static initialization only. */
 
50
struct atf_tc_pack {
 
51
    const char *m_ident;
 
52
 
 
53
    const char *const *m_config;
 
54
 
 
55
    atf_tc_head_t m_head;
 
56
    atf_tc_body_t m_body;
 
57
    atf_tc_cleanup_t m_cleanup;
 
58
};
 
59
typedef const struct atf_tc_pack atf_tc_pack_t;
 
60
 
 
61
/* ---------------------------------------------------------------------
 
62
 * The "atf_tc" type.
 
63
 * --------------------------------------------------------------------- */
 
64
 
 
65
struct atf_tc_impl;
 
66
struct atf_tc {
 
67
    struct atf_tc_impl *pimpl;
 
68
};
 
69
typedef struct atf_tc atf_tc_t;
 
70
 
 
71
/* Constructors/destructors. */
 
72
atf_error_t atf_tc_init(atf_tc_t *, const char *, atf_tc_head_t,
 
73
                        atf_tc_body_t, atf_tc_cleanup_t,
 
74
                        const char *const *);
 
75
atf_error_t atf_tc_init_pack(atf_tc_t *, atf_tc_pack_t *,
 
76
                             const char *const *);
 
77
void atf_tc_fini(atf_tc_t *);
 
78
 
 
79
/* Getters. */
 
80
const char *atf_tc_get_ident(const atf_tc_t *);
 
81
const char *atf_tc_get_config_var(const atf_tc_t *, const char *);
 
82
const char *atf_tc_get_config_var_wd(const atf_tc_t *, const char *,
 
83
                                     const char *);
 
84
bool atf_tc_get_config_var_as_bool(const atf_tc_t *, const char *);
 
85
bool atf_tc_get_config_var_as_bool_wd(const atf_tc_t *, const char *,
 
86
                                      const bool);
 
87
long atf_tc_get_config_var_as_long(const atf_tc_t *, const char *);
 
88
long atf_tc_get_config_var_as_long_wd(const atf_tc_t *, const char *,
 
89
                                      const long);
 
90
const char *atf_tc_get_md_var(const atf_tc_t *, const char *);
 
91
char **atf_tc_get_md_vars(const atf_tc_t *);
 
92
bool atf_tc_has_config_var(const atf_tc_t *, const char *);
 
93
bool atf_tc_has_md_var(const atf_tc_t *, const char *);
 
94
 
 
95
/* Modifiers. */
 
96
atf_error_t atf_tc_set_md_var(atf_tc_t *, const char *, const char *, ...);
 
97
 
 
98
/* ---------------------------------------------------------------------
 
99
 * Free functions.
 
100
 * --------------------------------------------------------------------- */
 
101
 
 
102
atf_error_t atf_tc_run(const atf_tc_t *, const char *);
 
103
atf_error_t atf_tc_cleanup(const atf_tc_t *);
 
104
 
 
105
/* To be run from test case bodies only. */
 
106
void atf_tc_fail(const char *, ...) ATF_DEFS_ATTRIBUTE_NORETURN;
 
107
void atf_tc_fail_nonfatal(const char *, ...);
 
108
void atf_tc_pass(void) ATF_DEFS_ATTRIBUTE_NORETURN;
 
109
void atf_tc_require_prog(const char *);
 
110
void atf_tc_skip(const char *, ...) ATF_DEFS_ATTRIBUTE_NORETURN;
 
111
void atf_tc_expect_pass(void);
 
112
void atf_tc_expect_fail(const char *, ...);
 
113
void atf_tc_expect_exit(const int, const char *, ...);
 
114
void atf_tc_expect_signal(const int, const char *, ...);
 
115
void atf_tc_expect_death(const char *, ...);
 
116
void atf_tc_expect_timeout(const char *, ...);
 
117
 
 
118
/* To be run from test case bodies only; internal to macros.h. */
 
119
void atf_tc_fail_check(const char *, const size_t, const char *, ...);
 
120
void atf_tc_fail_requirement(const char *, const size_t, const char *, ...)
 
121
     ATF_DEFS_ATTRIBUTE_NORETURN;
 
122
void atf_tc_check_errno(const char *, const size_t, const int,
 
123
                        const char *, const bool);
 
124
void atf_tc_require_errno(const char *, const size_t, const int,
 
125
                          const char *, const bool);
 
126
 
 
127
#endif /* ATF_C_TC_H */