projects / phoronix-test-suite.git / commitdiff
Build Results
 
Summary

Description: Phoronix Test Suite open-source benchmarking development
Last Change: Wed 7/23/14 10:50

Recent Commits
Time
Signed-Off By
Description
Commit Diff
Wed 7/23/14 10:50
Michael Larabel  
pts_webui: SERVER_ADDR... 
Fri 7/18/14 8:58
Michael Larabel  
pts-core: Sanitize... 
Fri 7/11/14 8:58
Michael Larabel  
Phoronix Test Suite 5.2.1... 
Sun 7/6/14 16:07
Michael Larabel  
phodevi: Add DDE / Deepin... 
Wed 6/25/14 10:04
Michael Larabel  
pts-core: Rework... 
Wed 6/25/14 9:25
Michael Larabel  
pts-core: Don't check... 
 
> --git a/CHANGE-LOG b/CHANGE-LOG
index 9f57d12
..a89c254 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -6,+6,@@ Phoronix Test Suite (Git)
 - 
pts-coreAdd auto-compare option for automatically determining relevant OpenBenchmarking.org result comparisons based upon software/hardware
 
pts-coreAllow passing test profile names to auto-compare to seed it with the test(syou wish to use for comparison
 
pts-coreOpenBenchmarking.org now supports system log payload sizes up to 2MB
+- pts-coreObject-ify PTS external dependency handling
 
phodeviSplit some into new phodevi_base class

 
Phoronix Test Suite 4.2 Milestone 1
diff 
--git a/pts-core/commands/dump_documentation.php b/pts-core/commands/dump_documentation.php
index 1dbcf2f
..923c4b1 100644
--- a/pts-core/commands/dump_documentation.php
+++ b/pts-core/commands/dump_documentation.php
@@ -164,+164,@@ class dump_documentation implements pts_option_interface
         $phr 
$dom->createElement('hr');
         
$p->appendChild($phr);

-        
$vendors array_merge(array_keys(pts_external_dependencies::vendor_alias_list(false)), pts_external_dependencies::vendor_file_parents_list());
+        
$exdep_generic_parser = new pts_exdep_generic_parser();
+        
$vendors array_merge($exdep_generic_parser->get_vendor_aliases_formatted(), $exdep_generic_parser->get_vendors_list_formatted());
         
sort($vendors);

         
$ul $dom->createElement('ul');
diff --git a/pts-core/objects/client/pts_client.php b/pts-core/objects/client/pts_client.php
index 67df3ba
..16f29d0 100644
--- a/pts-core/objects/client/pts_client.php
+++ b/pts-core/objects/client/pts_client.php
@@ -561,+561,@@ class pts_client
         
}

         
$pso->add_object('environmental_variables_for_modules'pts_module_manager::modules_environmental_variables());
-        
$pso->add_object('vendor_alias_list'pts_external_dependencies::vendor_alias_list());
         
$pso->add_object('command_alias_list'pts_documentation::client_commands_aliases());

         
$pso->save_to_file(PTS_TEMP_STORAGE);
diff --git a/pts-core/objects/client/pts_external_dependencies.php b/pts-core/objects/client/pts_external_dependencies.php
index 083b4a4
..27240d0 100644
--- a/pts-core/objects/client/pts_external_dependencies.php
+++ b/pts-core/objects/client/pts_external_dependencies.php
@@ -97,21 +97,13 @@ class pts_external_dependencies
         
// There were some dependencies not supported on this OS or are missing from the distro's XML file
         
if(count($required_test_dependencies) > && count($dependencies_to_install) == 0)
         {
-            
$xml_parser = new nye_XmlReader(PTS_EXDEP_PATH 'xml/generic-packages.xml');
-            
$package_name $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
-            
$title $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/Title');
-            
$possible_packages $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PossibleNames');
-            
$file_check $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
-            
$required_test_dependencies_names array_keys($required_test_dependencies);
-
+            
$exdep_generic_parser = new pts_exdep_generic_parser();
             
$to_report = array();

-            foreach(
array_keys($package_name) as $i)
+            foreach(
array_keys($required_test_dependencies) as $dependency)
             {
-                if(isset(
$required_test_dependencies[$package_name[$i]]))
-                {
-                    
array_push($to_report$title[$i] . PHP_EOL 'Possible Package Names: ' $possible_packages[$i]);
-                }
+                
$dependency_data $exdep_generic_parser->get_package_data($dependency);
+                
array_push($to_report$dependency_data['title'] . PHP_EOL 'Possible Package Names: ' $dependency_data['possible_packages']);
             }

             if(
count($to_report) > 0)
@@ -
187,+179,@@ class pts_external_dependencies
     
}
     public static function 
all_dependency_names()
     {
-        
$xml_parser = new nye_XmlReader(PTS_EXDEP_PATH 'xml/generic-packages.xml');
-
-        return 
$xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
+        
$exdep_generic_parser = new pts_exdep_generic_parser();
+        return 
$exdep_generic_parser->get_available_packages();
     }
     public static function 
all_dependency_titles()
     {
@@ -
230,68 +221,44 @@ class pts_external_dependencies
     
}
     private static function 
check_dependencies_missing_from_system(&$required_test_dependencies, &$generic_names_of_packages_needed false)
     {
-        
$distro_vendor_xml PTS_EXDEP_PATH 'xml/' self::vendor_identifier('package-list') . '-packages.xml';
+        
$external_dependencies_parser = new pts_exdep_platform_parser(self::vendor_identifier('package-list'));
+        
$kernel_architecture phodevi::read_property('system''kernel-architecture');
         
$needed_os_packages = array();

-        if(
is_file($distro_vendor_xml))
+        foreach(
$external_dependencies_parser->get_available_packages() as $package)
         {
-            
$xml_parser = new nye_XmlReader($distro_vendor_xml);
-            
$generic_package $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
-            
$distro_package $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PackageName');
-            
$file_check $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
-            
$arch_specific $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/ArchitectureSpecific');
-            
$kernel_architecture phodevi::read_property('system''kernel-architecture');
-
-            foreach(
array_keys($generic_package) as $i)
+            if(isset(
$required_test_dependencies[$package]))
             {
-                if(empty(
$generic_package[$i]))
-                {
-                    continue;
-                }
+                
$package_data $external_dependencies_parser->get_package_data($package);
+                
$add_dependency = empty($package_data['file_check']) || self::file_missing_check($package_data['file_check']);
+                
$arch_compliant = empty($package_data['arch_specific']) || in_array($kernel_architecture$package_data['arch_specific']);

-                if(isset(
$required_test_dependencies[$generic_package[$i]]))
+                if(
$add_dependency && $arch_compliant && $package_data['os_package'] != null)
                 {
-                    
$add_dependency = empty($file_check[$i]) || self::file_missing_check($file_check[$i]);
-                    
$arch_compliant = empty($arch_specific[$i]) || in_array($kernel_architecturepts_strings::comma_explode($arch_specific[$i]));
-
-                    if(
$add_dependency && $arch_compliant && $distro_package[$i] != null)
+                    if(!
in_array($package_data['os_package'], $needed_os_packages))
                     {
-                        if(!
in_array($distro_package[$i], $needed_os_packages))
-                        {
-                            
array_push($needed_os_packages$distro_package[$i]);
-                        }
-                        if(
$generic_names_of_packages_needed !== false && !in_array($generic_package[$i], $generic_names_of_packages_needed))
-                        {
-                            
array_push($generic_names_of_packages_needed$generic_package[$i]);
-                        }
+                        
array_push($needed_os_packages$package_data['os_package']);
+                    }
+                    if(
$generic_names_of_packages_needed !== false && !in_array($package$generic_names_of_packages_needed))
+                    {
+                        
array_push($generic_names_of_packages_needed$package);
                     }
-
-                    unset(
$required_test_dependencies[$generic_package[$i]]);
                 }
             }
         }

         if(
count($required_test_dependencies) > 0)
         {
-            
$xml_parser = new nye_XmlReader(PTS_EXDEP_PATH 'xml/generic-packages.xml');
-            
$generic_package_name $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
-            
$generic_file_check $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
+            
$generic_dependencies_parser = new pts_exdep_generic_parser();

-            foreach(
array_keys($generic_package_name) as $i)
+            foreach(
$required_test_dependencies as $i => $dependency)
             {
-                if(empty(
$generic_package_name[$i]))
-                {
-                    continue;
-                }
+                
$package_data $generic_dependencies_parser->get_package_data($i);
+                
$file_present = !empty($package_data['file_check']) && !self::file_missing_check($package_data['file_check']);

-                if(isset(
$required_test_dependencies[$generic_package_name[$i]]))
+                if(
$file_present)
                 {
-                    
$file_present = !empty($generic_file_check[$i]) && !self::file_missing_check($generic_file_check[$i]);
-
-                    if(
$file_present)
-                    {
-                        unset(
$required_test_dependencies[$generic_package_name[$i]]);
-                    }
+                    unset(
$required_test_dependencies[$i]);
                 }
             }
         }
@@ -
352,54 +319,@@ class pts_external_dependencies
             
}
         }
     }
-    public static function 
vendor_file_parents_list()
-    {
-        
$vendors = array();
-        foreach(
pts_file_io::glob(PTS_EXDEP_PATH 'xml/*-packages.xml') as $package_xml)
-        {
-            
$xml_parser = new nye_XmlReader($package_xml);
-            
$vendor $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Name');
-
-            if(
$vendor != null)
-            {
-                
array_push($vendors$vendor);
-            }
-        }
-
-        return 
$vendors;
-    }
-    public static function 
vendor_alias_list($format true)
-    {
-        
$alias_list = array();
-
-        foreach(
pts_file_io::glob(PTS_EXDEP_PATH 'xml/*-packages.xml') as $package_xml)
-        {
-            
$xml_parser = new nye_XmlReader($package_xml);
-            
$aliases $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Aliases');
-
-            if(
$aliases != null)
-            {
-                
$aliases pts_strings::trim_explode(','$aliases);
-                
$parent substr(basename($package_xml'.xml'), 0, -9);
-
-                foreach(
$aliases as $alias)
-                {
-
-                    if(
$format == true)
-                    {
-                        
$alias strtolower(str_replace(' 'null$alias));
-                    }
-
-                    if(
$alias != null)
-                    {
-                        
$alias_list[$alias] = $parent;
-                    }
-                }
-            }
-        }
-
-        return 
$alias_list;
-    }
     private static function 
vendor_identifier($type)
     {
         
$os_vendor phodevi::read_property('system''vendor-identifier');
@@ -
418,16 +337,@@ class pts_external_dependencies

         
if($file_check_success == false)
         {
-            
$vendor_aliases pts_storage_object::read_from_file(PTS_TEMP_STORAGE'vendor_alias_list');
-            if(
$vendor_aliases == null)
-            {
-                
$vendor_aliases pts_external_dependencies::vendor_alias_list();
-            }
-
-            if(isset(
$vendor_aliases[$os_vendor]))
-            {
-                
$os_vendor $vendor_aliases[$os_vendor];
-            }
+            
$exdep_generic_parser = new pts_exdep_generic_parser();
+            
$os_vendor $exdep_generic_parser->find_vendor_alias($os_vendor);

             if(
$os_vendor == false && is_file('/etc/debian_version'))
             {
@@ -
441,15 +352,14 @@ class pts_external_dependencies
     
private static function generic_names_to_titles($names)
     {
         
$titles = array();
-        
$xml_parser = new nye_XmlReader(PTS_EXDEP_PATH 'xml/generic-packages.xml');
-        
$package_name $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
-        
$title $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/Title');
+        
$generic_dependencies_parser = new pts_exdep_generic_parser();

-        foreach(
array_keys($package_name) as $i)
+        foreach(
$generic_dependencies_parser->get_available_packages() as $package)
         {
-            if(
in_array($package_name[$i], $names))
+            if(
in_array($package$names))
             {
-                
array_push($titles$title[$i]);
+                
$package_data $generic_dependencies_parser->get_package_data($package);
+                
array_push($titles$package_data['title']);
             }
         }
         
sort($titles);
diff --git a/pts-core/objects/pts_exdep_generic_parser.php b/pts-core/objects/pts_exdep_generic_parser.php
new file mode 100644
index 0000000..433303e
--- /dev/null
+++ b/pts-core/objects/pts_exdep_generic_parser.php
@@ -0,+1,145 @@
+<?
php
+
+
/*
+    Phoronix Test Suite
+    URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
+    Copyright (C) 2012, Phoronix Media
+    Copyright (C) 2012, Michael Larabel
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class 
pts_exdep_generic_parser
+{
+    public 
$struct;
+
+    public function 
__construct()
+    {
+        
$this->struct = array('external-dependencies' => array('generic-packages' => array()));
+
+        if(
PTS_IS_CLIENT)
+        {
+            
$xml_parser = new nye_XmlReader(PTS_EXDEP_PATH 'xml/generic-packages.xml');
+            
$generic_package_name $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
+            
$title $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/Title');
+            
$generic_file_check $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
+            
$possible_packages $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PossibleNames');
+
+            foreach(
array_keys($generic_package_name) as $i)
+            {
+                
$this->struct['external-dependencies']['generic-packages'][$generic_package_name[$i]] = $this->get_package_format($title[$i], $generic_file_check[$i], $possible_packages[$i]);
+            }
+        }
+    }
+    public function 
get_package_format($title null$file_check null$possible_packages null)
+    {
+        return array(
+            
'title' => $title,
+            
'file_check' => $file_check,
+            
'possible_packages' => $possible_packages
+            );
+    }
+    public function 
get_available_packages()
+    {
+        return 
array_keys($this->struct['external-dependencies']['generic-packages']);
+    }
+    public function 
is_package($package)
+    {
+        return isset(
$this->struct['external-dependencies']['generic-packages'][$package]);
+    }
+    public function 
get_package_data($package)
+    {
+        return 
$this->is_package($package) ? $this->struct['external-dependencies']['generic-packages'][$package] : $this->get_package_format();
+    }
+    public function 
get_vendors_list()
+    {
+        
$package_files pts_file_io::glob(PTS_EXDEP_PATH 'xml/*-packages.xml');
+
+        foreach(
$package_files as &$file)
+        {
+            
$file substr(basename($file'.xml'), 0'-packages.xml');
+        }
+
+        return 
$package_files;
+    }
+    public function 
get_vendors_list_formatted()
+    {
+        
$vendors = array();
+
+        foreach(
$this->get_vendors_list() as $vendor)
+        {
+            
$exdep_platform_parser = new pts_exdep_platform_parser($vendor);
+            
$name $exdep_platform_parser->get_name();
+
+            if(
$name)
+            {
+                
array_push($vendors$name);
+            }
+        }
+
+        return 
$vendors;
+    }
+    public static function 
find_vendor_alias($alias)
+    {
+        foreach(
$this->get_vendors_list() as $vendor)
+        {
+            
$exdep_platform_parser = new pts_exdep_platform_parser($vendor);
+            
$aliases $exdep_platform_parser->get_aliases();
+
+            if(
in_array($alias$aliases))
+            {
+                return 
$vendor;
+            }
+        }
+
+        return 
false;
+    }
+    public static function 
get_vendor_aliases()
+    {
+        
$alias_list = array();
+
+        foreach(
$this->get_vendors_list() as $vendor)
+        {
+            
$exdep_platform_parser = new pts_exdep_platform_parser($vendor);
+            
$aliases $exdep_platform_parser->get_aliases();
+
+            foreach(
$aliases as $alias)
+            {
+                
array_push($alias_list$alias);
+            }
+        }
+
+        return 
$alias_list;
+    }
+    public static function 
get_vendor_aliases_formatted()
+    {
+        
$alias_list = array();
+
+        foreach(
$this->get_vendors_list() as $vendor)
+        {
+            
$exdep_platform_parser = new pts_exdep_platform_parser($vendor);
+            
$aliases $exdep_platform_parser->get_aliases_formatted();
+
+            foreach(
$aliases as $alias)
+            {
+                
array_push($alias_list$alias);
+            }
+        }
+
+        return 
$alias_list;
+    }
+}
+
+
+
?>
diff --git a/pts-core/objects/pts_exdep_platform_parser.php b/pts-core/objects/pts_exdep_platform_parser.php
new file mode 100644
index 0000000..11cba38
--- /dev/null
+++ b/pts-core/objects/pts_exdep_platform_parser.php
@@ -0,0 +1,116 @@
+<?php
+
+
/*
+    Phoronix Test Suite
+    URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
+    Copyright (C) 2012, Phoronix Media
+    Copyright (C) 2012, Michael Larabel
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class 
pts_exdep_platform_parser
+{
+    public 
$struct;
+
+    public function 
__construct($identifier null)
+    {
+        
$this->struct = array('external-dependencies' => array('name' => null'aliases' => array(), 'packages' => array()));
+
+        if(
PTS_IS_CLIENT)
+        {
+            
$xml PTS_EXDEP_PATH 'xml/' $identifier '-packages.xml';
+            
$xml_parser = new nye_XmlReader($xml);
+
+            
$this->struct['external-dependencies']['name'] = $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Name');
+            
$generic_package $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
+            
$distro_package $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/PackageName');
+            
$file_check $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/FileCheck');
+            
$arch_specific $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/ArchitectureSpecific');
+            
$kernel_architecture phodevi::read_property('system''kernel-architecture');
+
+            foreach(
array_keys($generic_package) as $i)
+            {
+                if(empty(
$generic_package[$i]))
+                {
+                    continue;
+                }
+
+                
$this->struct['external-dependencies']['packages'][$generic_package[$i]] = $this->get_package_format($distro_package[$i], $file_check[$i], $arch_specific[$i]);
+            }
+
+            
$aliases $xml_parser->getXMLValue('PhoronixTestSuite/ExternalDependencies/Information/Aliases');
+
+            if(
$aliases != null)
+            {
+                
$aliases pts_strings::trim_explode(','$aliases);
+
+                foreach(
$aliases as $alias)
+                {
+                    if(
$alias != null)
+                    {
+                        
array_push($this->struct['external-dependencies']['aliases'], $alias);
+                    }
+                }
+            }
+        }
+    }
+    public function 
get_package_format($distro_package null$file_check null$arch_specific null)
+    {
+        if(!
is_array($arch_specific))
+        {
+            
$arch_specific pts_strings::comma_explode($arch_specific);
+        }
+
+        return array(
+            
'os_package' => $distro_package,
+            
'file_check' => $file_check,
+            
'arch_specific' => $arch_specific
+            );
+    }
+    public function 
get_name()
+    {
+        return 
$this->struct['external-dependencies']['name'];
+    }
+    public function 
get_aliases()
+    {
+        
$aliases $this->struct['external-dependencies']['aliases'];
+
+        foreach(
$aliases as &$alias)
+        {
+            
$alias strtolower(str_replace(' 'null$alias));
+        }
+
+        return 
$aliases;
+    }
+    public function 
get_aliases_formatted()
+    {
+        return 
$this->struct['external-dependencies']['aliases'];
+    }
+    public function 
is_package($package)
+    {
+        return isset(
$this->struct['external-dependencies']['packages'][$package]);
+    }
+    public function 
get_available_packages()
+    {
+        return 
array_keys($this->struct['external-dependencies']['packages']);
+    }
+    public function 
get_package_data($package)
+    {
+        return 
$this->is_package($package) ? $this->struct['external-dependencies']['packages'][$package] : $this->get_package_format();
+    }
+}
+
+
+
?>
diff --git a/pts-core/objects/pts_test_profile.php b/pts-core/objects/pts_test_profile.php
index 1d83f24..e6a96f1 100644
--- a/pts-core/objects/pts_test_profile.php
+++ b/pts-core/objects/pts_test_profile.php
@@ -125,20 +125,15 @@ class pts_test_profile extends pts_test_profile_parser
     public function get_dependency_names()
     {
         $dependency_names = array();
-
-        $xml_parser = new nye_XmlReader(PTS_EXDEP_PATH . 'xml/generic-packages.xml');
-        $package_name = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/GenericName');
-        $title = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExternalDependencies/Package/Title');
+        $exdep_generic_parser = new pts_exdep_generic_parser();

         foreach($this->get_dependencies() as $dependency)
         {
-            foreach(array_keys($title) as $i)
+            if($exdep_generic_parser->is_package($dependency))
             {
-                if($dependency == $package_name[$i])
-                {
-                    array_push($dependency_names, $title[$i]);
-                    break;
-                }
+                $package_data = $exdep_generic_parser->get_package_data($dependency);
+                array_push($dependency_names, $package_data['title']);
+                break;
             }
     &n
 
Phoronix.com
Linux Driver Forums
Copyright © 2014 by Phoronix Media