From 1ed7a66d836977ae9689f59b6dc5fca0f4637587 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 18 Sep 2020 10:04:19 +0200 Subject: explore-kconfig: explore neighbourhood of working random configurations This is useful for projects with many non-working random configurations --- bin/explore-kconfig.py | 11 ++++++++++- lib/kconfig.py | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/explore-kconfig.py b/bin/explore-kconfig.py index e59db17..7602076 100755 --- a/bin/explore-kconfig.py +++ b/bin/explore-kconfig.py @@ -44,6 +44,11 @@ def main(): type=int, help="Explore a number of random configurations (make randconfig)", ) + parser.add_argument( + "--with-neighbourhood", + action="store_true", + help="Explore neighbourhood of successful random configurations", + ) parser.add_argument( "--clean-command", type=str, help="Clean command", default="make clean" ) @@ -90,7 +95,11 @@ def main(): if args.random: for i in range(args.random): logging.info(f"Running randconfig {i+1} of {args.random}") - kconf.run_randconfig() + status = kconf.run_randconfig() + if status["success"]: + config_filename = status["config_path"] + logging.info(f"Exploring neighbourhood of {config_filename}") + kconf.run_exploration_from_file(config_filename) if args.neighbourhood: if os.path.isfile(args.neighbourhood): diff --git a/lib/kconfig.py b/lib/kconfig.py index 52615e3..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 @@ -146,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: -- cgit v1.2.3