Home | History | Annotate | Download | only in tests

Lines Matching full:base

38  * - role in base, no modules
39 * - role in base optional, no modules
40 * - role a in base, b in module
41 * - role a in base and module (additive)
42 * - role a in base and 2 module
43 * - role a in base optional, b in module
44 * - role a in base, b in module optional
45 * - role a in base optional, b in module optional
46 * - role a in base optional and module
47 * - role a in base and module optional
48 * - role a in base optional and module optional
49 * - role a in base optional and 2 modules
50 * - role a and b in base, b dom a, are types correct (TODO)
70 void base_role_tests(policydb_t * base)
77 /* These tests look at roles in the base only, the desire is to ensure that
80 /**** test for g_b_role_1 in base and decl 1 (global) ****/
81 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_b"))->decl_id;
82 test_sym_presence(base, "g_b_role_1", SYM_ROLES, SCOPE_DECL, decls, 1);
85 role = test_role_type_set(base, "g_b_role_1", NULL, types, 1, 0);
87 only_dominates_self(base, role);
90 decl = test_find_decl_by_sym(base, SYM_TYPES, "tag_o1_b");
92 test_sym_presence(base, "o1_b_role_1", SYM_ROLES, SCOPE_DECL, decls, 1);
95 role = test_role_type_set(base, "o1_b_role_1", decl, types, 1, 0);
97 only_dominates_self(base, role);
100 void module_role_tests(policydb_t * base)
107 /* These tests are run when the base is linked with 2 modules,
109 * modules into the base */
112 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m1"))->decl_id;
113 test_sym_presence(base, "g_m1_role_1", SYM_ROLES, SCOPE_DECL, decls, 1);
116 role = test_role_type_set(base, "g_m1_role_1", NULL, types, 1, 0);
118 only_dominates_self(base, role);
121 decl = test_find_decl_by_sym(base, SYM_TYPES, "tag_o1_m1");
123 test_sym_presence(base, "o1_m1_role_1", SYM_ROLES, SCOPE_DECL, decls, 1);
126 role = test_role_type_set(base, "o1_m1_role_1", decl, types, 1, 0);
128 only_dominates_self(base, role);
133 /**** test for type added to base role in module 1 (global) ****/
134 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_b"))->decl_id;
135 decls[1] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m1"))->decl_id;
136 test_sym_presence(base, "g_b_role_2", SYM_ROLES, SCOPE_DECL, decls, 2);
138 types[0] = "g_b_type_2"; /* added in base when declared */
140 role = test_role_type_set(base, "g_b_role_2", NULL, types, 2, 0);
142 only_dominates_self(base, role);
144 /**** test for type added to base role in module 1 & 2 (global) ****/
145 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_b"))->decl_id;
146 decls[1] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m1"))->decl_id;
147 decls[2] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m2"))->decl_id;
148 test_sym_presence(base, "g_b_role_3", SYM_ROLES, SCOPE_DECL, decls, 3);
150 types[0] = "g_b_type_2"; /* added in base when declared */
153 role = test_role_type_set(base, "g_b_role_3", NULL, types, 3, 0);
155 only_dominates_self(base, role);
157 /**** test for role in base optional and module 1 (additive) ****/
158 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_o1_b"))->decl_id;
159 decls[1] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m1"))->decl_id;
160 test_sym_presence(base, "o1_b_role_2", SYM_ROLES, SCOPE_DECL, decls, 2);
161 /* this one will have 2 type sets, one in the global symtab and one in the base optional 1 */
163 role = test_role_type_set(base, "o1_b_role_2", NULL, types, 1, 0);
165 role = test_role_type_set(base, "o1_b_role_2", test_find_decl_by_sym(base, SYM_TYPES, "tag_o1_b"), types, 1, 0);
167 only_dominates_self(base, role);
169 /**** test for role in base and module 1 optional (additive) ****/
170 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_b"))->decl_id;
171 decls[1] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_o2_m1"))->decl_id;
172 test_sym_presence(base, "g_b_role_4", SYM_ROLES, SCOPE_DECL, decls, 2);
173 /* this one will have 2 type sets, one in the global symtab and one in the base optional 1 */
175 role = test_role_type_set(base, "g_b_role_4", NULL, types, 1, 0);
177 role = test_role_type_set(base, "g_b_role_4", test_find_decl_by_sym(base, SYM_TYPES, "tag_o2_m1"), types, 1, 0);
179 only_dominates_self(base, role);
181 /**** test for role in base and module 1 optional (additive) ****/
182 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_o3_b"))->decl_id;
183 decls[1] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_o3_m1"))->decl_id;
184 test_sym_presence(base, "o3_b_role_1", SYM_ROLES, SCOPE_DECL, decls, 2);
185 /* this one will have 2 type sets, one in the 3rd base optional and one in the 3rd module optional */
187 role = test_role_type_set(base, "o3_b_role_1", test_find_decl_by_sym(base, SYM_TYPES, "tag_o3_b"), types, 1, 0);
189 role = test_role_type_set(base, "o3_b_role_1", test_find_decl_by_sym(base, SYM_TYPES, "tag_o3_m1"), types, 1, 0);
191 only_dominates_self(base, role);
193 /**** test for role in base and module 1 optional (additive) ****/
194 decls[0] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_o4_b"))->decl_id;
195 decls[1] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m1"))->decl_id;
196 decls[2] = (test_find_decl_by_sym(base, SYM_TYPES, "tag_g_m2"))->decl_id;
197 test_sym_presence(base, "o4_b_role_1", SYM_ROLES, SCOPE_DECL, decls, 3);
198 /* this one will have 2 type sets, one in the global symtab (with both module types) and one in the 4th optional of base */
200 role = test_role_type_set(base, "o4_b_role_1", test_find_decl_by_sym(base, SYM_TYPES, "tag_o4_b"), types, 1, 0);
203 role = test_role_type_set(base, "o4_b_role_1", NULL, types, 2, 0);
205 only_dominates_self(base, role);