Summary
Description: Phoronix Test Suite open-source benchmarking development
Last Change: Fri 5/17/13 22:52
Recent Commits
>
--git a/pts-core/library/pts-functions.php b/pts-core/library/pts-functions.php
index 539ec25..729d09b 100644
--- a/pts-core/library/pts-functions.php
+++ b/pts-core/library/pts-functions.php
@@ -57,7 +57,6 @@ require(PTS_LIBRARY_PATH . "pts-functions_client.php");
// Load Main Functions
require(PTS_LIBRARY_PATH . "pts-functions_io.php");
-require(PTS_LIBRARY_PATH . "pts-functions_shell.php");
require(PTS_LIBRARY_PATH . "pts-functions_system.php");
require(PTS_LIBRARY_PATH . "pts-functions_global.php");
require(PTS_LIBRARY_PATH . "pts-functions_tests.php");
diff --git a/pts-core/library/pts-functions_basic.php b/pts-core/library/pts-functions_basic.php
index f102df9..98dfd67 100644
--- a/pts-core/library/pts-functions_basic.php
+++ b/pts-core/library/pts-functions_basic.php
@@ -103,4 +103,61 @@ function pts_to_array($var)
return !is_array($var) ? array($var) : $var;
}
+function pts_exec($exec, $extra_vars = null)
+{
+ // Same as shell_exec() but with the PTS env variables added in
+ return shell_exec(pts_variables_export_string($extra_vars) . $exec);
+}
+function pts_remove($object, $ignore_files = null, $remove_root_directory = false)
+{
+ if(is_dir($object))
+ {
+ $object = pts_add_trailing_slash($object);
+ }
+
+ foreach(pts_glob($object . "*") as $to_remove)
+ {
+ if(is_file($to_remove))
+ {
+ if(is_array($ignore_files) && in_array(basename($to_remove), $ignore_files))
+ {
+ continue; // Don't remove the file
+ }
+ else
+ {
+ @unlink($to_remove);
+ }
+ }
+ else if(is_dir($to_remove))
+ {
+ pts_remove($to_remove, $ignore_files, true);
+ }
+ }
+
+ if($remove_root_directory && is_dir($object) && count(pts_glob($object . "/*")) == 0)
+ {
+ @rmdir($object);
+ }
+}
+function pts_copy($from, $to)
+{
+ // Copies a file
+ if(!is_file($to) || md5_file($from) != md5_file($to))
+ {
+ copy($from, $to);
+ }
+}
+function pts_rename($from, $to)
+{
+ return rename($from, $to);
+}
+function pts_symlink($from, $to)
+{
+ return @symlink($from, $to);
+}
+function pts_move($from, $to)
+{
+ return rename($from, $to);
+}
+
?>
diff --git a/pts-core/library/pts-functions_shell.php b/pts-core/library/pts-functions_shell.php
deleted file mode 100644
index 253004f..0000000
--- a/pts-core/library/pts-functions_shell.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-/*
- Phoronix Test Suite
- URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
- Copyright (C) 2008 - 2010, Phoronix Media
- Copyright (C) 2008 - 2010, Michael Larabel
- pts-functions_shell.php: Functions for shell (and similar) commands that are abstracted
-
- 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/>.
-*/
-
-function pts_exec($exec, $extra_vars = null)
-{
- // Same as shell_exec() but with the PTS env variables added in
- return shell_exec(pts_variables_export_string($extra_vars) . $exec);
-}
-function pts_remove($object, $ignore_files = null, $remove_root_directory = false)
-{
- if(is_dir($object))
- {
- $object = pts_add_trailing_slash($object);
- }
-
- foreach(pts_glob($object . "*") as $to_remove)
- {
- if(is_file($to_remove))
- {
- if(is_array($ignore_files) && in_array(basename($to_remove), $ignore_files))
- {
- continue; // Don't remove the file
- }
- else
- {
- @unlink($to_remove);
- }
- }
- else if(is_dir($to_remove))
- {
- pts_remove($to_remove, $ignore_files, true);
- }
- }
-
- if($remove_root_directory && is_dir($object) && count(pts_glob($object . "/*")) == 0)
- {
- @rmdir($object);
- }
-}
-function pts_copy($from, $to)
-{
- // Copies a file
- if(!is_file($to) || md5_file($from) != md5_file($to))
- {
- copy($from, $to);
- }
-}
-function pts_rename($from, $to)
-{
- return rename($from, $to);
-}
-function pts_symlink($from, $to)
-{
- return @symlink($from, $to);
-}
-function pts_move($from, $to)
-{
- return rename($from, $to);
-}
-
-?>
diff --git a/pts-core/library/pts-includes-batch.php b/pts-core/library/pts-includes-batch.php
deleted file mode 100644
index 1ea663f..0000000
--- a/pts-core/library/pts-includes-batch.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/*
- Phoronix Test Suite
- URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
- Copyright (C) 2008 - 2010, Phoronix Media
- Copyright (C) 2008 - 2010, Michael Larabel
- pts-includes-batch.php: Functions Needed When Running In Batch Mode
-
- 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/>.
-*/
-
-function pts_batch_mode_configured()
-{
- return pts_strings::string_bool(pts_config::read_user_config(P_OPTION_BATCH_CONFIGURED, "FALSE"));
-}
-function pts_batch_prompt_test_identifier()
-{
- return pts_strings::string_bool(pts_config::read_user_config(P_OPTION_BATCH_PROMPTIDENTIFIER, "TRUE"));
-}
-function pts_batch_prompt_test_description()
-{
- return pts_strings::string_bool(pts_config::read_user_config(P_OPTION_BATCH_PROMPTDESCRIPTION, "FALSE"));
-}
-function pts_batch_prompt_save_name()
-{
- return pts_strings::string_bool(pts_config::read_user_config(P_OPTION_BATCH_PROMPTSAVENAME, "FALSE"));
-}
-function pts_batch_run_all_test_options()
-{
- return pts_strings::string_bool(pts_config::read_user_config(P_OPTION_BATCH_TESTALLOPTIONS, "TRUE"));
-}
-
-?>
diff --git a/pts-core/library/pts-includes-iqc.php b/pts-core/library/pts-includes-iqc.php
deleted file mode 100644
index 3a0555e..0000000
--- a/pts-core/library/pts-includes-iqc.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-
-/*
- Phoronix Test Suite
- URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
- Copyright (C) 2009, Phoronix Media
- Copyright (C) 2009, Michael Larabel
- pts-includes-comparisons.php: Functions needed for performing reference comparisons
-
- 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/>.
-*/
-
-function pts_rgb_gd_color_at(&$img, $x, $y)
-{
- $rgb = imagecolorat($img, $x, $y);
-
- // R, G, B
- return array(($rgb >> 16) & 0xFF, ($rgb >> 8) & 0xFF, $rgb & 0xFF);
-}
-function pts_rgb_int_diff($rgb1, $rgb2)
-{
- return abs(array_sum($rgb1) - array_sum($rgb2));
-}
-function pts_color_pixel_delta(&$base_img, &$compare_img, &$x, &$y)
-{
- $color = false; // for now we set to true when it should change, but ultimately should return a color
-
- $check_points = array(
- array($x + 1, $y),
- array($x - 1, $y),
- array($x, $y + 1),
- array($x, $y - 1)
- );
-
- foreach($check_points as $point_r)
- {
- if(pts_rgb_int_diff(pts_rgb_gd_color_at($base_img, $point_r[0], $point_r[1]), pts_rgb_gd_color_at($compare_img, $point_r[0], $point_r[1])) > 12)
- {
- $color = array($point_r[0], $point_r[1]);
- break;
- }
- }
-
- return $color;
-}
-
-?>
diff --git a/pts-core/library/pts-includes-run_setup.php b/pts-core/library/pts-includes-run_setup.php
index b8b9a79..7fa737a 100644
--- a/pts-core/library/pts-includes-run_setup.php
+++ b/pts-core/library/pts-includes-run_setup.php
@@ -59,7 +59,7 @@ function pts_prompt_results_identifier(&$test_run_manager)
$current_software = array();
}
- if(pts_read_assignment("IS_BATCH_MODE") == false || pts_batch_prompt_test_identifier())
+ if(pts_read_assignment("IS_BATCH_MODE") == false || pts_config::read_bool_config(P_OPTION_BATCH_PROMPTIDENTIFIER, "TRUE"))
{
if(count($current_identifiers) > 0)
{
@@ -119,7 +119,7 @@ function pts_prompt_save_file_name(&$test_run_manager, $check_env = true)
}
}
- if(pts_read_assignment("IS_BATCH_MODE") == false || pts_batch_prompt_save_name())
+ if(pts_read_assignment("IS_BATCH_MODE") == false || pts_config::read_bool_config(P_OPTION_BATCH_PROMPTSAVENAME, "FALSE"))
{
while(($is_reserved_word = pts_is_run_object($proposed_name)) || empty($proposed_name))
{
diff --git a/pts-core/library/pts-includes-unit_caching.php b/pts-core/library/pts-includes-unit_caching.php
deleted file mode 100644
index 7fb6167..0000000
--- a/pts-core/library/pts-includes-unit_caching.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/*
- Phoronix Test Suite
- URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
- Copyright (C) 2009, Phoronix Media
- Copyright (C) 2009, Michael Larabel
- pts-includes-unit_caching.php: Functions that simply call pts-core functions for building their caches
-
- 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/>.
-*/
-
-function pts_cache_suite_calls()
-{
- pts_supported_suites_array();
- // pts_available_suites_array(); // This is already called within pts_supported_suites_array()
- pts_suite_name_to_identifier(-1);
-}
-function pts_cache_test_calls()
-{
- pts_tests::supported_tests();
- pts_test_name_to_identifier(-1);
-}
-function pts_cache_hardware_calls()
-{
- pts_hw_string();
- phodevi::supported_sensors();
- phodevi::unsupported_sensors();
-}
-function pts_cache_software_calls()
-{
- pts_sw_string();
-}
-
-?>
diff --git a/pts-core/objects/pts_client.php b/pts-core/objects/pts_client.php
index ebe2f6c..4e603c4 100644
--- a/pts-core/objects/pts_client.php
+++ b/pts-core/objects/pts_client.php
@@ -425,6 +425,26 @@ class pts_client
}
}
}
+ public static function cache_suite_calls()
+ {
+ pts_supported_suites_array();
+ pts_suite_name_to_identifier(-1);
+ }
+ public static function cache_test_calls()
+ {
+ pts_tests::supported_tests();
+ pts_test_name_to_identifier(-1);
+ }
+ public static function cache_hardware_calls()
+ {
+ pts_hw_string();
+ phodevi::supported_sensors();
+ phodevi::unsupported_sensors();
+ }
+ public static function cache_software_calls()
+ {
+ pts_sw_string();
+ }
}
?>
diff --git a/pts-core/objects/pts_config.php b/pts-core/objects/pts_config.php
index 8da3ef3..3f14ce1 100644
--- a/pts-core/objects/pts_config.php
+++ b/pts-core/objects/pts_config.php
@@ -150,6 +150,11 @@ class pts_config
return !empty($read_value) ? $read_value : $predefined_value;
}
+ public static function read_bool_config($xml_pointer, $predefined_value = false, &$tandem_xml = null)
+ {
+ $value = read_user_config($xml_pointer, $predefined_value, $tandem_xml);
+ return pts_strings::string_bool($value);
+ }
public static function read_graph_config($xml_pointer, $predefined_value = false, &$tandem_xml = null)
{
// Generic call for reading a config file
diff --git a/pts-core/objects/pts_image.php b/pts-core/objects/pts_image.php
index c815807..8857cae 100644
--- a/pts-core/objects/pts_image.php
+++ b/pts-core/objects/pts_image.php
@@ -77,6 +77,39 @@ class pts_image
return $img;
}
+ public static function rgb_gd_color_at(&$img, $x, $y)
+ {
+ $rgb = imagecolorat($img, $x, $y);
+
+ // R, G, B
+ return array(($rgb >> 16) & 0xFF, ($rgb >> 8) & 0xFF, $rgb & 0xFF);
+ }
+ public static function rgb_int_diff($rgb1, $rgb2)
+ {
+ return abs(array_sum($rgb1) - array_sum($rgb2));
+ }
+ public static function color_pixel_delta(&$base_img, &$compare_img, &$x, &$y)
+ {
+ $color = false; // for now we set to true when it should change, but ultimately should return a color
+
+ $check_points = array(
+ array($x + 1, $y),
+ array($x - 1, $y),
+ array($x, $y + 1),
+ array($x, $y - 1)
+ );
+
+ foreach($check_points as $point_r)
+ {
+ if(pts_image::rgb_int_diff(pts_image::rgb_gd_color_at($base_img, $point_r[0], $point_r[1]), pts_image::rgb_gd_color_at($compare_img, $point_r[0], $point_r[1])) > 12)
+ {
+ $color = array($point_r[0], $point_r[1]);
+ break;
+ }
+ }
+
+ return $color;
+ }
}
?>
diff --git a/pts-core/options/analyze_image_delta.php b/pts-core/options/analyze_image_delta.php
index 7aafcdf..a678716 100644
--- a/pts-core/options/analyze_image_delta.php
+++ b/pts-core/options/analyze_image_delta.php
@@ -24,7 +24,7 @@ class analyze_image_delta implements pts_option_interface
{
public static function required_function_sets()
{
- return array("run", "iqc");
+ return array("run");
}
public static function argument_checks()
{
@@ -106,14 +106,14 @@ class analyze_image_delta implements pts_option_interface
{
for($y = 0; $y < $img_height; $y++)
{
- $base_image_color = pts_rgb_gd_color_at($base_img, $x, $y);
- $compare_image_color = pts_rgb_gd_color_at($compare_img, $x, $y);
+ $base_image_color = pts_image::rgb_gd_color_at($base_img, $x, $y);
+ $compare_image_color = pts_image::rgb_gd_color_at($compare_img, $x, $y);
- if($base_image_color == $compare_image_color || pts_rgb_int_diff($base_image_color, $compare_image_color) < 9)
+ if($base_image_color == $compare_image_color || pts_image::rgb_int_diff($base_image_color, $compare_image_color) < 9)
{
- if(($cords = pts_color_pixel_delta($base_img, $compare_img, $x, $y)))
+ if(($cords = pts_image::color_pixel_delta($base_img, $compare_img, $x, $y)))
{
- $pixel_rgb = pts_rgb_gd_color_at($delta_img, $cords[0], $cords[1]);
+ $pixel_rgb = pts_image::rgb_gd_color_at($delta_img, $cords[0], $cords[1]);
$color_invert = imagecolorresolve($delta_img, 255 - $pixel_rgb[0], 255 - $pixel_rgb[1], 255 - $pixel_rgb[2]);
imagesetpixel($delta_img, $x, $y, $color_invert);
$img_changed = true;
diff --git a/pts-core/options/gui_gtk.php b/pts-core/options/gui_gtk.php
index afea233..b554e7d 100644
--- a/pts-core/options/gui_gtk.php
+++ b/pts-core/options/gui_gtk.php
@@ -24,7 +24,7 @@ class gui_gtk implements pts_option_interface
{
public static function required_function_sets()
{
- return array("gui", "run", "gtk", "install", "install_dependencies", "comparisons", "unit_caching");
+ return array("gui", "run", "gtk", "install", "install_dependencies", "comparisons");
}
public static function run($r)
{
@@ -82,21 +82,21 @@ class gui_gtk implements pts_option_interface
}
$startup_tasks = array(
- array("pts_cache_hardware_calls", "Building Hardware Information"),
- array("pts_cache_software_calls", "Building Software Information"),
- array("pts_cache_suite_calls", "Caching Suite Information"),
- array("pts_cache_test_calls", "Caching Test Information"),
- array("pts_download_all_generic_reference_system_comparison_results", "Downloading Reference Comparison Results"),
- array("pts_generic_reference_system_build_cache", "Building Reference Comparison Cache")
+ array("Building Hardware Information", array("pts_client", "cache_hardware_calls")),
+ array("Building Software Information", array("pts_client", "cache_software_calls")),
+ array("Caching Suite Information", array("pts_client", "cache_suite_calls")),
+ array("Caching Test Information", array("pts_client", "cache_test_calls")),
+ array("Downloading Reference Comparison Results", "pts_download_all_generic_reference_system_comparison_results"),
+ array("Building Reference Comparison Cache", "pts_generic_reference_system_build_cache")
);
$progress_window = new pts_gtk_simple_progress_window();
$tasks_completed = 0;
$task_count = count($startup_tasks);
- foreach($startup_tasks as $function => $task)
+ foreach($startup_tasks as &$task)
{
- list($task_call, $task_string) = $task;
+ list($task_string, $task_call) = $task;
$progress_window->update_progress_bar(($tasks_completed / $task_count) * 100, $task_string);
call_user_func($task_call);
$tasks_completed++;
diff --git a/pts-core/options/run_test.php b/pts-core/options/run_test.php
index b824731..a74bed0 100644
--- a/pts-core/options/run_test.php
+++ b/pts-core/options/run_test.php
@@ -24,13 +24,13 @@ class run_test implements pts_option_interface
{
public static function required_function_sets()
{
- return array("run", "batch", "execution");
+ return array("run", "execution");
}
public static function run($to_run_identifiers)
{
if(pts_read_assignment("IS_BATCH_MODE"))
{
- if(!pts_batch_mode_configured() && !pts_is_assignment("AUTOMATED_MODE"))
+ if(pts_config::read_bool_config(P_OPTION_BATCH_CONFIGURED, "FALSE") == false && !pts_is_assignment("AUTOMATED_MODE"))
{
echo pts_string_header("The batch mode must first be configured.\nRun: phoronix-test-suite batch-setup");
return false;
@@ -91,7 +91,7 @@ class run_test implements pts_option_interface
}
}
- if(pts_read_assignment("IS_BATCH_MODE") && pts_batch_run_all_test_options())
+ if(pts_read_assignment("IS_BATCH_MODE") && pts_config::read_bool_config(P_OPTION_BATCH_TESTALLOPTIONS, "TRUE"))
{
list($test_arguments, $test_arguments_description) = pts_generate_batch_run_options($to_run);
}
@@ -266,7 +266,7 @@ class run_test implements pts_option_interface
}
// Prompt Description
- if(!pts_is_assignment("AUTOMATED_MODE") && !pts_read_assignment("FINISH_INCOMPLETE_RUN") && !pts_is_assignment("RECOVER_RUN") && (pts_read_assignment("IS_BATCH_MODE") == false || pts_batch_prompt_test_description()))
+ if(!pts_is_assignment("AUTOMATED_MODE") && !pts_read_assignment("FINISH_INCOMPLETE_RUN") && !pts_is_assignment("RECOVER_RUN") && (pts_read_assignment("IS_BATCH_MODE") == false || pts_config::read_bool_config(P_OPTION_BATCH_PROMPTDESCRIPTION, "FALSE")))
{
if(empty($test_description))
&nb
Copyright © 2013 by Phoronix Media