Lines Matching defs:tc
26 #include "atf-c/tc.h"
63 const atf_tc_t *tc;
106 context_init(struct context *ctx, const atf_tc_t *tc, const char *resfile)
108 ctx->tc = tc;
545 atf_tc_init(atf_tc_t *tc, const char *ident, atf_tc_head_t head,
551 tc->pimpl = malloc(sizeof(struct atf_tc_impl));
552 if (tc->pimpl == NULL) {
557 tc->pimpl->m_ident = ident;
558 tc->pimpl->m_head = head;
559 tc->pimpl->m_body = body;
560 tc->pimpl->m_cleanup = cleanup;
562 err = atf_map_init_charpp(&tc->pimpl->m_config, config);
566 err = atf_map_init(&tc->pimpl->m_vars);
570 err = atf_tc_set_md_var(tc, "ident", ident);
575 err = atf_tc_set_md_var(tc, "has.cleanup", "true");
581 if (tc->pimpl->m_head != NULL)
582 tc->pimpl->m_head(tc);
584 if (strcmp(atf_tc_get_md_var(tc, "ident"), ident) != 0) {
594 atf_map_fini(&tc->pimpl->m_vars);
596 atf_map_fini(&tc->pimpl->m_config);
602 atf_tc_init_pack(atf_tc_t *tc, const atf_tc_pack_t *pack,
605 return atf_tc_init(tc, pack->m_ident, pack->m_head, pack->m_body,
610 atf_tc_fini(atf_tc_t *tc)
612 atf_map_fini(&tc->pimpl->m_vars);
613 atf_map_fini(&tc->pimpl->m_config);
614 free(tc->pimpl);
615 tc->pimpl = NULL;
623 atf_tc_get_ident(const atf_tc_t *tc)
625 return tc->pimpl->m_ident;
629 atf_tc_get_config_var(const atf_tc_t *tc, const char *name)
634 PRE(atf_tc_has_config_var(tc, name));
635 iter = atf_map_find_c(&tc->pimpl->m_config, name);
643 atf_tc_get_config_var_wd(const atf_tc_t *tc, const char *name,
648 if (!atf_tc_has_config_var(tc, name))
651 val = atf_tc_get_config_var(tc, name);
657 atf_tc_get_config_var_as_bool(const atf_tc_t *tc, const char *name)
663 strval = atf_tc_get_config_var(tc, name);
675 atf_tc_get_config_var_as_bool_wd(const atf_tc_t *tc, const char *name,
680 if (!atf_tc_has_config_var(tc, name))
683 val = atf_tc_get_config_var_as_bool(tc, name);
689 atf_tc_get_config_var_as_long(const atf_tc_t *tc, const char *name)
695 strval = atf_tc_get_config_var(tc, name);
707 atf_tc_get_config_var_as_long_wd(const atf_tc_t *tc, const char *name,
712 if (!atf_tc_has_config_var(tc, name))
715 val = atf_tc_get_config_var_as_long(tc, name);
721 atf_tc_get_md_var(const atf_tc_t *tc, const char *name)
726 PRE(atf_tc_has_md_var(tc, name));
727 iter = atf_map_find_c(&tc->pimpl->m_vars, name);
735 atf_tc_get_md_vars(const atf_tc_t *tc)
737 return atf_map_to_charpp(&tc->pimpl->m_vars);
741 atf_tc_has_config_var(const atf_tc_t *tc, const char *name)
745 iter = atf_map_find_c(&tc->pimpl->m_config, name);
746 end = atf_map_end_c(&tc->pimpl->m_config);
751 atf_tc_has_md_var(const atf_tc_t *tc, const char *name)
755 iter = atf_map_find_c(&tc->pimpl->m_vars, name);
756 end = atf_map_end_c(&tc->pimpl->m_vars);
765 atf_tc_set_md_var(atf_tc_t *tc, const char *name, const char *fmt, ...)
776 err = atf_map_insert(&tc->pimpl->m_vars, name, value, true);
1006 atf_tc_run(const atf_tc_t *tc, const char *resfile)
1008 context_init(&Current, tc, resfile);
1010 tc->pimpl->m_body(tc);
1034 atf_tc_cleanup(const atf_tc_t *tc)
1036 if (tc->pimpl->m_cleanup != NULL)
1037 tc->pimpl->m_cleanup(tc);
1061 PRE(Current.tc != NULL);
1073 PRE(Current.tc != NULL);
1085 PRE(Current.tc != NULL);
1098 PRE(Current.tc != NULL);
1108 PRE(Current.tc != NULL);
1116 PRE(Current.tc != NULL);
1126 PRE(Current.tc != NULL);
1137 PRE(Current.tc != NULL);
1147 PRE(Current.tc != NULL);
1156 PRE(Current.tc != NULL);
1166 PRE(Current.tc != NULL);
1178 PRE(Current.tc != NULL);
1190 PRE(Current.tc != NULL);
1202 PRE(Current.tc != NULL);
1214 PRE(Current.tc != NULL);