diff options
author | Daniel Friesel <dfriesel@uos.de> | 2022-05-20 10:13:50 +0000 |
---|---|---|
committer | Daniel Friesel <dfriesel@uos.de> | 2022-05-20 10:13:50 +0000 |
commit | 4eb9358714cc5553c886021931752ec2b95055f4 (patch) | |
tree | 54ca7cb2b8748139fa534dcbdf40f7397ac72e7a /lib/kconfig.py | |
parent | 0daafbe96c1057fe7fd9cc64f3e74fb914c1eeb4 (diff) |
Add a test benchmark for explore-kconfig
Diffstat (limited to 'lib/kconfig.py')
-rw-r--r-- | lib/kconfig.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/kconfig.py b/lib/kconfig.py index 3a402ad..fe077a5 100644 --- a/lib/kconfig.py +++ b/lib/kconfig.py @@ -108,15 +108,18 @@ class KConfig: return "unknown" def git_commit_id(self): - status = subprocess.run( - ["git", "rev-parse", "HEAD"], - cwd=self.cwd, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - universal_newlines=True, - ) - revision = status.stdout.strip() - return revision + try: + status = subprocess.run( + ["git", "rev-parse", "HEAD"], + cwd=self.cwd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True, + ) + revision = status.stdout.strip() + return revision + except FileNotFoundError: + return "unknown" def file_hash(self, config_file): status = subprocess.run( @@ -126,7 +129,12 @@ class KConfig: stderr=subprocess.PIPE, universal_newlines=True, ) - sha256sum = status.stdout.split()[0] + try: + sha256sum = status.stdout.split()[0] + except IndexError: + raise RuntimeError( + f"Unable to extract hash from 'sha256sum {config_file}' output '{status.stdout}'" + ) return sha256sum def run_nfpkeys(self): |