118 #ifdef TEST_FRAMEWORK
120 #define AST_TEST_DEFINE(hdr) static enum ast_test_result_state hdr(struct ast_test_info *info, enum ast_test_command cmd, struct ast_test *test)
121 #define AST_TEST_REGISTER(cb) ast_test_register(cb)
122 #define AST_TEST_UNREGISTER(cb) ast_test_unregister(cb)
126 #define AST_TEST_DEFINE(hdr) static enum ast_test_result_state attribute_unused hdr(struct ast_test_info *info, enum ast_test_command cmd, struct ast_test *test)
127 #define AST_TEST_REGISTER(cb)
128 #define AST_TEST_UNREGISTER(cb)
129 #define ast_test_status_update(a,b,c...)
130 #define ast_test_debug(test, fmt, ...) ast_cli
135 #ifdef TEST_FRAMEWORK
162 struct ast_test_suite_message_payload;
170 struct ast_json *ast_test_suite_get_blob(
struct ast_test_suite_message_payload *payload);
182 #define ast_test_suite_event_notify(s, f, ...) \
183 __ast_test_suite_event_notify(__FILE__, __PRETTY_FUNCTION__, __LINE__, (s), (f), ## __VA_ARGS__)
184 void __ast_test_suite_event_notify(
const char *file,
const char *func,
int line,
const char *
state,
const char *fmt, ...)
185 __attribute__((format(printf, 5, 6)));
189 #define ast_test_suite_event_notify(s, f, ...)
193 enum ast_test_result_state {
199 enum ast_test_command {
268 #ifdef TEST_FRAMEWORK
279 typedef enum ast_test_result_state (ast_test_cb_t)(
struct ast_test_info *info,
280 enum ast_test_command cmd,
struct ast_test *
test);
292 typedef int (ast_test_init_cb_t)(
struct ast_test_info *info,
struct ast_test *
test);
304 typedef int (ast_test_cleanup_cb_t)(
struct ast_test_info *info,
struct ast_test *
test);
314 int ast_test_unregister(ast_test_cb_t *cb);
324 int ast_test_register(ast_test_cb_t *cb);
341 int ast_test_register_init(
const char *category, ast_test_init_cb_t *cb);
357 int ast_test_register_cleanup(
const char *category, ast_test_cleanup_cb_t *cb);
367 void ast_test_debug(
struct ast_test *
test,
const char *fmt, ...) __attribute__((format(printf, 2, 3)));
377 void ast_test_set_result(struct ast_test *test, enum ast_test_result_state state);
389 #define ast_test_status_update(t, f, ...) __ast_test_status_update(__FILE__, __PRETTY_FUNCTION__, __LINE__, (t), (f), ## __VA_ARGS__)
390 int __ast_test_status_update(
const char *file,
const char *func,
int line,
struct ast_test *test,
const char *fmt, ...)
391 __attribute__((format(printf, 5, 6)));
410 #define ast_test_validate(test, condition, ...) \
412 if (!(condition)) { \
413 __ast_test_status_update(__FILE__, __PRETTY_FUNCTION__, __LINE__, (test), "%s: %s\n", strlen(#__VA_ARGS__) ? #__VA_ARGS__ : "Condition failed", #condition); \
414 return AST_TEST_FAIL; \
433 #define ast_test_validate_cleanup(test, condition, rc_variable, cleanup_label) ({ \
434 if (!(condition)) { \
435 ast_test_status_update((test), "%s: %s\n", "Condition failed", #condition); \
436 rc_variable = AST_TEST_FAIL; \
437 goto cleanup_label; \
484 int ast_test_capture_command(
struct ast_test_capture *capture,
const char *file,
char *
const argv[],
const char *data,
unsigned datalen);
Contains all the initialization information required to store a new test definition.
const char * summary
Short summary of test.
pid_t pid
process id of child
size_t errlen
length of buffer holding stderr
char * outbuf
buffer holding stdout
String manipulation functions.
int exitcode
exit code of child
const char * description
More detailed description of test.
const char * name
name of test, unique to category
size_t outlen
length of buffer holding stdout
char * errbuf
buffer holding stderr
const char * category
test category
unsigned int explicit_only
Only run if explicitly named.
A capture of running an external process.
Standard Command Line Interface.
Abstract JSON element (object, array, string, int, ...).