summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-09-17 13:46:33 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-09-17 13:46:33 +0200
commit1b79f8510362da33c09f6e2c18740dce2cd24e5c (patch)
treecaa98d51ee8ad47fa13fd14f7440336f1d39d3b9
parent31a6f42e08a0285b2f6153a91605a400089d1199 (diff)
configurable Kconfig filename and randconfig command
now also works with busybox
-rwxr-xr-xbin/explore-kconfig.py13
-rw-r--r--lib/kconfig.py8
2 files changed, 18 insertions, 3 deletions
diff --git a/bin/explore-kconfig.py b/bin/explore-kconfig.py
index 4c08826..e59db17 100755
--- a/bin/explore-kconfig.py
+++ b/bin/explore-kconfig.py
@@ -56,6 +56,15 @@ def main():
help="Attribute extraction command",
default="make attributes",
)
+ parser.add_argument(
+ "--randconfig-command",
+ type=str,
+ help="Randconfig command for --random",
+ default="make randconfig",
+ )
+ parser.add_argument(
+ "--kconfig-file", type=str, help="Kconfig file", default="Kconfig"
+ )
parser.add_argument("project_root", type=str, help="Project root directory")
args = parser.parse_args()
@@ -73,6 +82,10 @@ def main():
kconf.build_command = args.build_command
if args.attribute_command:
kconf.attribute_command = args.attribute_command
+ if args.randconfig_command:
+ kconf.randconfig_command = args.randconfig_command
+ if args.kconfig_file:
+ kconf.kconfig = args.kconfig_file
if args.random:
for i in range(args.random):
diff --git a/lib/kconfig.py b/lib/kconfig.py
index 6ae947a..52615e3 100644
--- a/lib/kconfig.py
+++ b/lib/kconfig.py
@@ -80,10 +80,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 +133,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",
@@ -156,7 +158,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())