From b4971d76d61965c6e82e91348c89c439c4e8a082 Mon Sep 17 00:00:00 2001
From: Sergei Trofimov <sergei.trofimov@arm.com>
Date: Mon, 1 Jun 2015 16:41:33 +0100
Subject: [PATCH] pull more stuff during run initialization

added more paths to pull by default when device.get_properties is
invoked during run initialization. Also moved the LinuxDevice
implementation into BaseLinuxDevice, so that AndroidDevice tires to pull
the same files (on top of the Android-specific stuff).
---
 wlauto/common/android/device.py |  8 +-----
 wlauto/common/linux/device.py   | 44 ++++++++++++++++++++-------------
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/wlauto/common/android/device.py b/wlauto/common/android/device.py
index ff4bc0ff..e021ba77 100644
--- a/wlauto/common/android/device.py
+++ b/wlauto/common/android/device.py
@@ -478,7 +478,7 @@ class AndroidDevice(BaseLinuxDevice):  # pylint: disable=W0223
 
     def get_properties(self, context):
         """Captures and saves the information from /system/build.prop and /proc/version"""
-        props = {}
+        props = super(AndroidDevice, self).get_properties(context)
         props['android_id'] = self.get_android_id()
         buildprop_file = os.path.join(context.host_working_directory, 'build.prop')
         if not os.path.isfile(buildprop_file):
@@ -486,12 +486,6 @@ class AndroidDevice(BaseLinuxDevice):  # pylint: disable=W0223
         self._update_build_properties(buildprop_file, props)
         context.add_run_artifact('build_properties', buildprop_file, 'export')
 
-        version_file = os.path.join(context.host_working_directory, 'version')
-        if not os.path.isfile(version_file):
-            self.pull_file('/proc/version', context.host_working_directory)
-        self._update_versions(version_file, props)
-        context.add_run_artifact('device_version', version_file, 'export')
-
         dumpsys_window_file = os.path.join(context.host_working_directory, 'window.dumpsys')
         dumpsys_window_output = self.execute('dumpsys window')
         with open(dumpsys_window_file, 'w') as wfh:
diff --git a/wlauto/common/linux/device.py b/wlauto/common/linux/device.py
index 68012a80..4a07c8c2 100644
--- a/wlauto/common/linux/device.py
+++ b/wlauto/common/linux/device.py
@@ -72,6 +72,24 @@ class BaseLinuxDevice(Device):  # pylint: disable=abstract-method
                  be set for non-IKS device (i.e. ``scheduler != 'iks'``). If left unset for IKS devices,
                  it will default to ``800000``, i.e. 800MHz.
                  """),
+        Parameter('property_files', kind=list_of_strings,
+                  default=[
+                      '/etc/arch-release',
+                      '/etc/debian_version',
+                      '/etc/lsb-release',
+                      '/proc/config.gz',
+                      '/proc/cpuinfo',
+                      '/proc/version',
+                      '/proc/zconfig',
+                      '/sys/kernel/debug/sched_features',
+                      '/sys/kernel/hmp',
+                  ],
+                  description='''
+                  A list of paths to files containing static OS properties. These will be pulled into the
+                  __meta directory in output for each run in order to provide information about the platfrom.
+                  These paths do not have to exist and will be ignored if the path is not present on a
+                  particular device.
+                  '''),
 
     ]
 
@@ -157,6 +175,15 @@ class BaseLinuxDevice(Device):  # pylint: disable=abstract-method
                 self.busybox = 'busybox'
         self.init(context, *args, **kwargs)
 
+    def get_properties(self, context):
+        for propfile in self.property_files:
+            if not self.file_exists(propfile):
+                continue
+            normname = propfile.lstrip(self.path.sep).replace(self.path.sep, '.')
+            outfile = os.path.join(context.host_working_directory, normname)
+            self.pull_file(propfile, outfile)
+        return {}
+
     def get_sysfile_value(self, sysfile, kind=None):
         """
         Get the contents of the specified sysfile.
@@ -823,14 +850,6 @@ class LinuxDevice(BaseLinuxDevice):
                   '''),
         Parameter('binaries_directory', default='/usr/local/bin',
                   description='Location of executable binaries on this device (must be in PATH).'),
-        Parameter('property_files', kind=list_of_strings,
-                  default=['/proc/version', '/etc/debian_version', '/etc/lsb-release', '/etc/arch-release'],
-                  description='''
-                  A list of paths to files containing static OS properties. These will be pulled into the
-                  __meta directory in output for each run in order to provide information about the platfrom.
-                  These paths do not have to exist and will be ignored if the path is not present on a
-                  particular device.
-                  '''),
     ]
 
     @property
@@ -1099,12 +1118,3 @@ class LinuxDevice(BaseLinuxDevice):
     def ensure_screen_is_on(self):
         pass  # TODO
 
-    def get_properties(self, context):
-        for propfile in self.property_files:
-            if not self.file_exists(propfile):
-                continue
-            normname = propfile.lstrip(self.path.sep).replace(self.path.sep, '.')
-            outfile = os.path.join(context.host_working_directory, normname)
-            self.pull_file(propfile, outfile)
-        return {}
-