def test_TmcFile_configure_packages(example_singular_tmc_chains): tmc = TmcFile(None) check_list = [] # build artificial tmcChains and generate fake names for idx, tc_type in zip([0, 2, 4, 6], ["BOOL", "INT", "LREAL", "STRING"]): cn = example_singular_tmc_chains[idx] for element, ix in zip(cn.chain, range(len(cn.chain))): element.name = chr(97 + ix) cn.last.tc_type = tc_type tmc.all_TmcChains.append(cn) # create the check_set rec = BaseRecordPackage(None, cn) rec.generate_naive_config() rec.guess_all() logger.debug(str(rec.chain.last.pragma.config)) check_list.append(rec) tmc.create_chains() tmc.isolate_chains() tmc.create_packages() tmc.configure_packages() assert len(tmc.all_RecordPackages) == 4 for check, rec in zip(check_list, tmc.all_RecordPackages): assert check.cfg.config == rec.cfg.config assert check.chain.chain == rec.chain.chain
def test_TmcFile_fullbuild(string_tmc_path): tmc = TmcFile(string_tmc_path) tmc.create_chains() tmc.isolate_chains() tmc.create_packages() tmc.configure_packages() z = tmc.render() print(z)
def test_TmcFile_create_chains(generic_tmc_path): tmc = TmcFile(generic_tmc_path) tmc.create_chains() target = [tmc.all_Symbols['MAIN.ulimit']] accept = False for row in tmc.all_TmcChains: if row.chain == target: accept = True break assert accept target = [ tmc.all_Symbols['MAIN.test_iterator'], tmc.all_SubItems['iterator']['extra1'], tmc.all_SubItems['DUT_STRUCT']['struct_var'] ] accept = False for row in tmc.all_TmcChains: if row.chain == target: accept = True break assert accept
def test_TmcFile_isolate_chains(generic_tmc_path): tmc = TmcFile(generic_tmc_path) tmc.create_chains() tmc.isolate_chains() print(len(tmc.all_TmcChains)) print(len(tmc.all_singular_TmcChains)) target = [ tmc.all_Symbols['MAIN.test_iterator'], tmc.all_SubItems['iterator']['extra1'], tmc.all_SubItems['DUT_STRUCT']['struct_var'] ] accept = False count = 0 for row in tmc.all_singular_TmcChains: if row.chain[0].name == 'MAIN.container_struct': if row.chain[1].name == 'dtype_samples_iter_array': if row.chain[2].name == 'extra1': if row.chain[3].name == 'struct_var': count += 1 assert count == 4