From 7902335a864a5432895086f363ccde736f23c613 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Tue, 19 Feb 2019 10:30:24 +0100
Subject: [PATCH] Add a bit of error handling to google benchmark

---
 python/dune/codegen/sumfact/autotune.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/python/dune/codegen/sumfact/autotune.py b/python/dune/codegen/sumfact/autotune.py
index f5a259d7..8537a819 100644
--- a/python/dune/codegen/sumfact/autotune.py
+++ b/python/dune/codegen/sumfact/autotune.py
@@ -363,7 +363,11 @@ def autotune_realization(sf):
             if get_option("autotune_google_benchmark"):
                 import json
                 with open(logname) as json_file:
-                    data = json.load(json_file)
-                    return data['benchmarks'][0]['cpu_time']
+                    try:
+                        data = json.load(json_file)
+                        return data['benchmarks'][0]['cpu_time']
+                    except Exception as e:
+                        print("Error while loading file {}".format(logname))
+                        raise e
             else:
                 return float(next(iter(open(logname, "r")))) / 1000000
-- 
GitLab