diff options
-rw-r--r-- | TYDAL-CHANGE-LOG | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-install.php | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-merge.php | 2 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 26 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_tests.php | 20 | ||||
-rw-r--r-- | pts-core/objects/pts_module.php | 2 | ||||
-rw-r--r-- | pts-core/pts-run-cmd.php | 4 | ||||
-rw-r--r-- | pts-core/pts-run-test.php | 10 |
8 files changed, 30 insertions, 38 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG index b1c5845..09f804d 100644 --- a/TYDAL-CHANGE-LOG +++ b/TYDAL-CHANGE-LOG @@ -1,4 +1,4 @@ Phoronix Test Suite (Git) -- pts-core: Add pts_set_assignment(), pts_read_assignment(), and pts_clear_assignments() to replace some of the define statements with new mechanism +- pts-core: Add pts_set_assignment(), pts_read_assignment(), pts_is_assignment(), pts_set_assignment_once(), and pts_clear_assignments() to replace some of the define statements with new mechanism diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php index 8c82d5c..ade6910 100644 --- a/pts-core/functions/pts-functions-install.php +++ b/pts-core/functions/pts-functions-install.php @@ -329,7 +329,7 @@ function pts_install_test($identifier) } else { - if(pts_test_needs_updated_install($identifier) || defined("PTS_FORCE_INSTALL")) + if(pts_test_needs_updated_install($identifier) || pts_is_assignment("PTS_FORCE_INSTALL")) { if(!defined("PTS_TOTAL_SIZE_MSG")) { diff --git a/pts-core/functions/pts-functions-merge.php b/pts-core/functions/pts-functions-merge.php index 09db138..570854a 100644 --- a/pts-core/functions/pts-functions-merge.php +++ b/pts-core/functions/pts-functions-merge.php @@ -99,7 +99,7 @@ function pts_merge_test_results($OLD_RESULTS, $NEW_RESULTS) } unset($OLD_RESULTS, $original_xml_reader, $original_results_raw); - if(!defined("GLOBAL_COMPARISON") && getenv("PTS_MERGE") != "custom") + if(!pts_is_assignment("GLOBAL_COMPARISON") && getenv("PTS_MERGE") != "custom") { if($original_suite_name != $new_suite_name && !pts_global_valid_id_string($original_suite_name) && !pts_global_valid_id_string($new_suite_name)) { diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 103ea41..4fafb7e 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -84,10 +84,7 @@ function pts_prompt_results_identifier($current_identifiers = null) $RESULTS_IDENTIFIER = pts_swap_user_variables($RESULTS_IDENTIFIER); } - if(!defined("TEST_RESULTS_IDENTIFIER")) - { - define("TEST_RESULTS_IDENTIFIER", $RESULTS_IDENTIFIER); - } + pts_set_assignment_once("TEST_RESULTS_IDENTIFIER", $RESULTS_IDENTIFIER); return $RESULTS_IDENTIFIER; } @@ -257,10 +254,7 @@ function pts_verify_test_installation($TO_RUN) } else { - if(!defined("TEST_INSTALL_PASS")) - { - define("TEST_INSTALL_PASS", true); - } + pts_set_assignment_once("TEST_INSTALL_PASS", true); } } @@ -285,7 +279,7 @@ function pts_verify_test_installation($TO_RUN) echo pts_string_header($message); } - if(!defined("TEST_INSTALL_PASS") || getenv("SILENT_INSTALL") == false) + if(!pts_is_assignment("TEST_INSTALL_PASS") || getenv("SILENT_INSTALL") == false) { pts_exit(); } @@ -294,10 +288,10 @@ function pts_verify_test_installation($TO_RUN) function pts_recurse_call_tests($tests_to_run, $arguments_array, $save_results = false, &$tandem_xml = "", $results_identifier = "", $arguments_description = "") { // Call the tests - if(!defined("PTS_RECURSE_CALL")) + if(!pts_is_assignment("PTS_RECURSE_CALL")) { pts_module_process("__pre_run_process", $tests_to_run); - define("PTS_RECURSE_CALL", 1); + pts_set_assignment("PTS_RECURSE_CALL", 1); } for($i = 0; $i < count($tests_to_run); $i++) @@ -435,11 +429,7 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri if(!empty($test_type)) { $test_name = "TEST_" . strtoupper($test_type); - - if(!defined($test_name)) - { - define($test_name, 1); - } + pts_set_assignment_once($test_name, 1); } if(empty($execute_binary)) @@ -543,9 +533,9 @@ function pts_run_test($test_identifier, $extra_arguments = "", $arguments_descri if(is_file($benchmark_log_file)) { - if(defined("TEST_RESULTS_IDENTIFIER") && (pts_string_bool(pts_read_user_config(P_OPTION_LOG_BENCHMARKFILES, "FALSE")) || (defined("IS_PCQS_MODE") && IS_PCQS_MODE) || getenv("SAVE_BENCHMARK_LOGS") != false)) + if(pts_is_assignment("TEST_RESULTS_IDENTIFIER") && (pts_string_bool(pts_read_user_config(P_OPTION_LOG_BENCHMARKFILES, "FALSE")) || pts_read_assignment("IS_PCQS_MODE") != false || getenv("SAVE_BENCHMARK_LOGS") != false)) { - $backup_log_dir = SAVE_RESULTS_DIR . SAVE_FILE_NAME . "/benchmark-logs/" . TEST_RESULTS_IDENTIFIER . "/"; + $backup_log_dir = SAVE_RESULTS_DIR . pts_read_assignment(SAVE_FILE_NAME) . "/benchmark-logs/" . pts_read_assignment("TEST_RESULTS_IDENTIFIER") . "/"; $backup_filename = basename($benchmark_log_file); @mkdir($backup_log_dir, 0777, true); @copy($benchmark_log_file, $backup_log_dir . $backup_filename); diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php index c2a8f30..48afbda 100644 --- a/pts-core/functions/pts-functions_tests.php +++ b/pts-core/functions/pts-functions_tests.php @@ -144,21 +144,23 @@ function pts_save_result($save_to = null, $save_results = null) } $bool = file_put_contents(SAVE_RESULTS_DIR . $save_to, $save_results); - if(defined("TEST_RESULTS_IDENTIFIER") && (pts_string_bool(pts_read_user_config(P_OPTION_LOG_VSYSDETAILS, "TRUE")) || (defined("IS_PCQS_MODE") && IS_PCQS_MODE) || getenv("SAVE_SYSTEM_DETAILS") != false)) + if(pts_is_assignment("TEST_RESULTS_IDENTIFIER") && (pts_string_bool(pts_read_user_config(P_OPTION_LOG_VSYSDETAILS, "TRUE")) || pts_read_assignment("IS_PCQS_MODE") != false || getenv("SAVE_SYSTEM_DETAILS") != false)) { + $test_results_identifier = pts_read_assignment("TEST_RESULTS_IDENTIFIER"); + // Save verbose system information here if(!is_dir($save_to_dir . "/system-details/")) { mkdir($save_to_dir . "/system-details/"); } - if(!is_dir($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER)) + if(!is_dir($save_to_dir . "/system-details/" . $test_results_identifier)) { - mkdir($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER); + mkdir($save_to_dir . "/system-details/" . $test_results_identifier); } if(is_file("/var/log/Xorg.0.log")) { - pts_copy("/var/log/Xorg.0.log", $save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER . "/Xorg.0.log"); + pts_copy("/var/log/Xorg.0.log", $save_to_dir . "/system-details/" . $test_results_identifier . "/Xorg.0.log"); } // lspci @@ -166,7 +168,7 @@ function pts_save_result($save_to = null, $save_results = null) if(strpos($file, "not found") == false) { - @file_put_contents($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER . "/lspci", $file); + @file_put_contents($save_to_dir . "/system-details/" . $test_results_identifier . "/lspci", $file); } // sensors @@ -174,7 +176,7 @@ function pts_save_result($save_to = null, $save_results = null) if(strpos($file, "not found") == false) { - @file_put_contents($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER . "/sensors", $file); + @file_put_contents($save_to_dir . "/system-details/" . $test_results_identifier . "/sensors", $file); } // dmesg @@ -182,7 +184,7 @@ function pts_save_result($save_to = null, $save_results = null) if(strpos($file, "not found") == false) { - @file_put_contents($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER . "/dmesg", $file); + @file_put_contents($save_to_dir . "/system-details/" . $test_results_identifier . "/dmesg", $file); } if(IS_MACOSX) @@ -192,7 +194,7 @@ function pts_save_result($save_to = null, $save_results = null) if(strpos($file, "not found") == false) { - @file_put_contents($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER . "/system_profiler", $file); + @file_put_contents($save_to_dir . "/system-details/" . $test_results_identifier . "/system_profiler", $file); } } @@ -200,7 +202,7 @@ function pts_save_result($save_to = null, $save_results = null) if(is_file("/proc/cpuinfo")) { $file = file_get_contents("/proc/cpuinfo"); - @file_put_contents($save_to_dir . "/system-details/" . TEST_RESULTS_IDENTIFIER . "/cpuinfo", $file); + @file_put_contents($save_to_dir . "/system-details/" . $test_results_identifier . "/cpuinfo", $file); } } file_put_contents($save_to_dir . "/index.html", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head><title>Phoronix Test Suite</title><meta http-equiv=\"REFRESH\" content=\"0;url=composite.xml\"></HEAD><BODY></BODY></HTML>"); diff --git a/pts-core/objects/pts_module.php b/pts-core/objects/pts_module.php index 4c9f20f..7806b01 100644 --- a/pts-core/objects/pts_module.php +++ b/pts-core/objects/pts_module.php @@ -180,7 +180,7 @@ class pts_module { $loop_continue = true; - while(!defined("PTS_TESTING_DONE") && !defined("PTS_END_TIME") && pts_process_active("phoronix-test-suite") && $loop_continue) + while(!pts_is_assignment("PTS_TESTING_DONE") && !defined("PTS_END_TIME") && pts_process_active("phoronix-test-suite") && $loop_continue) { eval(self::module_name() . "::" . $function . "();"); // TODO: This can be cleaned up once PHP 5.3.0+ is out there and adopted diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php index 815b602..f32995c 100644 --- a/pts-core/pts-run-cmd.php +++ b/pts-core/pts-run-cmd.php @@ -73,7 +73,7 @@ switch($COMMAND) if($COMMAND == "FORCE_INSTALL_TEST") { - define("PTS_FORCE_INSTALL", 1); + pts_set_assignment("PTS_FORCE_INSTALL", 1); } $ARG_1 = strtolower($ARG_1); @@ -122,7 +122,7 @@ switch($COMMAND) if($COMMAND == "FORCE_INSTALL_ALL") { - define("PTS_FORCE_INSTALL", 1); + pts_set_assignment("PTS_FORCE_INSTALL", 1); } pts_module_process("__pre_install_process"); diff --git a/pts-core/pts-run-test.php b/pts-core/pts-run-test.php index c7af1d4..c4371f6 100644 --- a/pts-core/pts-run-test.php +++ b/pts-core/pts-run-test.php @@ -124,7 +124,7 @@ if(!$TO_RUN_TYPE) else if(pts_is_global_id($TO_RUN)) { $TO_RUN_TYPE = "GLOBAL_COMPARISON"; - define("GLOBAL_COMPARISON", 1); + pts_set_assignment("GLOBAL_COMPARISON", 1); pts_save_result($TO_RUN . "/composite.xml", pts_global_download_xml($TO_RUN)); } else @@ -249,11 +249,11 @@ if($SAVE_RESULTS) } $RESULTS_IDENTIFIER = pts_prompt_results_identifier($result_identifiers); - define("SAVE_FILE_NAME", $PROPOSED_FILE_NAME); + pts_set_assignment("SAVE_FILE_NAME", $PROPOSED_FILE_NAME); } else { - define("SAVE_FILE_NAME", null); + pts_set_assignment("SAVE_FILE_NAME", null); } if(is_test($TO_RUN)) @@ -452,7 +452,7 @@ else if(is_suite($TO_RUN)) if($SUITE_RUN_MODE == "PCQS") { - define("IS_PCQS_MODE", true); + pts_set_assignment("IS_PCQS_MODE", true); } unset($xml_parser); @@ -520,7 +520,7 @@ if(is_suite($TO_RUN)) pts_user_message($SUITE_POST_RUN_MESSAGE); } -define("PTS_TESTING_DONE", 1); +pts_set_assignment("PTS_TESTING_DONE", 1); pts_module_process("__post_run_process", $TEST_RUN); if($SAVE_RESULTS) |