16cd6a6acSopenharmony_cimodule linker_test_1 1.0;
26cd6a6acSopenharmony_ci
36cd6a6acSopenharmony_cirequire { 
46cd6a6acSopenharmony_ci	class file { read write };
56cd6a6acSopenharmony_ci	class lnk_file append;
66cd6a6acSopenharmony_ci	role g_b_role_2;
76cd6a6acSopenharmony_ci	attribute g_b_attr_3;
86cd6a6acSopenharmony_ci	attribute g_b_attr_5;
96cd6a6acSopenharmony_ci	attribute o4_b_attr_1;
106cd6a6acSopenharmony_ci	type g_b_type_3;
116cd6a6acSopenharmony_ci}
126cd6a6acSopenharmony_ci
136cd6a6acSopenharmony_citype tag_g_m1;
146cd6a6acSopenharmony_ci
156cd6a6acSopenharmony_ci#test for type in module and attr in module, added to in module
166cd6a6acSopenharmony_ciattribute g_m1_attr_1;
176cd6a6acSopenharmony_citype g_m1_type_1, g_m1_attr_1;
186cd6a6acSopenharmony_citype g_m1_type_2;
196cd6a6acSopenharmony_citypeattribute g_m1_type_2 g_m1_attr_1;
206cd6a6acSopenharmony_ci
216cd6a6acSopenharmony_ci#add role in module test
226cd6a6acSopenharmony_cirole g_m1_role_1;
236cd6a6acSopenharmony_cirole g_m1_role_1 types g_m1_type_1;
246cd6a6acSopenharmony_ci
256cd6a6acSopenharmony_ci# test for attr declared in base, added to in module
266cd6a6acSopenharmony_citype g_m1_type_3;
276cd6a6acSopenharmony_citypeattribute g_m1_type_3 g_b_attr_3;
286cd6a6acSopenharmony_ci
296cd6a6acSopenharmony_ci# test for attr declared in base, added to in 2 modules
306cd6a6acSopenharmony_citype g_m1_type_4;
316cd6a6acSopenharmony_citypeattribute g_m1_type_4 g_b_attr_5;
326cd6a6acSopenharmony_ci
336cd6a6acSopenharmony_ci# test for attr declared in base optional, added to in module
346cd6a6acSopenharmony_citype g_m1_type_5;
356cd6a6acSopenharmony_citypeattribute g_m1_type_5 o4_b_attr_1;
366cd6a6acSopenharmony_ci
376cd6a6acSopenharmony_ci# test for attr declared in module, added to in base optional
386cd6a6acSopenharmony_ciattribute g_m1_attr_2;
396cd6a6acSopenharmony_ci
406cd6a6acSopenharmony_ci#add type to base role test
416cd6a6acSopenharmony_cirole g_b_role_2 types g_m1_type_1;
426cd6a6acSopenharmony_cirole g_b_role_3;
436cd6a6acSopenharmony_cirole g_b_role_3 types g_m1_type_2;
446cd6a6acSopenharmony_ci
456cd6a6acSopenharmony_ci#add type to base optional role test
466cd6a6acSopenharmony_cirole o1_b_role_2;
476cd6a6acSopenharmony_cirole o1_b_role_2 types g_m1_type_1;
486cd6a6acSopenharmony_ci
496cd6a6acSopenharmony_ci#optional base role w/ adds in 2 modules
506cd6a6acSopenharmony_cirole o4_b_role_1;
516cd6a6acSopenharmony_cirole o4_b_role_1 types g_m1_type_2;
526cd6a6acSopenharmony_ci
536cd6a6acSopenharmony_ci# attr a added to in base optional, declared/added to in module, added to in other module
546cd6a6acSopenharmony_ciattribute g_m1_attr_3;
556cd6a6acSopenharmony_citype g_m1_type_6, g_m1_attr_3;
566cd6a6acSopenharmony_ci
576cd6a6acSopenharmony_ci# attr a added to in base optional, declared/added in module , added to in other module optional
586cd6a6acSopenharmony_ciattribute g_m1_attr_4;
596cd6a6acSopenharmony_citype g_m1_type_7, g_m1_attr_4;
606cd6a6acSopenharmony_ci
616cd6a6acSopenharmony_ci# alias tests
626cd6a6acSopenharmony_citypealias g_b_type_3 alias g_m_alias_1;
636cd6a6acSopenharmony_ci
646cd6a6acSopenharmony_ci# single boolean in module
656cd6a6acSopenharmony_cibool g_m1_bool_1 true;
666cd6a6acSopenharmony_ciif (g_m1_bool_1) {
676cd6a6acSopenharmony_ci	allow g_m1_type_1 g_m1_type_2 : lnk_file append;
686cd6a6acSopenharmony_ci}
696cd6a6acSopenharmony_ci
706cd6a6acSopenharmony_ci
716cd6a6acSopenharmony_cioptional {
726cd6a6acSopenharmony_ci	require {
736cd6a6acSopenharmony_ci		type optional_type;
746cd6a6acSopenharmony_ci		attribute g_b_attr_4;
756cd6a6acSopenharmony_ci		attribute o1_b_attr_2;
766cd6a6acSopenharmony_ci		class lnk_file { ioctl };
776cd6a6acSopenharmony_ci	}
786cd6a6acSopenharmony_ci
796cd6a6acSopenharmony_ci	type tag_o1_m1;
806cd6a6acSopenharmony_ci
816cd6a6acSopenharmony_ci	attribute o1_m1_attr_1;
826cd6a6acSopenharmony_ci	type o1_m1_type_2, o1_m1_attr_1;
836cd6a6acSopenharmony_ci	
846cd6a6acSopenharmony_ci	type o1_m1_type_1;
856cd6a6acSopenharmony_ci	role o1_m1_role_1;
866cd6a6acSopenharmony_ci	role o1_m1_role_1 types o1_m1_type_1;
876cd6a6acSopenharmony_ci
886cd6a6acSopenharmony_ci	type o1_m1_type_3;
896cd6a6acSopenharmony_ci	typeattribute o1_m1_type_3 g_b_attr_4;
906cd6a6acSopenharmony_ci
916cd6a6acSopenharmony_ci	type o1_m1_type_5;
926cd6a6acSopenharmony_ci	typeattribute o1_m1_type_5 o1_b_attr_2;	
936cd6a6acSopenharmony_ci
946cd6a6acSopenharmony_ci	bool o1_m1_bool_1 false;
956cd6a6acSopenharmony_ci	if (o1_m1_bool_1) {
966cd6a6acSopenharmony_ci		allow o1_m1_type_2 o1_m1_type_1 : lnk_file ioctl;
976cd6a6acSopenharmony_ci	}
986cd6a6acSopenharmony_ci	
996cd6a6acSopenharmony_ci}
1006cd6a6acSopenharmony_ci
1016cd6a6acSopenharmony_cioptional {
1026cd6a6acSopenharmony_ci	require {
1036cd6a6acSopenharmony_ci		type optional_type;
1046cd6a6acSopenharmony_ci		#role g_b_role_4; // This causes a bug where the role scope doesn't get copied into base
1056cd6a6acSopenharmony_ci	}
1066cd6a6acSopenharmony_ci	
1076cd6a6acSopenharmony_ci	type tag_o2_m1;
1086cd6a6acSopenharmony_ci
1096cd6a6acSopenharmony_ci	role g_b_role_4;
1106cd6a6acSopenharmony_ci	role g_b_role_4 types g_m1_type_2;
1116cd6a6acSopenharmony_ci}
1126cd6a6acSopenharmony_ci
1136cd6a6acSopenharmony_cioptional {
1146cd6a6acSopenharmony_ci	require {
1156cd6a6acSopenharmony_ci		attribute g_b_attr_6;
1166cd6a6acSopenharmony_ci	}
1176cd6a6acSopenharmony_ci
1186cd6a6acSopenharmony_ci	type tag_o3_m1;
1196cd6a6acSopenharmony_ci
1206cd6a6acSopenharmony_ci	type o3_m1_type_1;	
1216cd6a6acSopenharmony_ci	role o3_b_role_1;
1226cd6a6acSopenharmony_ci        role o3_b_role_1 types o3_m1_type_1;
1236cd6a6acSopenharmony_ci
1246cd6a6acSopenharmony_ci	type o3_m1_type_2, g_b_attr_6;
1256cd6a6acSopenharmony_ci
1266cd6a6acSopenharmony_ci	attribute o3_m1_attr_1;	
1276cd6a6acSopenharmony_ci
1286cd6a6acSopenharmony_ci	# attr a added to in base optional, declared/added in module optional, added to in other module
1296cd6a6acSopenharmony_ci	attribute o3_m1_attr_2;
1306cd6a6acSopenharmony_ci	type o3_m1_type_3, o3_m1_attr_2;
1316cd6a6acSopenharmony_ci
1326cd6a6acSopenharmony_ci}
1336cd6a6acSopenharmony_ci
1346cd6a6acSopenharmony_cioptional {
1356cd6a6acSopenharmony_ci	require {
1366cd6a6acSopenharmony_ci		type enable_optional;
1376cd6a6acSopenharmony_ci	}
1386cd6a6acSopenharmony_ci	type tag_o4_m1;
1396cd6a6acSopenharmony_ci
1406cd6a6acSopenharmony_ci	attribute o4_m1_attr_1;
1416cd6a6acSopenharmony_ci	type o4_m1_type_1;
1426cd6a6acSopenharmony_ci	typeattribute o4_m1_type_1 o4_m1_attr_1;
1436cd6a6acSopenharmony_ci
1446cd6a6acSopenharmony_ci
1456cd6a6acSopenharmony_ci}
146