From 028b1d0b2ea459056fd63d85503099a0b501e447 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Fri, 28 Sep 2018 11:32:34 +0200
Subject: [PATCH] Add the possiblity to specify benchmark execution wrapper

---
 python/dune/perftool/sumfact/autotune.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/python/dune/perftool/sumfact/autotune.py b/python/dune/perftool/sumfact/autotune.py
index 7578799c..a9517c43 100644
--- a/python/dune/perftool/sumfact/autotune.py
+++ b/python/dune/perftool/sumfact/autotune.py
@@ -15,7 +15,7 @@ import subprocess
 
 def get_cmake_cache_entry(entry):
     for line in open(os.path.join(get_option("project_basedir"), "CMakeCache.txt"), "r"):
-        match = re.match("{}:[INTERNAL|FILEPATH|BOOL|STRING|PATH]+=(.*)".format(entry), line)
+        match = re.match("{}:[INTERNAL|FILEPATH|BOOL|STRING|PATH|UNINITIALIZED]+=(.*)".format(entry), line)
         if match:
             return match.groups()[0]
 
@@ -183,9 +183,16 @@ def autotune_realization(sf):
         ret = subprocess.call(compiler_invocation(name, filename))
         assert ret == 0
 
+        # Check whether the user specified an execution wrapper
+        call = []
+        wrapper = get_cmake_cache_entry("DUNE_PERFTOOL_BENCHMARK_WRAPPER")
+        if wrapper:
+            call.append(wrapper)
+
         # Run the benchmark program
+        call.append(name)
         devnull = open(os.devnull, 'w')
-        ret = subprocess.call([name], stdout=devnull, stderr=subprocess.STDOUT)
+        ret = subprocess.call(call, stdout=devnull, stderr=subprocess.STDOUT)
         assert ret == 0
 
     # Extract the result form the log file
-- 
GitLab