diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/loader.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/loader.py b/lib/loader.py index a1f9ca6..7835b18 100644 --- a/lib/loader.py +++ b/lib/loader.py @@ -11,6 +11,7 @@ import struct import tarfile import hashlib import kconfiglib +import subprocess from multiprocessing import Pool from .utils import running_mean, soft_cast_int from frozendict import frozendict @@ -1951,6 +1952,7 @@ class KConfigAttributes: for direntry in os.listdir(datadir): config_path = f"{datadir}/{direntry}/.config" attr_path = f"{datadir}/{direntry}/attributes.json" + metadata_path = f"{datadir}/{direntry}/metadata" if os.path.exists(attr_path): experiments.append((config_path, attr_path)) elif os.path.exists(config_path): @@ -1959,6 +1961,8 @@ class KConfigAttributes: kconf = kconfiglib.Kconfig(kconfig_path) self.kconf = kconf + self.kconfig_hash = self.file_hash(kconfig_path) + self.symbol_names = sorted( map( lambda sym: sym.name, @@ -2001,3 +2005,13 @@ class KConfigAttributes: if kconf.syms[sym].tri_value == 2: config[sym] = True self.failures.append(frozendict(config)) + + def file_hash(self, config_file): + status = subprocess.run( + ["sha256sum", config_file], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True, + ) + sha256sum = status.stdout.split()[0] + return sha256sum |