Lines Matching refs:tc
45 #include "atf-c/tc.h"
67 const atf_tc_t *tc;
110 context_init(struct context *ctx, const atf_tc_t *tc, const char *resfile)
112 ctx->tc = tc;
549 atf_tc_init(atf_tc_t *tc, const char *ident, atf_tc_head_t head,
555 tc->pimpl = malloc(sizeof(struct atf_tc_impl));
556 if (tc->pimpl == NULL) {
561 tc->pimpl->m_ident = ident;
562 tc->pimpl->m_head = head;
563 tc->pimpl->m_body = body;
564 tc->pimpl->m_cleanup = cleanup;
566 err = atf_map_init_charpp(&tc->pimpl->m_config, config);
570 err = atf_map_init(&tc->pimpl->m_vars);
574 err = atf_tc_set_md_var(tc, "ident", ident);
579 err = atf_tc_set_md_var(tc, "has.cleanup", "true");
585 if (tc->pimpl->m_head != NULL)
586 tc->pimpl->m_head(tc);
588 if (strcmp(atf_tc_get_md_var(tc, "ident"), ident) != 0) {
598 atf_map_fini(&tc->pimpl->m_vars);
600 atf_map_fini(&tc->pimpl->m_config);
606 atf_tc_init_pack(atf_tc_t *tc, const atf_tc_pack_t *pack,
609 return atf_tc_init(tc, pack->m_ident, pack->m_head, pack->m_body,
614 atf_tc_fini(atf_tc_t *tc)
616 atf_map_fini(&tc->pimpl->m_vars);
617 free(tc->pimpl);
625 atf_tc_get_ident(const atf_tc_t *tc)
627 return tc->pimpl->m_ident;
631 atf_tc_get_config_var(const atf_tc_t *tc, const char *name)
636 PRE(atf_tc_has_config_var(tc, name));
637 iter = atf_map_find_c(&tc->pimpl->m_config, name);
645 atf_tc_get_config_var_wd(const atf_tc_t *tc, const char *name,
650 if (!atf_tc_has_config_var(tc, name))
653 val = atf_tc_get_config_var(tc, name);
659 atf_tc_get_config_var_as_bool(const atf_tc_t *tc, const char *name)
665 strval = atf_tc_get_config_var(tc, name);
677 atf_tc_get_config_var_as_bool_wd(const atf_tc_t *tc, const char *name,
682 if (!atf_tc_has_config_var(tc, name))
685 val = atf_tc_get_config_var_as_bool(tc, name);
691 atf_tc_get_config_var_as_long(const atf_tc_t *tc, const char *name)
697 strval = atf_tc_get_config_var(tc, name);
709 atf_tc_get_config_var_as_long_wd(const atf_tc_t *tc, const char *name,
714 if (!atf_tc_has_config_var(tc, name))
717 val = atf_tc_get_config_var_as_long(tc, name);
723 atf_tc_get_md_var(const atf_tc_t *tc, const char *name)
728 PRE(atf_tc_has_md_var(tc, name));
729 iter = atf_map_find_c(&tc->pimpl->m_vars, name);
737 atf_tc_get_md_vars(const atf_tc_t *tc)
739 return atf_map_to_charpp(&tc->pimpl->m_vars);
743 atf_tc_has_config_var(const atf_tc_t *tc, const char *name)
747 iter = atf_map_find_c(&tc->pimpl->m_config, name);
748 end = atf_map_end_c(&tc->pimpl->m_config);
753 atf_tc_has_md_var(const atf_tc_t *tc, const char *name)
757 iter = atf_map_find_c(&tc->pimpl->m_vars, name);
758 end = atf_map_end_c(&tc->pimpl->m_vars);
767 atf_tc_set_md_var(atf_tc_t *tc, const char *name, const char *fmt, ...)
778 err = atf_map_insert(&tc->pimpl->m_vars, name, value, true);
1008 atf_tc_run(const atf_tc_t *tc, const char *resfile)
1010 context_init(&Current, tc, resfile);
1012 tc->pimpl->m_body(tc);
1036 atf_tc_cleanup(const atf_tc_t *tc)
1038 if (tc->pimpl->m_cleanup != NULL)
1039 tc->pimpl->m_cleanup(tc);
1063 PRE(Current.tc != NULL);
1075 PRE(Current.tc != NULL);
1087 PRE(Current.tc != NULL);
1100 PRE(Current.tc != NULL);
1110 PRE(Current.tc != NULL);
1118 PRE(Current.tc != NULL);
1128 PRE(Current.tc != NULL);
1139 PRE(Current.tc != NULL);
1149 PRE(Current.tc != NULL);
1158 PRE(Current.tc != NULL);
1168 PRE(Current.tc != NULL);
1180 PRE(Current.tc != NULL);
1192 PRE(Current.tc != NULL);
1204 PRE(Current.tc != NULL);
1216 PRE(Current.tc != NULL);