From 102bc4c22d57a6fc7d7c353d9b5251b0c8c3e768 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 5 Oct 2021 07:48:38 +0200 Subject: kconfig: allow combination of randconfig and neighbourhood exploration --- lib/kconfig.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/kconfig.py b/lib/kconfig.py index 6ae947a..a85586f 100644 --- a/lib/kconfig.py +++ b/lib/kconfig.py @@ -2,6 +2,7 @@ import kconfiglib import logging +import os import re import shutil import subprocess @@ -80,10 +81,12 @@ class KConfig: self.clean_command = "make clean" self.build_command = "make" self.attribute_command = "make attributes" + self.randconfig_command = "make randconfig" + self.kconfig = "Kconfig" def randconfig(self): status = subprocess.run( - ["make", "randconfig"], + self.randconfig_command.split(), cwd=self.cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, @@ -131,7 +134,7 @@ class KConfig: "--randconfig_seed", self.randconfig(), "--kconfig_hash", - self.file_hash(f"{self.cwd}/Kconfig"), + self.file_hash(f"{self.cwd}/{self.kconfig}"), "--project_version", self.git_commit_id(), "--project_root", @@ -144,6 +147,8 @@ class KConfig: self.attribute_command, ] ) + success = os.path.exists(experiment.attributes.path) + return {"success": success, "config_path": experiment.config.path} def config_is_functional(self, kconf): for choice in kconf.choices: @@ -156,7 +161,7 @@ class KConfig: return True def run_exploration_from_file(self, config_file): - kconfig_file = f"{self.cwd}/Kconfig" + kconfig_file = f"{self.cwd}/{self.kconfig}" kconf = kconfiglib.Kconfig(kconfig_file) kconf.load_config(config_file) symbols = list(kconf.syms.keys()) -- cgit v1.2.3