From b68b1c7ef8aacca3c2116a773e59acffb21ff2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 17 Sep 2015 18:09:53 +0200 Subject: Add measurable check while initialization Some configurations options can't be measured. While initialization are detected and warning is printed. --- scripts/initialize.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/initialize.py b/scripts/initialize.py index 745f822..e476f1d 100755 --- a/scripts/initialize.py +++ b/scripts/initialize.py @@ -9,6 +9,7 @@ import database from conf import conf from conf import sf import exceptions +import configurations def all(): try: @@ -18,8 +19,8 @@ def all(): base() parse_kconfig() gen_fixed() - # check if database is initialized - database.database() + checkmeasure() + database.database() # check if database is initialized def base(): print('Initialize base...') @@ -96,6 +97,26 @@ def gen_fixed(): raise exceptions.ConfigurationError("Can't measure configuraion option MODULES. Not supported.") fmes.write(str(srmap[line[7:indx]]) + "\n") +def checkmeasure(): + print("Checking if all configurations can be measured...") + utils.build_symbol_map() + measure_list = set() + with open(sf(conf.variable_count_file)) as f: + var_num = f.readline().rstrip() + conf_num = f.readline().rstrip() + with open(sf(conf.measure_file), 'r') as fi: + for ln in fi: + measure_list.add(int(ln)) + for measure in measure_list: + tfile1 = configurations.__buildtempcnf__(var_num, (sf(conf.rules_file), + sf(conf.fixed_file)), [str(measure)]) + tfile2 = configurations.__buildtempcnf__(var_num, (sf(conf.rules_file), + sf(conf.fixed_file)), [str(-1 * measure)]) + try: + configurations.__exec_sat__(tfile1, [], conf_num) + configurations.__exec_sat__(tfile2, [], conf_num) + except exceptions.NoSolution: + print("W: " + utils.smap[measure] + " won't be measured!") ################################################################################# -- cgit v1.2.3