public static function run($r) { $installed_tests = pts_tests::installed_tests(); pts_client::$display->generic_heading(count($installed_tests) . ' Tests Installed'); if (count($installed_tests) > 0) { foreach ($installed_tests as $identifier) { $test_profile = new pts_test_profile($identifier); $name = $test_profile->get_title(); if ($name != false) { echo sprintf('%-26ls - %-30ls' . PHP_EOL, $identifier, $name); } } } }
public static function run($r) { $installed_tests = pts_tests::installed_tests(); pts_client::$display->generic_heading(count($installed_tests) . ' Tests Installed'); if (count($installed_tests) > 0) { echo sprintf('%-18ls %-8ls %-13ls %-11ls %-13ls %-10ls', 'TEST', 'VERSION', 'INSTALL DATE', 'LAST RUN', 'AVG RUN-TIME', 'TIMES RUN') . PHP_EOL; foreach ($installed_tests as $identifier) { $test_profile = new pts_test_profile($identifier); if ($test_profile && $test_profile->test_installation && $test_profile->test_installation->get_installed_version() != null) { $avg_time = $test_profile->test_installation->get_average_run_time(); $avg_time = !empty($avg_time) ? pts_strings::format_time($avg_time, 'SECONDS', false) : 'N/A'; $last_run = $test_profile->test_installation->get_last_run_date(); $last_run = $last_run == '0000-00-00' ? 'NEVER' : $last_run; echo sprintf('%-18ls - %-8ls %-13ls %-11ls %-13ls %-10ls', $identifier, $test_profile->test_installation->get_installed_version(), $test_profile->test_installation->get_install_date(), $last_run, $avg_time, $test_profile->test_installation->get_run_count()) . PHP_EOL; } } } }
public static function run($r) { pts_client::$display->generic_heading('Random Test Execution'); $allow_new_tests_to_be_installed = pts_user_io::prompt_bool_input('Allow new tests to be installed', true); $allow_new_dependencies_to_be_installed = $allow_new_tests_to_be_installed ? pts_user_io::prompt_bool_input('Allow new test external dependencies to be installed', false) : false; $limit_test_subsystem = pts_user_io::prompt_bool_input('Limit tests to a given subsystem', false); $limit_test_subsystem = $limit_test_subsystem ? pts_user_io::prompt_text_menu('Select subsystem(s) to test', pts_types::subsystem_targets(), true) : false; $upload_to_openbenchmarking = pts_user_io::prompt_bool_input('Auto-upload test results to OpenBenchmarking.org', true); while (1) { $to_test = array(); if ($limit_test_subsystem) { foreach (explode(',', $limit_test_subsystem) as $test_type) { $tests = pts_openbenchmarking_client::popular_tests(-1, $test_type); $to_test = array_merge($to_test, $tests); } if (empty($to_test)) { pts_client::$display->generic_sub_heading('No tests could be found to run.'); return false; } shuffle($to_test); $to_test = array_slice($to_test, 0, rand(1, 12)); } else { if (rand(1, 6) == 2) { $ob_ids = pts_openbenchmarking_client::popular_openbenchmarking_results(); $ob_type = rand(0, 1) == 1 ? 'recent_popular_results' : 'recent_results'; if (isset($ob_ids[$ob_type]) && !empty($ob_ids[$ob_type])) { shuffle($ob_ids[$ob_type]); $to_test = array(array_pop($ob_ids[$ob_type])); } } } if (empty($to_test)) { // Randomly pick some installed tests $installed_tests = pts_tests::installed_tests(); if ($installed_tests > 3) { shuffle($installed_tests); $to_test = array_slice($installed_tests, 0, rand(1, 8)); } if (!isset($to_test[2]) && $allow_new_tests_to_be_installed) { $available_tests = pts_openbenchmarking::available_tests(); shuffle($available_tests); $to_test = array_merge($to_test, array_slice($available_tests, 0, rand(1, 10))); } } if (empty($to_test)) { pts_client::$display->generic_sub_heading('No tests could be found to run.'); return false; } echo PHP_EOL; pts_client::$display->generic_sub_heading('Tests To Run: ' . implode(', ', $to_test)); // QUERY FROM OB $random_titles = array(phodevi::read_property('cpu', 'model') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Performance', phodevi::read_property('cpu', 'model') . ' Performance', phodevi::read_property('cpu', 'model') . ' + ' . phodevi::read_property('gpu', 'model') . ' + ' . phodevi::read_property('motherboard', 'identifier'), phodevi::read_property('motherboard', 'identifier') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('cpu', 'model') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('system', 'kernel') . ' + ' . phodevi::read_property('system', 'operating-system') . ' Tests'); shuffle($random_titles); $title = array_pop($random_titles); if ($limit_test_subsystem) { $subsystems_to_test = explode(',', $limit_test_subsystem); $subsystems_to_avoid = array_diff(pts_types::subsystem_targets(), $subsystems_to_test); pts_client::pts_set_environment_variable('SKIP_TESTING_SUBSYSTEMS', implode(',', $subsystems_to_avoid)); } if ($allow_new_tests_to_be_installed) { pts_test_installer::standard_install($to_test, false, true, $allow_new_dependencies_to_be_installed); } $batch_mode_settings = array('UploadResults' => false, 'SaveResults' => true, 'PromptForTestDescription' => false, 'RunAllTestCombinations' => false, 'PromptSaveName' => false, 'PromptForTestIdentifier' => false, 'OpenBrowser' => false); if ($upload_to_openbenchmarking) { $batch_mode_settings['UploadResults'] = true; pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', true); } pts_test_run_manager::set_batch_mode($batch_mode_settings); $test_run_manager = new pts_test_run_manager($batch_mode_settings, 2); if ($test_run_manager->initial_checks($to_test) != false) { if ($test_run_manager->load_tests_to_run($to_test)) { // SETUP $test_run_manager->auto_save_results($title, null, 'Various open-source benchmarks by the ' . pts_core::program_title(true) . '.', true); $test_run_manager->auto_generate_results_identifier(); echo PHP_EOL; pts_client::$display->generic_sub_heading('Result File: ' . $test_run_manager->get_file_name()); pts_client::$display->generic_sub_heading('Result Identifier: ' . $test_run_manager->get_results_identifier()); // BENCHMARK $test_run_manager->pre_execution_process(); $test_run_manager->call_test_runs(); $test_run_manager->post_execution_process(); pts_client::remove_saved_result_file($test_run_manager->get_file_name()); } } echo PHP_EOL; sleep(30); } }
public static function render_page_process($PATH) { $local_only = false; switch (isset($PATH[0]) ? $PATH[0] : null) { case 'locally_available_tests': $local_only = true; $selected = 'Locally Available Tests'; $tests = pts_openbenchmarking::available_tests(); break; case 'available_tests': $selected = 'Available Tests'; $tests = pts_openbenchmarking::available_tests(); break; case 'installed_tests': default: $tests = pts_tests::installed_tests(); $selected = 'Installed Tests'; break; } echo '<h2>'; $sub_links = array('Available Tests' => 'tests/available_tests', 'Locally Available Tests' => 'tests/locally_available_tests', 'Installed Tests' => 'tests/installed_tests'); foreach ($sub_links as $txt => $loc) { echo '<a href="/?' . $loc . '">' . ($selected == $txt ? '<span class="alt">' : null) . $txt . ($selected == $txt ? '<span class="alt">' : null) . '</a> '; } echo '</h2>'; $installed_dependencies = pts_external_dependencies::installed_dependency_names(); $tests_to_show = array(); foreach ($tests as $identifier) { $test_profile = new pts_test_profile($identifier); if (!$test_profile->is_supported(false) || $test_profile->get_title() == null) { // Don't show unsupported tests continue; } if ($local_only && count($test_dependencies = $test_profile->get_dependencies()) > 0) { $dependencies_met = true; foreach ($test_dependencies as $d) { if (!in_array($d, $installed_dependencies)) { $dependencies_met = false; break; } } if ($dependencies_met == false) { continue; } } if ($local_only && pts_test_install_request::test_files_available_locally($test_profile) == false) { continue; } array_push($tests_to_show, $test_profile); } echo '<div style="overflow: hidden;">'; $tests_to_show = array_unique($tests_to_show); usort($tests_to_show, array('pts_webui_tests', 'cmp_result_object_sort')); $category = null; foreach ($tests_to_show as &$test_profile) { if ($category != $test_profile->get_test_hardware_type()) { $category = $test_profile->get_test_hardware_type(); echo '</div><a name="' . $category . '"></a>' . PHP_EOL . '<h2>' . $category . '</h2>' . PHP_EOL . '<div style="overflow: hidden;">'; $popularity_index = pts_openbenchmarking_client::popular_tests(-1, pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'test_type')); } $last_updated = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'last_updated'); $popularity = array_search($test_profile->get_identifier(false), $popularity_index); $secondary_message = null; if ($last_updated > time() - 60 * 60 * 24 * 21) { // Mark it as newly updated if uploaded in past 3 weeks $secondary_message = '<strong>Newly Updated.</strong>'; } else { if ($popularity === 0) { $secondary_message = '<strong>Most Popular.</strong>'; } else { if ($popularity < 4) { $secondary_message = '<strong>Very Popular.</strong>'; } } } echo '<a href="?test/' . $test_profile->get_identifier() . '"><div class="pts_blue_bar"><strong>' . trim($test_profile->get_title() . ' ' . $test_profile->get_app_version()) . '</strong><br /><span style="">~' . max(1, round($test_profile->get_estimated_run_time() / 60)) . ' mins To Run. ' . $secondary_message . '</span></div></a>'; } echo '</div>'; }
public function is_supported_value($input) { $supported = false; if (is_array($this->option_supported_values)) { if (in_array($input, $this->option_supported_values)) { $supported = true; } } else { if (empty($input) && $this->option_default_value != null) { $supported = true; } else { switch ($this->option_supported_values) { case 'NUMERIC': if (is_numeric($input)) { $supported = true; } break; case 'NUMERIC_DASH': if (!empty($input) && pts_strings::string_only_contains($input, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DASH)) { $supported = true; } break; case 'ALPHA_NUMERIC': if (!empty($input) && pts_strings::string_only_contains($input, pts_strings::CHAR_NUMERIC | pts_strings::CHAR_LETTER)) { $supported = true; } break; case 'HTTP_URL': if (substr($input, 0, 7) == 'http://') { $supported = true; } break; case 'LOCAL_DIRECTORY': if (is_dir($input)) { $supported = true; } break; case 'LOCAL_FILE': if (is_file($input)) { $supported = true; } break; case 'LOCAL_EXECUTABLE': if (is_executable($input)) { $supported = true; } break; case 'PTS_TEST_RESULT': if (pts_result_file::is_test_result_file($input)) { $supported = true; } case 'INSTALLED_TEST': if (in_array($input, pts_tests::installed_tests())) { $supported = true; } case 'VALID_SAVE_NAME': if (!empty($input) && pts_types::identifier_to_object($input) == false) { $supported = true; } case 'NOT_EMPTY': if (!empty($input)) { $supported = true; } case '': $supported = true; break; } } } if ($supported && !empty($this->option_function_check)) { $supported = call_user_func($this->option_function_check, $input) == true; } return $supported; }