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

Description: Unnamed repository; edit this file to name it for gitweb.
Last Change: Wed 2/3/10 13:04

Recent Commits
Time
Signed-Off By
Description
Commit Diff
Wed 2/3/10 13:04
Michael Larabel  
phoromatic: Add... 
Wed 2/3/10 12:38
Michael Larabel  
phoromatic: Add... 
Wed 2/3/10 12:27
Michael Larabel  
phoromatic: Add... 
Wed 2/3/10 9:26
Michael Larabel  
pts: Drop MD5 hashes in... 
Tue 2/2/10 23:43
Michael Larabel  
phoromatic: Add... 
Tue 2/2/10 23:35
Michael Larabel  
pts-core: Phoromatic... 
 
> --git a/CHANGE-LOG b/CHANGE-LOG
index 0b7dc6c
..a1e8fe0 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -23,+23,@@ Phoronix Test Suite (Git)
 - 
pts-coreAdd yasm to PTS External Dependencies
 
pts-coreSupport using PHP's cURL library for handling downloads when available
 - pts-core: Calculate download speeds for each test file download, to provide estimations on future downloads for how long it may take to download
+- pts-core: Drop support for SH PTS modules, since it was rarely used and just added overhead to pts-core module architecture
 - phodevi: Split out phodevi_parser module into phodevi_linux_parser, phodevi_osx_parser, and phodevi_solaris_parser for OS-specific functions
 - phodevi: Avoid situations of the manufacturer/vendor string being repeated in the motherboard property
 - phodevi: Add device notes and special settings string functionality to API
diff --git a/pts-core/library/pts-functions_modules.php b/pts-core/library/pts-functions_modules.php
index 9091c23..bdb7735 100644
--- a/pts-core/library/pts-functions_modules.php
+++ b/pts-core/library/pts-functions_modules.php
@@ -104,16 +104,7 @@ function pts_load_modules()
     $module_store_list = array();
     foreach(pts_module_manager::attached_modules() as $module)
     {
-        $module_type = pts_module_type($module);
-
-        if($module_type == "PHP")
-        {
-            eval("\$module_store_vars = " . $module . "::\$module_store_vars;");
-        }
-        else
-        {
-            $module_store_vars = array();
-        }
+        eval("\$module_store_vars = " . $module . "::\$module_store_vars;");

         if(is_array($module_store_vars))
         {
@@ -159,8 +150,7 @@ function pts_attach_module($module)
 function pts_load_module($module)
 {
     // Load the actual file needed that contains the module
-    return pts_module_type($module) == "PHP" && ((is_file(MODULE_LOCAL_DIR . $module . ".php") && include_once(MODULE_LOCAL_DIR . $module . ".php")) ||
-    (is_file(MODULE_DIR . $module . ".php") && include_once(MODULE_DIR . $module . ".php")));
+    return (is_file(MODULE_DIR . $module . ".php") && include_once(MODULE_DIR . $module . ".php")) || (is_file(MODULE_LOCAL_DIR . $module . ".php") && include_once(MODULE_LOCAL_DIR . $module . ".php"));
 }
 function pts_module_processes()
 {
@@ -170,10 +160,6 @@ function pts_module_events()
 {
     return array("__event_global_upload", "__event_results_saved", "__event_user_error");
 }
-function pts_is_php_module($module)
-{
-    return pts_module_type($module) == "PHP";
-}
 function pts_module_valid_user_command($module, $command = null)
 {
     $valid = false;
@@ -189,34 +175,31 @@ function pts_module_valid_user_command($module, $command = null)
         }
     }

-    if(pts_module_type($module) == "PHP")
+    if(!pts_module_manager::is_module_attached($module))
     {
-        if(!pts_module_manager::is_module_attached($module))
-        {
-            pts_attach_module($module);
-        }
+        pts_attach_module($module);
+    }

-        $all_options = pts_php_module_call($module, "user_commands");
+    $all_options = pts_module_call($module, "user_commands");

-        $valid = count($all_options) > 0 && ((isset($all_options[$command]) && method_exists($module, $all_options[$command])) ||
-            in_array($command, array("help")));
-    }
+    $valid = count($all_options) > 0 && ((isset($all_options[$command]) && method_exists($module, $all_options[$command])) ||
+        in_array($command, array("help")));

     return $valid;
 }
 function pts_module_run_user_command($module, $command, $arguments = null)
 {
-    $all_options = pts_php_module_call($module, "user_commands");
+    $all_options = pts_module_call($module, "user_commands");

     if(isset($all_options[$command]) && method_exists($module, $all_options[$command]))
     {
-        pts_php_module_call($module, $all_options[$command], $arguments);
+        pts_module_call($module, $all_options[$command], $arguments);
     }
     else
     {
         // Not a valid command, list available options for the module
         // or help or list_options was called
-        $all_options = pts_php_module_call($module, "user_commands");
+        $all_options = pts_module_call($module, "user_commands");

         echo "\nUser commands for the " . $module . " module:\n\n";

@@ -229,38 +212,6 @@ function pts_module_run_user_command($module, $command, $arguments = null)
 }
 function pts_module_call($module, $process, &$object_pass = null)
 {
-    $module_type = pts_module_type($module);
-
-    if($module_type == "PHP")
-    {
-        $module_response = pts_php_module_call($module, $process, $object_pass);
-    }
-    else if($module_type == "SH")
-    {
-        $module_response = pts_sh_module_call($module, $process);
-    }
-    else
-    {
-        $module_response = "";
-    }
-
-    return $module_response;
-}
-function pts_sh_module_call($module, $process)
-{
-    if(is_file(($module_file = MODULE_DIR . $module . ".sh")) || is_file(($module_file = MODULE_LOCAL_DIR . $module . ".sh")))
-    {
-        $module_return = trim(shell_exec("sh " . $module_file . " " . $process . " 2>&1"));
-    }
-    else
-    {
-        $module_return = null;
-    }
-
-    return $module_return;
-}
-function pts_php_module_call($module, $process, &$object_pass = null)
-{
     if(method_exists($module, $process))
     {
         eval("\$module_val = " . $module . "::" . $process . "(\$object_pass);");
@@ -330,19 +281,11 @@ function pts_module_type($name)
     {
         if(is_file(MODULE_LOCAL_DIR . $name . ".php"))
         {
-            $type = "PHP";
+            $type = "LOCAL_MODULE";
         }
         else if(is_file(MODULE_DIR . $name . ".php"))
         {
-            $type = "PHP";
-        }
-        else if(is_file(MODULE_LOCAL_DIR . $name . ".sh"))
-        {
-            $type = "SH";
-        }
-        else if(is_file(MODULE_DIR . $name . ".sh"))
-        {
-            $type = "SH";
+            $type = "MODULE";
         }
         else
         {
@@ -356,21 +299,12 @@ function pts_module_type($name)
 }
 function pts_available_modules()
 {
-    $modules = pts_array_merge(pts_glob(MODULE_DIR . "*"), pts_glob(MODULE_LOCAL_DIR . "*"));
+    $modules = pts_array_merge(pts_glob(MODULE_DIR . "*.php"), pts_glob(MODULE_LOCAL_DIR . "*.php"));
     $module_names = array();

     foreach($modules as $module)
     {
-        $module = basename($module);
-
-        if(substr($module, -3) == ".sh")
-        {
-            array_push($module_names, substr($module, 0, -3));
-        }
-        else if(substr($module, -4) == ".php")
-        {
-            array_push($module_names, substr($module, 0, -4));
-        }
+        array_push($module_names, basename($module, ".php"));
     }

     asort($module_names);
@@ -387,7 +321,7 @@ function pts_module_config_init($set_options = null)
     }
     else
     {
-        $file = "";
+        $file = null;
     }

     $module_config_parser = new tandem_XmlReader($file);
@@ -424,7 +358,7 @@ function pts_module_config_init($set_options = null)

     for($i = 0; $i < count($option_module); $i++)
     {
-        if(isset($option_module[$i]) && pts_module_type($option_module[$i]) != "")
+        if(isset($option_module[$i]) && pts_module_type($option_module[$i]) != null)
         {
             $config->addXmlObject(P_MODULE_OPTION_NAME, $i, $option_module[$i]);
             $config->addXmlObject(P_MODULE_OPTION_IDENTIFIER, $i, $option_identifier[$i]);
diff --git a/pts-core/modules/dummy_script_module.sh b/pts-core/modules/dummy_script_module.sh
deleted file mode 100755
index 003b6ae..0000000
--- a/pts-core/modules/dummy_script_module.sh
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-# Phoronix Test Suite
-# URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
-# Copyright (C) 2008, Phoronix Media
-# Copyright (C) 2004-2008, Michael Larabel
-# dummy_script_module.sh: A simple "dummy" module to demonstrate the PTS functions using a SH file
-
-# 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/>.
-
-case $1 in
-
-    # PTS Module Information
-
-    "module_name")
-        echo "Dummy SH Module"
-    ;;
-    "module_version")
-        echo "1.0.0"
-    ;;
-    "module_description")
-        echo "This is a simple module intended for developers to just demonstrate some of the module functions. This is similar to the PTS module named dummy_module but is written using a sh script."
-    ;;
-    "module_author")
-        echo "Phoronix Media"
-    ;;
-    "module_info")
-        echo "This is a simple module intended for developers to just demonstrate some of the module functions."
-    ;;
-
-    # General Calls
-
-    "__startup")
-        echo "\nThe Phoronix Test Suite is starting up!\nCalled: __startup\n"
-    ;;
-    "__shutdown")
-        echo "\nThe Phoronix Test Suite is done running.\nCalled: __shutdown\n"
-    ;;
-
-    # Installation Calls
-
-    "__pre_install_process")
-        echo "\nGetting ready to check for test(s) that need installing...\nCalled: __pre_install_process()\n"
-    ;;
-    "__pre_test_install")
-        echo "\nJust finished installing a test, is there anything to do?\nCalled: __post_test_install()\n"
-    ;;
-    "__post_test_install")
-        echo "\nJust finished installing a test, is there anything to do?\nCalled: __post_test_install()\n"
-    ;;
-    "__post_install_process")
-        echo "\nWe'
re all done installing any needed testsAnything to process?nCalled__post_install_process()n"
-    ;;
-
-    # Run Calls
-
-    "
__pre_run_process")
-        echo "
nWe're about to start the actual testing process.\nCalled: __pre_run_process()\n"
-    ;;
-    "__pre_test_run")
-        echo "\nWe'
re about to run a testAny pre-run processing?nCalled__pre_test_run()n"
-    ;;
-    "
__interim_test_run")
-        echo "
nThis test is being run multiple times for accuracyAnything to do between tests?nCalled__interim_test_run()n"
-    ;;
-    "
__post_test_run")
-        echo "
nWe're all done running this specific test.\nCalled: __post_test_run()\n"
-    ;;
-    "__post_run_process")
-        echo "\nWe'
re all done with the testing for now.nCalled__post_run_process()n"
-    ;;
-    * )
-        echo "
nERRORCall To $1 Was Not Supported!n"
-    ;;
-esac
diff --git a/pts-core/objects/display_modes/pts_concise_display_mode.php b/pts-core/objects/display_modes/pts_concise_display_mode.php
index 3e8d244..610553a 100644
--- a/pts-core/objects/display_modes/pts_concise_display_mode.php
+++ b/pts-core/objects/display_modes/pts_concise_display_mode.php
@@ -69,22 +69,21 @@ class pts_concise_display_mode implements pts_display_mode_interface
     }
     public function test_install_download_file(&$pts_test_file_download, $process)
     {
-        echo "
tt" . $pts_test_file_download->get_filename() . "";
         $expected_time = 0;

         switch($process)
         {
             case "
DOWNLOAD_FROM_CACHE":
-                echo "
Downloading From Cache";
+                $process_string = "
Downloading From Cache";
                 break;
             case "
LINK_FROM_CACHE":
-                echo "
Linking From Cache";
+                $process_string = "
Linking From Cache";
                 break;
             case "
COPY_FROM_CACHE":
-                echo "
Copying From Cache";
+                $process_string = "
Copying From Cache";
                 break;
             case "
DOWNLOAD":
-                echo "
Downloading";
+                $process_string = "
Downloading";

                 if(($avg_speed = pts_read_assignment("
DOWNLOAD_AVG_SPEED")) > 0 && ($this_size = $pts_test_file_download->get_filesize()) > 0)
                 {
@@ -95,6 +94,7 @@ class pts_concise_display_mode implements pts_display_mode_interface

         $expected_time = is_numeric($expected_time) && $expected_time > 0 ? pts_format_time_string($expected_time, "
SECONDS", false, 60) : null;

+        echo "
tt" . $process_string . "" . $pts_test_file_download->get_filename();
         echo " 
[" . pts_trim_double($pts_test_file_download->get_filesize() / 1048576, 1) . "MB" . ($expected_time != null ? " / ~" . $expected_time : null) . "]n";
     }
     public function test_install_process($identifier)
diff --git a/pts-core/objects/pts_module.php b/pts-core/objects/pts_module.php
index 29b7f3d..850e45d 100644
--- a/pts-core/objects/pts_module.php
+++ b/pts-core/objects/pts_module.php
@@ -35,7 +35,7 @@ class pts_module
         $module_name = self::module_name();
         $is_setup = true;

-        $module_setup_options = pts_php_module_call($module_name, "
module_setup");
+        $module_setup_options = pts_module_call($module_name, "
module_setup");

         foreach($module_setup_options as $option)
         {
diff --git a/pts-core/objects/pts_test_option.php b/pts-core/objects/pts_test_option.php
index 7fafed3..b368085 100644
--- a/pts-core/objects/pts_test_option.php
+++ b/pts-core/objects/pts_test_option.php
@@ -123,7 +123,7 @@ class pts_test_option
             $display_name = trim(substr($display_name, 0, $cut_point));
         }

-        return $this->format_option_display_from_input($input);
+        return $this->format_option_display_from_input($display_name);
     }
     public function is_valid_select_choice($select_pos)
     {
diff --git a/pts-core/options/module_setup.php b/pts-core/options/module_setup.php
index 5736275..a55d67a 100644
--- a/pts-core/options/module_setup.php
+++ b/pts-core/options/module_setup.php
@@ -32,66 +32,58 @@ class module_setup implements pts_option_interface
     {
         $module = strtolower($r[0]);

-        if(pts_is_php_module($module))
-        {
-            $pre_message = "";
+        $pre_message = "";

-            if(!class_exists($module))
-            {
-                pts_load_module($module);
-            }
+        if(!class_exists($module))
+        {
+            pts_load_module($module);
+        }

-            $module_name = pts_php_module_call($module, "
module_name");
-            $module_description = pts_php_module_call($module, "
module_description");
-            $module_setup = pts_php_module_call($module, "
module_setup");
+        $module_name = pts_module_call($module, "
module_name");
+        $module_description = pts_module_call($module, "
module_description");
+        $module_setup = pts_module_call($module, "
module_setup");

-            echo pts_string_header("
Module" . $module_name);
-            echo $module_description . "
n";
+        echo pts_string_header("
Module" . $module_name);
+        echo $module_description . "
n";

-            if(count($module_setup) == 0)
-            {
-                echo "
nThere are no options available for configuring with the " . $module . " module.n";
-            }
-            else
+        if(count($module_setup) == 0)
+        {
+            echo "
nThere are no options available for configuring with the " . $module . " module.n";
+        }
+        else
+        {
+            $set_options = array();
+            foreach($module_setup as $module_option)
             {
-                $set_options = array();
-                foreach($module_setup as $module_option)
+                if($module_option instanceOf pts_module_option)
                 {
-                    if($module_option instanceOf pts_module_option)
+                    do
                     {
-                        do
-                        {
-                            echo "
n" . $module_option->get_formatted_question();
-                            $input = pts_read_user_input();
-                        }
-                        while(!$module_option->is_supported_value($input));
-
-                        if(empty($input))
-                        {
-                            $input = $module_option->get_default_value();
-                        }
-
-                        $this_input_identifier = $module_option->get_identifier();
-                        $set_options[$this_input_identifier] = $input;
+                        echo "
n" . $module_option->get_formatted_question();
+                        $input = pts_read_user_input();
                     }
-                }
+                    while(!$module_option->is_supported_value($input));

-                $set_options = pts_php_module_call($module, "
module_setup_validate", $set_options);
+                    if(empty($input))
+                    {
+                        $input = $module_option->get_default_value();
+                    }

-                $formatted_options = array();
-                foreach($set_options as $option => $value)
-                {
-                    $formatted_options[$module . "
__" . $option] = $value;
+                    $this_input_identifier = $module_option->get_identifier();
+                    $set_options[$this_input_identifier] = $input;
                 }
-                pts_module_config_init($formatted_options);
             }

-            echo "
n";
-        }
-        else
-        {
-            echo "
n" . $module . " is not a recognized or configurable module.n";
+            $set_options = pts_module_call($module, "
module_setup_validate", $set_options);
+
+            $formatted_options = array();
+            foreach($set_options as $option => $value)
+            {
+                $formatted_options[$module . "
__" . $option] = $value;
+            }
+            pts_module_config_init($formatted_options);
         }
+        echo "
n";
    &nbs
 
Phoronix.com
Linux Driver Forums
Copyright © 2010 by Phoronix Media