summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-09-11 20:54:22 -0400
committerMichael Larabel <michael@phx-laptop.(none)>2008-09-11 20:54:22 -0400
commit99597c9f94c017c468e751cd7869a4ef1fe25096 (patch)
tree4265d587ca80d969303dabc47faf1bc2155f52ee
parent6363ea080aa93cfe4e8fc18077efff81678ee2ae (diff)
downloadphoronix-test-suite-upstream-99597c9f94c017c468e751cd7869a4ef1fe25096.tar.gz
phoronix-test-suite-upstream-99597c9f94c017c468e751cd7869a4ef1fe25096.tar.xz
phoronix-test-suite-upstream-99597c9f94c017c468e751cd7869a4ef1fe25096.zip
pts-core: Change test/suite type strings to define statements
-rw-r--r--EXPERIMENTAL-CHANGE-LOG2
-rw-r--r--pts-core/functions/pts-functions-extra.php6
-rw-r--r--pts-core/functions/pts-functions-install.php14
-rw-r--r--pts-core/functions/pts-functions-run.php8
-rw-r--r--pts-core/functions/pts-functions.php4
-rw-r--r--pts-core/functions/pts-interfaces.php7
-rw-r--r--pts-core/pts-run-cmd.php4
-rw-r--r--pts-core/pts-run-test.php6
8 files changed, 30 insertions, 21 deletions
diff --git a/EXPERIMENTAL-CHANGE-LOG b/EXPERIMENTAL-CHANGE-LOG
index 01e3ed1..32e8e44 100644
--- a/EXPERIMENTAL-CHANGE-LOG
+++ b/EXPERIMENTAL-CHANGE-LOG
@@ -1,3 +1,5 @@
PHORONIX TEST SUITE EXPERIMENTAL CHANGE-LOG
Phoronix Test Suite
+
+- pts-core: Change test/suite type strings to define statements
diff --git a/pts-core/functions/pts-functions-extra.php b/pts-core/functions/pts-functions-extra.php
index 13d7e00..ba8db62 100644
--- a/pts-core/functions/pts-functions-extra.php
+++ b/pts-core/functions/pts-functions-extra.php
@@ -50,7 +50,7 @@ function pts_tests_in_suite($object)
$type = pts_test_type($object);
$tests = array();
- if($type == "TEST_SUITE")
+ if($type == TYPE_TEST_SUITE)
{
$xml_parser = new tandem_XmlReader(@file_get_contents(XML_SUITE_DIR . $object . ".xml"));
$tests_in_suite = array_unique($xml_parser->getXMLArrayValues(P_SUITE_TEST_NAME));
@@ -59,7 +59,7 @@ function pts_tests_in_suite($object)
foreach(pts_tests_in_suite($test) as $sub_test)
array_push($tests, $sub_test);
}
- else if($type == "TEST")
+ else if($type == TYPE_TEST)
return array($object);
return array_unique($tests);
@@ -68,7 +68,7 @@ function pts_print_format_tests($object, $steps = -1)
{
// Print out a text tree that shows the suites and tests within an object
$steps++;
- if(pts_test_type($object) == "TEST_SUITE")
+ if(pts_test_type($object) == TYPE_TEST_SUITE)
{
$xml_parser = new tandem_XmlReader(@file_get_contents(XML_SUITE_DIR . $object . ".xml"));
$tests_in_suite = array_unique($xml_parser->getXMLArrayValues(P_SUITE_TEST_NAME));
diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php
index 5f8dae5..5a8285e 100644
--- a/pts-core/functions/pts-functions-install.php
+++ b/pts-core/functions/pts-functions-install.php
@@ -26,14 +26,14 @@ function pts_recurse_install_test($TO_INSTALL, &$INSTALL_OBJ)
// Recurse call to install a test/suite and to handle the PTS External Dependencies
$type = pts_test_type($TO_INSTALL);
- if($type == "TEST")
+ if($type == TYPE_TEST)
{
if(is_array($INSTALL_OBJ))
pts_install_external_dependencies_list($TO_INSTALL, $INSTALL_OBJ);
else
pts_install_test($TO_INSTALL);
}
- else if($type == "TEST_SUITE")
+ else if($type == TYPE_TEST_SUITE)
{
if(!getenv("SILENT_INSTALL") && !is_array($INSTALL_OBJ))
echo "Installing Test Suite: " . $TO_INSTALL . "\n";
@@ -350,7 +350,7 @@ function pts_install_test($identifier)
{
// Install a test
$installed = false;
- if(pts_test_type($identifier) == "TEST")
+ if(pts_test_type($identifier) == TYPE_TEST)
{
if(!pts_test_architecture_supported($identifier))
{
@@ -391,7 +391,7 @@ function pts_install_test($identifier)
{
$total_download_size = pts_estimated_download_size($argv[1]);
- if($total_download_size > 0 && pts_test_type($argv[1]) == "TEST_SUITE")
+ if($total_download_size > 0 && pts_test_type($argv[1]) == TYPE_TEST_SUITE)
echo pts_string_header("Total Estimated Download Size: " . $total_download_size . " MB");
}
@@ -557,7 +557,7 @@ function pts_install_packages_on_distribution_process($install_objects)
function pts_install_external_dependencies_list($identifier, &$INSTALL_OBJ)
{
// Install from a list of external dependencies
- if(pts_test_type($identifier) != "TEST")
+ if(pts_test_type($identifier) != TYPE_TEST)
return;
$xml_parser = new tandem_XmlReader(XML_PROFILE_DIR . $identifier . ".xml");
@@ -690,12 +690,12 @@ function pts_estimated_download_size($identifier)
$type = pts_test_type($identifier);
$estimated_size = 0;
- if($type == "TEST")
+ if($type == TYPE_TEST)
{
$xml_parser = new tandem_XmlReader(XML_PROFILE_DIR . $identifier . ".xml");
$estimated_size = $xml_parser->getXMLValue(P_TEST_DOWNLOADSIZE);
}
- else if($type == "TEST_SUITE")
+ else if($type == TYPE_TEST_SUITE)
{
$xml_parser = new tandem_XmlReader(XML_SUITE_DIR . $identifier . ".xml");
$suite_tests = array_unique($xml_parser->getXMLArrayValues(P_SUITE_TEST_NAME));
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php
index d0aed85..718cb40 100644
--- a/pts-core/functions/pts-functions-run.php
+++ b/pts-core/functions/pts-functions-run.php
@@ -166,7 +166,7 @@ function pts_recurse_verify_installation($TO_VERIFY, &$NEEDS_INSTALLING)
// Verify tests are installed
$type = pts_test_type($TO_VERIFY);
- if($type == "TEST")
+ if($type == TYPE_TEST)
{
if(!is_file(TEST_ENV_DIR . $TO_VERIFY . "/pts-install.xml"))
array_push($NEEDS_INSTALLING, $TO_VERIFY);
@@ -176,7 +176,7 @@ function pts_recurse_verify_installation($TO_VERIFY, &$NEEDS_INSTALLING)
define("TEST_INSTALL_PASS", true);
}
}
- else if($type == "TEST_SUITE")
+ else if($type == TYPE_TEST_SUITE)
{
$xml_parser = new tandem_XmlReader(XML_SUITE_DIR . $TO_VERIFY . ".xml");
$tests_in_suite = $xml_parser->getXMLArrayValues(P_SUITE_TEST_NAME);
@@ -216,7 +216,7 @@ function pts_recurse_call_tests($tests_to_run, $arguments_array, $save_results =
{
$test_type = pts_test_type($tests_to_run[$i]);
- if($test_type == "TEST_SUITE")
+ if($test_type == TYPE_TEST_SUITE)
{
$xml_parser = new tandem_XmlReader(XML_SUITE_DIR . $tests_to_run[$i] . ".xml");
@@ -226,7 +226,7 @@ function pts_recurse_call_tests($tests_to_run, $arguments_array, $save_results =
pts_recurse_call_tests($tests_in_suite, $sub_arguments, $save_results, $tandem_xml, $results_identifier, $sub_arguments_description);
}
- else if($test_type == "TEST")
+ else if($test_type == TYPE_TEST)
{
$test_result = pts_run_test($tests_to_run[$i], $arguments_array[$i], $arguments_description[$i]);
$GLOBALS["TEST_IDENTIFIER"] = null;
diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php
index 4a347e4..88ebb08 100644
--- a/pts-core/functions/pts-functions.php
+++ b/pts-core/functions/pts-functions.php
@@ -73,9 +73,9 @@ function pts_test_type($identifier)
if(!empty($identifier))
{
if(is_file(XML_PROFILE_DIR . $identifier . ".xml"))
- $test_type = "TEST";
+ $test_type = TYPE_TEST;
else if(is_file(XML_SUITE_DIR . $identifier . ".xml"))
- $test_type = "TEST_SUITE";
+ $test_type = TYPE_TEST_SUITE;
}
return $test_type;
diff --git a/pts-core/functions/pts-interfaces.php b/pts-core/functions/pts-interfaces.php
index 660fcc7..babc348 100644
--- a/pts-core/functions/pts-interfaces.php
+++ b/pts-core/functions/pts-interfaces.php
@@ -211,4 +211,11 @@ define("P_GRAPH_MARKCOUNT", "PhoronixTestSuite/Graphs/Other/NumberOfMarks"); //
define("P_GRAPH_WATERMARK", "PhoronixTestSuite/Graphs/Other/Watermark"); // Graph watermark
define("P_GRAPH_BORDER", "PhoronixTestSuite/Graphs/Other/Border"); // Graph border bool
+//
+// Define Types
+//
+
+define("TYPE_TEST", "TEST"); // Type is test
+define("TYPE_TEST_SUITE", "TEST_SUITE"); // Type is a test suite
+
?>
diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php
index 3998b5c..4206b20 100644
--- a/pts-core/pts-run-cmd.php
+++ b/pts-core/pts-run-cmd.php
@@ -268,7 +268,7 @@ switch($COMMAND)
break;
case "INFO":
$pts_test_type = pts_test_type($ARG_1);
- if($pts_test_type == "TEST_SUITE")
+ if($pts_test_type == TYPE_TEST_SUITE)
{
$xml_parser = new tandem_XmlReader(XML_SUITE_DIR . $ARG_1 . ".xml");
$suite_name = $xml_parser->getXMLValue(P_SUITE_TITLE);
@@ -297,7 +297,7 @@ switch($COMMAND)
echo "\n";
}
- else if($pts_test_type == "TEST")
+ else if($pts_test_type == TYPE_TEST)
{
$xml_parser = new tandem_XmlReader(XML_PROFILE_DIR . $ARG_1 . ".xml");
diff --git a/pts-core/pts-run-test.php b/pts-core/pts-run-test.php
index e9ea959..65d0278 100644
--- a/pts-core/pts-run-test.php
+++ b/pts-core/pts-run-test.php
@@ -83,7 +83,7 @@ else
{
$save_option = true;
- if($TO_RUN_TYPE == "TEST")
+ if($TO_RUN_TYPE == TYPE_TEST)
{
$xml_parser = new tandem_XmlReader(XML_PROFILE_DIR . $TO_RUN . ".xml");
$result_format = $xml_parser->getXMLValue(P_TEST_RESULTFORMAT);
@@ -161,7 +161,7 @@ if($SAVE_RESULTS)
$RESULTS_IDENTIFIER = pts_prompt_results_identifier($result_identifiers);
}
-if($TO_RUN_TYPE == "TEST")
+if($TO_RUN_TYPE == TYPE_TEST)
{
$xml_parser = new tandem_XmlReader(XML_PROFILE_DIR . $TO_RUN . ".xml");
$test_title = $xml_parser->getXMLValue(P_TEST_TITLE);
@@ -318,7 +318,7 @@ if($TO_RUN_TYPE == "TEST")
unset($xml_parser);
}
}
-else if($TO_RUN_TYPE == "TEST_SUITE")
+else if($TO_RUN_TYPE == TYPE_TEST_SUITE)
{
echo pts_string_header("Test Suite: " . $TO_RUN);