summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-12 10:40:51 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-13 10:34:15 -0500
commit1565a6a86684615ff7bcd2f34950ed0465904e1d (patch)
tree46a65176f4a67abee305a9731fd7013f76204bb3
parente86cd227a3acd75c9c79a365e0c2ed4e3b4e3dbe (diff)
downloadphoronix-test-suite-upstream-1565a6a86684615ff7bcd2f34950ed0465904e1d.tar.gz
phoronix-test-suite-upstream-1565a6a86684615ff7bcd2f34950ed0465904e1d.tar.xz
phoronix-test-suite-upstream-1565a6a86684615ff7bcd2f34950ed0465904e1d.zip
pts-core: Add pts_user_module_details class
-rw-r--r--TYDAL-CHANGE-LOG1
-rw-r--r--pts-core/functions/pts-functions_modules.php10
-rw-r--r--pts-core/objects/pts-generic-classes.php28
-rw-r--r--pts-core/pts-run-cmd.php26
4 files changed, 41 insertions, 24 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG
index 221c220..7a1251d 100644
--- a/TYDAL-CHANGE-LOG
+++ b/TYDAL-CHANGE-LOG
@@ -5,3 +5,4 @@ Phoronix Test Suite (Git)
- pts-core: Switch over relevant define statements to using new PTS assignment functions for program-wide option-specific variable constants
- pts-core: Add pts_test_profile_details class
- pts-core: Add pts_test_suite_details class
+- pts-core: Add pts_user_module_details class
diff --git a/pts-core/functions/pts-functions_modules.php b/pts-core/functions/pts-functions_modules.php
index 030d6e5..f67aabe 100644
--- a/pts-core/functions/pts-functions_modules.php
+++ b/pts-core/functions/pts-functions_modules.php
@@ -193,7 +193,7 @@ function pts_module_call($module, $process, $object_pass = null)
{
$module_response = pts_php_module_call($module, $process, $object_pass);
}
- else if(in_array($process, pts_module_processes()))
+ else if(pts_module_type($module) == "SH")
{
$module_response = pts_sh_module_call($module, $process);
}
@@ -203,8 +203,14 @@ function pts_module_call($module, $process, $object_pass = null)
function pts_sh_module_call($module, $process)
{
$module_file = MODULE_DIR . $module . ".sh";
+ $module_return = "";
- return is_file($module_file) && trim(shell_exec("sh " . $module_file . " " . $process . " 2>&1"));
+ if(is_file($module_file))
+ {
+ $module_return = trim(shell_exec("sh " . $module_file . " " . $process . " 2>&1"));
+ }
+
+ return $module_return;
}
function pts_php_module_call($module, $process, $object_pass = null)
{
diff --git a/pts-core/objects/pts-generic-classes.php b/pts-core/objects/pts-generic-classes.php
index e09a7e1..98b5342 100644
--- a/pts-core/objects/pts-generic-classes.php
+++ b/pts-core/objects/pts-generic-classes.php
@@ -116,6 +116,34 @@ class pts_test_suite_details
return $str;
}
}
+class pts_user_module_details
+{
+ var $identifier;
+ var $name;
+ var $module;
+ var $version;
+ var $author;
+
+ public function __construct($module_file_path)
+ {
+ $module = basename(substr($module_file_path, 0, strrpos($module_file_path, ".")));
+ $this->module = $module;
+
+ if(!in_array($module, pts_attached_modules()) && substr($module_file_path, -3) == "php")
+ {
+ include_once($module_file_path);
+ }
+
+ $this->name = pts_module_call($module, "module_name");
+ $this->version = pts_module_call($module, "module_version");
+ $this->author = pts_module_call($module, "module_author");
+ }
+ public function __toString()
+ {
+ return sprintf("%-22ls - %-30ls [%s]\n", $this->module, $this->name . " v" . $this->version, $this->author);
+ }
+
+}
class pts_test_profile_details
{
var $identifier;
diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php
index ee2c292..1a175c6 100644
--- a/pts-core/pts-run-cmd.php
+++ b/pts-core/pts-run-cmd.php
@@ -202,29 +202,11 @@ switch($COMMAND)
break;
case "LIST_MODULES":
echo pts_string_header("Phoronix Test Suite - Modules");
- foreach(glob(MODULE_DIR . "*.php") as $module_file)
+ $available_modules = array_merge(glob(MODULE_DIR . "*.sh"), glob(MODULE_DIR . "*.php"));
+ asort($available_modules);
+ foreach($available_modules as $module_file)
{
- $module = basename($module_file, ".php");
-
- if(!in_array($module, pts_attached_modules()))
- {
- include_once($module_file);
- }
-
- $module_name = pts_php_module_call($module, "module_name");
- $module_version = pts_php_module_call($module, "module_version");
- $module_author = pts_php_module_call($module, "module_author");
-
- printf("%-22ls - %-30ls [%s]\n", $module, $module_name . " v" . $module_version, $module_author);
- }
- foreach(glob(MODULE_DIR . "*.sh") as $module_file)
- {
- $module = basename($module_file, ".sh");
- $module_name = pts_sh_module_call($module, "module_name");
- $module_version = pts_sh_module_call($module, "module_version");
- $module_author = pts_sh_module_call($module, "module_author");
-
- printf("%-22ls - %-30ls [%s]\n", $module, $module_name . " v" . $module_version, $module_author);
+ echo new pts_user_module_details($module_file);
}
echo "\n";
break;