summaryrefslogtreecommitdiffstats
path: root/pts-core
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-12-16 13:07:34 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-12-16 13:07:34 -0500
commit13d1d7d225a0ec6e46fd5680bfe140fa4640a6a8 (patch)
tree93ba0099a0f71386bfded76bec970bf8812a1e0e /pts-core
parent0944661c4f454f1a0ef583a0a85e1691f0cefcd5 (diff)
downloadphoronix-test-suite-upstream-13d1d7d225a0ec6e46fd5680bfe140fa4640a6a8.tar.gz
phoronix-test-suite-upstream-13d1d7d225a0ec6e46fd5680bfe140fa4640a6a8.tar.xz
phoronix-test-suite-upstream-13d1d7d225a0ec6e46fd5680bfe140fa4640a6a8.zip
pts-core: Add pts-functions_assignments.php
Diffstat (limited to 'pts-core')
-rw-r--r--pts-core/functions/pts-functions.php96
-rw-r--r--pts-core/functions/pts-functions_assignments.php120
2 files changed, 121 insertions, 95 deletions
diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php
index ca32251..3e3855b 100644
--- a/pts-core/functions/pts-functions.php
+++ b/pts-core/functions/pts-functions.php
@@ -35,6 +35,7 @@ require_once("pts-core/functions/pts-functions_tests.php");
require_once("pts-core/functions/pts-functions_types.php");
require_once("pts-core/functions/pts-functions_vars.php");
require_once("pts-core/functions/pts-functions_modules.php");
+require_once("pts-core/functions/pts-functions_assignments.php");
// Phoronix Test Suite - Functions
function pts_run_option_command($command, $pass_args = null, $command_descriptor = "")
@@ -132,19 +133,6 @@ function pts_trim_double($double, $accuracy = 2)
return $return;
}
-function pts_unique_runtime_identifier()
-{
- if(pts_is_assignment("THIS_OPTION_IDENTIFIER"))
- {
- $identifier = pts_read_assignment("THIS_OPTION_IDENTIFIER");
- }
- else
- {
- $identifier = PTS_INIT_TIME;
- }
-
- return $identifier;
-}
function pts_load_function_set($title)
{
$function_file = "pts-core/functions/pts-functions-" . $title . ".php";
@@ -272,19 +260,6 @@ function pts_is_valid_download_url($string, $basename = null)
return $is_valid;
}
-function pts_time_elapsed()
-{
- if(pts_is_assignment("START_TIME"))
- {
- $start_time = pts_read_assignment("START_TIME");
- }
- else
- {
- $start_time = PTS_INIT_TIME;
- }
-
- return (time() - $start_time);
-}
function pts_evaluate_script_type($script)
{
$script = explode("\n", trim($script));
@@ -387,74 +362,5 @@ function pts_user_message($message)
}
}
}
-function pts_set_assignment_once($assignment, $value)
-{
- $set_assignment = false;
-
- if(!pts_is_assignment($assignment))
- {
- pts_set_assignment($assignment, $value);
- $set_assignment = true;
- }
-
- return $set_assignment;
-}
-function pts_set_assignment($assignment, $value)
-{
- if(!is_array($assignment))
- {
- $assignment = array($assignment);
- }
-
- foreach($assignment as $this_assignment)
- {
- pts_assignment("SET", $this_assignment, $value);
- }
-}
-function pts_read_assignment($assignment)
-{
- return pts_assignment("READ", $assignment);
-}
-function pts_is_assignment($assignment)
-{
- return pts_assignment("IS_SET", $assignment);
-}
-function pts_clear_assignments()
-{
- pts_assignment("CLEAR_ALL");
-}
-function pts_clear_assignment($assignment)
-{
- pts_assignment("CLEAR", $assignment);
-}
-function pts_assignment($process, $assignment = null, $value = null)
-{
- static $assignments;
- $return = false;
-
- switch($process)
- {
- case "SET":
- $assignments[$assignment] = $value;
- break;
- case "READ":
- if(isset($assignments[$assignment]))
- {
- $return = $assignments[$assignment];
- }
- break;
- case "IS_SET":
- $return = isset($assignments[$assignment]);
- break;
- case "CLEAR":
- unset($assignments[$assignment]);
- break;
- case "CLEAR_ALL":
- $assignments = array();
- break;
- }
-
- return $return;
-}
?>
diff --git a/pts-core/functions/pts-functions_assignments.php b/pts-core/functions/pts-functions_assignments.php
new file mode 100644
index 0000000..eb90268
--- /dev/null
+++ b/pts-core/functions/pts-functions_assignments.php
@@ -0,0 +1,120 @@
+<?php
+
+/*
+ Phoronix Test Suite
+ URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
+ Copyright (C) 2008, Phoronix Media
+ Copyright (C) 2008, Michael Larabel
+ pts-functions_assignments.php: Functions for the assignment operations
+
+ 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_assignment($process, $assignment = null, $value = null)
+{
+ static $assignments;
+ $return = false;
+
+ switch($process)
+ {
+ case "SET":
+ $assignments[$assignment] = $value;
+ break;
+ case "READ":
+ if(isset($assignments[$assignment]))
+ {
+ $return = $assignments[$assignment];
+ }
+ break;
+ case "IS_SET":
+ $return = isset($assignments[$assignment]);
+ break;
+ case "CLEAR":
+ unset($assignments[$assignment]);
+ break;
+ case "CLEAR_ALL":
+ $assignments = array();
+ break;
+ }
+
+ return $return;
+}
+function pts_set_assignment_once($assignment, $value)
+{
+ $set_assignment = false;
+
+ if(!pts_is_assignment($assignment))
+ {
+ pts_set_assignment($assignment, $value);
+ $set_assignment = true;
+ }
+
+ return $set_assignment;
+}
+function pts_set_assignment($assignment, $value)
+{
+ if(!is_array($assignment))
+ {
+ $assignment = array($assignment);
+ }
+
+ foreach($assignment as $this_assignment)
+ {
+ pts_assignment("SET", $this_assignment, $value);
+ }
+}
+function pts_read_assignment($assignment)
+{
+ return pts_assignment("READ", $assignment);
+}
+function pts_is_assignment($assignment)
+{
+ return pts_assignment("IS_SET", $assignment);
+}
+function pts_clear_assignments()
+{
+ pts_assignment("CLEAR_ALL");
+}
+function pts_clear_assignment($assignment)
+{
+ pts_assignment("CLEAR", $assignment);
+}
+function pts_unique_runtime_identifier()
+{
+ if(pts_is_assignment("THIS_OPTION_IDENTIFIER"))
+ {
+ $identifier = pts_read_assignment("THIS_OPTION_IDENTIFIER");
+ }
+ else
+ {
+ $identifier = PTS_INIT_TIME;
+ }
+
+ return $identifier;
+}
+function pts_time_elapsed()
+{
+ if(pts_is_assignment("START_TIME"))
+ {
+ $start_time = pts_read_assignment("START_TIME");
+ }
+ else
+ {
+ $start_time = PTS_INIT_TIME;
+ }
+
+ return (time() - $start_time);
+}
+
+?>