From 03328f0456dba0ea823f2ec90f75bef069a10220 Mon Sep 17 00:00:00 2001
From: Sergei Trofimov <sergei.trofimov@arm.com>
Date: Thu, 15 Feb 2018 13:52:44 +0000
Subject: [PATCH] framework/output: improve access to config

Make it easier to access a run's configuration but automatically
deserializing it on reload of RunOutput, and exposing it via appropriate
settings.
---
 wa/framework/output.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/wa/framework/output.py b/wa/framework/output.py
index 09fa2bbb..5fdfa35c 100644
--- a/wa/framework/output.py
+++ b/wa/framework/output.py
@@ -162,12 +162,23 @@ class RunOutput(Output):
         path = os.path.join(self.basepath, '__failed')
         return ensure_directory_exists(path)
 
+    @property
+    def run_config(self):
+        if self._combined_config:
+            return self._combined_config.run_config
+
+    @property
+    def settings(self):
+        if self._combined_config:
+            return self._combined_config.settings
+
     def __init__(self, path):
         super(RunOutput, self).__init__(path)
         self.info = None
         self.state = None
         self.result = None
         self.target_info = None
+        self._combined_config = None
         self.jobs = []
         if (not os.path.isfile(self.statefile) or
                 not os.path.isfile(self.infofile)):
@@ -179,6 +190,8 @@ class RunOutput(Output):
         super(RunOutput, self).reload()
         self.info = RunInfo.from_pod(read_pod(self.infofile))
         self.state = RunState.from_pod(read_pod(self.statefile))
+        if os.path.isfile(self.configfile):
+            self._combined_config = CombinedConfig.from_pod(read_pod(self.configfile))
         if os.path.isfile(self.targetfile):
             self.target_info = TargetInfo.from_pod(read_pod(self.targetfile))