aboutsummaryrefslogtreecommitdiff
path: root/scripts/initialize.py
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-09-17 18:09:53 +0200
committerKarel Kočí <cynerd@email.cz>2015-09-17 18:09:53 +0200
commitb68b1c7ef8aacca3c2116a773e59acffb21ff2ce (patch)
tree5d9c04baf6de4ded99e55e67b3e1af00f4c43bcb /scripts/initialize.py
parent08d906b110f6a1a9985c4e03a13a2a97b0aaf818 (diff)
downloadlinux-conf-perf-b68b1c7ef8aacca3c2116a773e59acffb21ff2ce.tar.gz
linux-conf-perf-b68b1c7ef8aacca3c2116a773e59acffb21ff2ce.tar.bz2
linux-conf-perf-b68b1c7ef8aacca3c2116a773e59acffb21ff2ce.zip
Add measurable check while initialization
Some configurations options can't be measured. While initialization are detected and warning is printed.
Diffstat (limited to 'scripts/initialize.py')
-rwxr-xr-xscripts/initialize.py25
1 files changed, 23 insertions, 2 deletions
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!")
#################################################################################