public static function run($r) { $result_file = false; if (count($r) != 0) { $result_file = $r[0]; } $suite_name = pts_user_io::prompt_user_input('Enter name of suite'); $suite_test_type = pts_user_io::prompt_text_menu('Select test type', pts_types::subsystem_targets()); $suite_maintainer = pts_user_io::prompt_user_input('Enter suite maintainer name'); $suite_description = pts_user_io::prompt_user_input('Enter suite description'); $suite_writer = new pts_test_suite_writer(); $suite_writer->add_suite_information($suite_name, '1.0.0', $suite_maintainer, $suite_test_type, $suite_description); // Read results file $result_file = new pts_result_file($result_file); foreach ($result_file->get_result_objects() as $result_object) { $suite_writer->add_to_suite_from_result_object($result_object); } // Finish it off $suite_identifier = pts_test_run_manager::clean_save_name($suite_name); mkdir(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier); $save_to = PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'; if ($suite_writer->save_xml($save_to) != false) { echo PHP_EOL . PHP_EOL . 'Saved To: ' . $save_to . PHP_EOL . 'To run this suite, type: phoronix-test-suite benchmark ' . $suite_identifier . PHP_EOL . PHP_EOL; } }
public static function run($r) { pts_client::$display->generic_heading('Test Suite Creation'); $suite_name = pts_user_io::prompt_user_input('Enter name of suite'); $suite_test_type = pts_user_io::prompt_text_menu('Select test type', pts_types::subsystem_targets()); $suite_maintainer = pts_user_io::prompt_user_input('Enter suite maintainer name'); $suite_description = pts_user_io::prompt_user_input('Enter suite description'); $possible_suites = pts_openbenchmarking::available_suites(); $possible_tests = pts_openbenchmarking::available_tests(); $suite_writer = new pts_test_suite_writer(); $suite_writer->add_suite_information($suite_name, '1.0.0', $suite_maintainer, $suite_test_type, $suite_description); foreach ($r as $test_object) { $test_object = pts_types::identifier_to_object($test_object); if ($test_object instanceof pts_test_profile) { list($args, $description) = pts_test_run_options::prompt_user_options($test_object); for ($i = 0; $i < count($args); $i++) { // Not binding the test profile version to this suite, otherwise change false to true $suite_writer->add_to_suite($test_object->get_identifier(false), $args[$i], $description[$i]); } } else { if ($test_object instanceof pts_test_suite) { $suite_writer->add_to_suite($test_object->get_identifier(), null, null); } } } $input_option = null; do { switch ($input_option) { case 'Add Test': $test_to_add = pts_user_io::prompt_text_menu('Enter test name', $possible_tests); $test_profile = new pts_test_profile($test_to_add); list($args, $description) = pts_test_run_options::prompt_user_options($test_profile); for ($i = 0; $i < count($args); $i++) { $suite_writer->add_to_suite($test_to_add, $args[$i], $description[$i]); } break; case 'Add Sub-Suite': $suite_to_add = pts_user_io::prompt_text_menu('Enter test suite', $possible_suites); $suite_writer->add_to_suite($suite_to_add, null, null); break; } echo PHP_EOL . 'Available Options:' . PHP_EOL; $input_option = pts_user_io::prompt_text_menu('Select next operation', array('Add Test', 'Add Sub-Suite', 'Save & Exit')); } while ($input_option != 'Save & Exit'); $suite_identifier = $suite_writer->clean_save_name_string($suite_name); $save_to = PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'; mkdir(dirname($save_to)); if ($suite_writer->save_xml($save_to) != false) { echo PHP_EOL . PHP_EOL . 'Saved To: ' . $save_to . PHP_EOL . 'To run this suite, type: phoronix-test-suite benchmark ' . $suite_identifier . PHP_EOL . PHP_EOL; } }
public static function run($r) { $result = $r[0]; if (is_dir(PTS_SAVE_RESULTS_PATH . $result)) { do { $new_result_name = pts_user_io::prompt_user_input('Enter a new result file name for ' . $result); $clean_result_name = pts_test_run_manager::clean_save_name($new_result_name, true); } while ($clean_result_name == null || is_dir(PTS_SAVE_RESULTS_PATH . $clean_result_name)); } if (rename(PTS_SAVE_RESULTS_PATH . $result, PTS_SAVE_RESULTS_PATH . $clean_result_name)) { echo PHP_EOL . 'Renamed ' . $result . ' to ' . $clean_result_name . '.' . PHP_EOL . PHP_EOL; } pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $clean_result_name . '/index.html'); }
public static function set_root_admin_password() { phoromatic_server::prepare_database(); $root_admin_pw = phoromatic_server::read_setting('root_admin_pw'); if ($root_admin_pw != null) { do { $check_root_pw = pts_user_io::prompt_user_input('Please enter the existing root-admin password'); } while (hash('sha256', 'PTS' . $check_root_pw) != $root_admin_pw); } echo PHP_EOL . 'The new root-admin password must be at least six characters long.' . PHP_EOL; do { $new_root_pw = pts_user_io::prompt_user_input('Please enter the new root-admin password'); } while (strlen($new_root_pw) < 6); $new_root_pw = hash('sha256', 'PTS' . $new_root_pw); $root_admin_pw = phoromatic_server::save_setting('root_admin_pw', $new_root_pw); }
public static function run($r) { pts_client::$display->generic_heading('Network Setup'); if (!pts_user_io::prompt_bool_input('Configure the Phoronix Test Suite to use a HTTP proxy', false)) { return false; } $proxy_address = pts_user_io::prompt_user_input('Enter IP address / server name of proxy'); $proxy_port = pts_user_io::prompt_user_input('Enter TCP port for proxy server'); echo PHP_EOL . 'Testing Proxy Server (' . $proxy_address . ':' . $proxy_port . ')' . PHP_EOL; if (pts_network::http_get_contents('http://www.phoronix-test-suite.com/PTS', $proxy_address, $proxy_port) == 'PTS') { echo PHP_EOL . 'Proxy Setup Completed; Storing Network Settings.' . PHP_EOL; pts_config::user_config_generate(array('PhoronixTestSuite/Options/Networking/ProxyAddress' => $proxy_address, 'PhoronixTestSuite/Options/Networking/ProxyPort' => $proxy_port)); } else { echo PHP_EOL . 'Proxy Setup Failed.' . PHP_EOL; } }
public static function run($r) { $result = $r[0]; $result_file = new pts_result_file($result); $result_file_identifiers = $result_file->get_system_identifiers(); $rename_identifier = pts_user_io::prompt_text_menu('Select the test run to rename', $result_file_identifiers); $rename_identifier_new = pts_user_io::prompt_user_input('Enter the new identifier'); foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) { if (is_dir(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier)) { rename(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier, PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier_new); } } $result_file->rename_run($rename_identifier, $rename_identifier_new); pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html'); }
public static function run($r) { $result_file = new pts_result_file($r[0]); $result_title = $result_file->get_title(); echo PHP_EOL . 'Current Result Title: ' . $result_title . PHP_EOL; $new_title = pts_user_io::prompt_user_input('Enter New Title'); if (!empty($new_title)) { $result_file->set_title($new_title); } $result_description = $result_file->get_description(); echo PHP_EOL . 'Current Result Description: ' . $result_description . PHP_EOL; $new_description = pts_user_io::prompt_user_input('Enter New Description'); if (!empty($new_description)) { $result_file->set_description($new_description); } pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html'); }
public static function run($r) { if (pts_openbenchmarking_client::user_name() == false) { echo PHP_EOL . 'You must first be logged into an OpenBenchmarking.org account.' . PHP_EOL; echo PHP_EOL . 'Create An Account: http://openbenchmarking.org/'; echo PHP_EOL . 'Log-In Command: phoronix-test-suite openbenchmarking-setup' . PHP_EOL . PHP_EOL; return false; } foreach (pts_types::identifiers_to_test_profile_objects($r, true, true) as $test_profile) { // validate_test_profile if (pts_validation::validate_test_profile($test_profile)) { pts_client::$display->generic_heading($test_profile); $zip_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $test_profile->get_identifier_base_name() . '-' . $test_profile->get_test_profile_version() . '.zip'; $zip_created = pts_compression::zip_archive_create($zip_file, pts_file_io::glob($test_profile->get_resource_dir() . '*')); if ($zip_created == false) { echo PHP_EOL . 'Failed to create zip file.' . PHP_EOL; return false; } if (filesize($zip_file) > 104857) { echo PHP_EOL . 'The test profile package is too big.' . PHP_EOL; return false; } $commit_description = pts_user_io::prompt_user_input('Enter a test commit description', false); echo PHP_EOL; $server_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_profile', array('tp_identifier' => $test_profile->get_identifier_base_name(), 'tp_sha1' => sha1_file($zip_file), 'tp_zip' => base64_encode(file_get_contents($zip_file)), 'tp_zip_name' => basename($zip_file), 'commit_description' => $commit_description)); echo PHP_EOL; $json = json_decode($server_response, true); if (isset($json['openbenchmarking']['upload']['error']) && !empty($json['openbenchmarking']['upload']['error'])) { echo 'ERROR: ' . $json['openbenchmarking']['upload']['error'] . PHP_EOL; } if (isset($json['openbenchmarking']['upload']['id']) && !empty($json['openbenchmarking']['upload']['id'])) { echo 'Command: phoronix-test-suite benchmark ' . $json['openbenchmarking']['upload']['id'] . PHP_EOL; } if (isset($json['openbenchmarking']['upload']['url']) && !empty($json['openbenchmarking']['upload']['url'])) { pts_openbenchmarking::refresh_repository_lists(null, true); echo 'URL: ' . $json['openbenchmarking']['upload']['url'] . PHP_EOL; } echo PHP_EOL; // TODO: chmod +x the .sh files, appropriate permissions elsewhere unlink($zip_file); } } }
public static function run($r) { if (pts_openbenchmarking_client::user_name() == false) { echo PHP_EOL . 'You must first be logged into an OpenBenchmarking.org account.' . PHP_EOL; echo PHP_EOL . 'Create An Account: http://openbenchmarking.org/'; echo PHP_EOL . 'Log-In Command: phoronix-test-suite openbenchmarking-setup' . PHP_EOL . PHP_EOL; return false; } if (($test_suite = pts_types::identifier_to_object($r[0])) != false) { pts_client::$display->generic_heading($r[0]); if (pts_validation::validate_test_suite($test_suite)) { $zip_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $test_suite->get_identifier(false) . '-' . $test_suite->get_version() . '.zip'; $zip_created = pts_compression::zip_archive_create($zip_file, $test_suite->xml_parser->getFileLocation()); if ($zip_created == false) { echo PHP_EOL . 'Failed to create zip file.' . PHP_EOL; return false; } $zip = new ZipArchive(); $zip->open($zip_file); $zip->renameName(basename($test_suite->xml_parser->getFileLocation()), 'suite-definition.xml'); $zip->close(); $commit_description = pts_user_io::prompt_user_input('Enter a test commit description', false); echo PHP_EOL; $server_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_suite', array('ts_identifier' => $test_suite->get_identifier_base_name(), 'ts_sha1' => sha1_file($zip_file), 'ts_zip' => base64_encode(file_get_contents($zip_file)), 'ts_zip_name' => basename($zip_file), 'commit_description' => $commit_description)); echo PHP_EOL; $json = json_decode($server_response, true); if (isset($json['openbenchmarking']['upload']['error']) && !empty($json['openbenchmarking']['upload']['error'])) { echo 'ERROR: ' . $json['openbenchmarking']['upload']['error'] . PHP_EOL; } if (isset($json['openbenchmarking']['upload']['id']) && !empty($json['openbenchmarking']['upload']['id'])) { echo 'Command: phoronix-test-suite benchmark ' . $json['openbenchmarking']['upload']['id'] . PHP_EOL; } if (isset($json['openbenchmarking']['upload']['url']) && !empty($json['openbenchmarking']['upload']['url'])) { pts_openbenchmarking::refresh_repository_lists(null, true); echo 'URL: ' . $json['openbenchmarking']['upload']['url'] . PHP_EOL; } echo PHP_EOL; unlink($zip_file); } } }
public static function run($r) { $result_file = new pts_result_file($r[0]); $result_title = $result_file->get_title(); echo PHP_EOL . 'Current Result Title: ' . $result_title . PHP_EOL; $new_title = pts_user_io::prompt_user_input('Enter New Title'); if (!empty($new_title)) { $result_title = $new_title; } $result_description = $result_file->get_description(); echo PHP_EOL . 'Current Result Description: ' . $result_description . PHP_EOL; $new_description = pts_user_io::prompt_user_input('Enter New Description'); if (!empty($new_description)) { $result_description = $new_description; } $result_file_writer = new pts_result_file_writer(); $result_file_writer->add_result_file_meta_data($result_file, null, $new_title, $new_description); $result_file_writer->add_system_information_from_result_file($result_file); $result_file_writer->add_results_from_result_file($result_file); pts_client::save_test_result($r[0] . '/composite.xml', $result_file_writer->get_xml()); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html'); }
public static function run($r) { $result = $r[0]; $result_file = new pts_result_file($result); $result_file_identifiers = $result_file->get_system_identifiers(); $rename_identifier = pts_user_io::prompt_text_menu('Select the test run to rename', $result_file_identifiers); $rename_identifier_new = pts_user_io::prompt_user_input('Enter the new identifier'); $merge_selects = array(); foreach ($result_file_identifiers as $identifier) { $this_merge_select = new pts_result_merge_select($result, $identifier); if ($identifier == $rename_identifier && $rename_identifier != $rename_identifier_new) { $this_merge_select->rename_identifier($rename_identifier_new); } array_push($merge_selects, $this_merge_select); } foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) { if (is_dir(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier)) { rename(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier, PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $rename_identifier_new); } } $extract_result = pts_merge::merge_test_results_array($merge_selects); pts_client::save_test_result($r[0] . '/composite.xml', $extract_result); pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html'); }
public static function run($r) { pts_openbenchmarking::refresh_repository_lists(); pts_client::$display->generic_heading('Interactive Benchmarking'); echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL; $reboot_on_exit = false; do { $options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition'); if (count(pts_client::saved_test_results()) > 0) { $options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage'; } $options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit'; $response = pts_user_io::prompt_text_menu('Select Task', $options, false, true); switch ($response) { case 'RUN_TEST': $supported_tests = pts_openbenchmarking::available_tests(); $supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true); $longest_title_length = 0; foreach ($supported_tests as $i => &$test_profile) { if ($test_profile->get_title() == null) { unset($supported_tests[$i]); continue; } $longest_title_length = max($longest_title_length, strlen($test_profile->get_title())); } $t = array(); foreach ($supported_tests as $i => &$test_profile) { if ($test_profile instanceof pts_test_profile) { $t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type()); } } $supported_tests = $t; asort($supported_tests); $tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true); $tests_to_run = explode(',', $tests_to_run); pts_test_installer::standard_install($tests_to_run); $run_manager = new pts_test_run_manager(false, 2); $run_manager->standard_run($tests_to_run); if ($run_manager != false) { pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true); } break; case 'RUN_SUITE': $possible_suites = pts_openbenchmarking::available_suites(); foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) { array_push($possible_suites, 'pts/' . $subsystem); } $suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true); foreach (explode(',', $suites_to_run) as $suite_to_run) { pts_test_installer::standard_install($suite_to_run); $run_manager = new pts_test_run_manager(false, 2); $run_manager->standard_run($suite_to_run); } break; case 'SELECT_DRIVE_MOUNT': self::select_drive_mount(); break; case 'RUN_SYSTEM_TEST': pts_client::$display->generic_heading('System Test'); $system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark'); pts_test_installer::standard_install($system_tests); $run_manager = new pts_test_run_manager(false, 2); $run_manager->standard_run($system_tests); if ($run_manager != false) { pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true); } break; case 'SHOW_INFO': pts_client::$display->generic_heading('System Software / Hardware Information'); echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL; echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL; break; case 'SHOW_SENSORS': pts_client::$display->generic_heading('Detected System Sensors'); foreach (phodevi::supported_sensors() as $sensor) { echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL; } break; case 'SET_RUN_COUNT': $run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false); putenv('FORCE_TIMES_TO_RUN=' . trim($run_count)); break; case 'BACKUP_RESULTS_TO_USB': pts_client::$display->generic_heading('Backing Up Test Results'); foreach (pts_file_io::glob('/media/*') as $media_dir) { if (!is_writable($media_dir)) { echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL; continue; } echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL; pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/'); break; } break; } echo PHP_EOL . PHP_EOL; } while ($response != 'EXIT'); if ($reboot_on_exit) { if (is_dir('/media/pts-auto-mount')) { pts_file_io::delete('/media/pts-auto-mount/pts', null, true); exec('umount /media/pts-auto-mount 2>&1'); } exec('reboot'); } }
public static function prompt_user_options(&$test_profile, $preset_selections = null) { $user_args = array(); $text_args = array(); if (($cli_presets_env = pts_client::read_env('PRESET_OPTIONS')) != false) { // To specify test options externally from an environment variable // i.e. PRESET_OPTIONS='stream.run-type=Add' ./phoronix-test-suite benchmark stream // The string format is <test-name>.<test-option-name-from-XML-file>=<test-option-value> // The test-name can either be the short/base name (e.g. stream) or the full identifier (pts/stream) without version postfix // Multiple preset options can be delimited with the PRESET_OPTIONS environment variable via a semicolon ; $preset_selections = pts_client::parse_value_string_double_identifier($cli_presets_env); } $identifier_short = $test_profile->get_identifier_base_name(); $identifier_full = $test_profile->get_identifier(false); if (count($test_profile->get_test_option_objects()) > 0) { pts_client::$display->test_run_configure($test_profile); } foreach ($test_profile->get_test_option_objects() as $i => $o) { $option_identifier = $o->get_identifier(); if ($o->option_count() == 0) { // User inputs their option as there is nothing to select if (isset($preset_selections[$identifier_short][$option_identifier])) { $value = $preset_selections[$identifier_short][$option_identifier]; echo PHP_EOL . ' Using Pre-Set Run Option: ' . $value . PHP_EOL; } else { if (isset($preset_selections[$identifier_full][$option_identifier])) { $value = $preset_selections[$identifier_full][$option_identifier]; echo PHP_EOL . ' Using Pre-Set Run Option: ' . $value . PHP_EOL; } else { echo PHP_EOL . $o->get_name() . PHP_EOL; $value = pts_user_io::prompt_user_input('Enter Value'); } } array_push($text_args, array($o->format_option_display_from_input($value))); array_push($user_args, array($o->format_option_value_from_input($value))); } else { // Have the user select the desired option if (isset($preset_selections[$identifier_short][$option_identifier])) { $bench_choice = $preset_selections[$identifier_short][$option_identifier]; echo PHP_EOL . ' Using Pre-Set Run Option: ' . $bench_choice . PHP_EOL; } else { if (isset($preset_selections[$identifier_full][$option_identifier])) { $bench_choice = $preset_selections[$identifier_full][$option_identifier]; echo PHP_EOL . ' Using Pre-Set Run Option: ' . $bench_choice . PHP_EOL; } else { $option_names = $o->get_all_option_names_with_messages(); if (count($option_names) > 1) { //echo PHP_EOL . $o->get_name() . ':' . PHP_EOL; array_push($option_names, 'Test All Options'); } $bench_choice = pts_user_io::prompt_text_menu($o->get_name(), $option_names, true, true, pts_client::$display->get_tab() . pts_client::$display->get_tab()); echo PHP_EOL; } } $bench_choice = $o->parse_selection_choice_input($bench_choice); // Format the selected option(s) $option_args = array(); $option_args_description = array(); foreach ($bench_choice as $c) { array_push($option_args, $o->format_option_value_from_select($c)); array_push($option_args_description, $o->format_option_display_from_select($c)); } array_push($text_args, $option_args_description); array_push($user_args, $option_args); } } $test_args = array(); $test_args_description = array(); self::compute_all_combinations($test_args, null, $user_args, 0); self::compute_all_combinations($test_args_description, null, $text_args, 0, ' - '); return array($test_args, $test_args_description); }
public static function run($r) { $is_moscow = pts_flags::os_identifier_hash() == 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc'; if ($is_moscow) { // Auto mount? $drives = pts_file_io::glob('/dev/sda*'); sort($drives); if (false && count($drives) > 0 && !is_dir('/media/pts-auto-mount') && is_writable('/media/')) { $last_drive = array_pop($drives); echo PHP_EOL . 'Attempting to auto-mount drive: ' . $last_drive . PHP_EOL; mkdir('/media/pts-auto-mount'); exec('mount ' . $last_drive . ' /media/pts-auto-mount'); putenv('PTS_TEST_INSTALL_ROOT_PATH=/media/pts-auto-mount/'); } // Auto save results $test_results_name = phodevi::read_property('motherboard', 'serial-number'); if ($test_results_name == null) { $test_results_name = phodevi::read_name('motherboard'); } if ($test_results_name == null) { $test_results_name = phodevi::read_property('system', 'vendor-identifier'); } putenv('TEST_RESULTS_NAME=' . str_replace(' ', null, $test_results_name)); putenv('TEST_RESULTS_IDENTIFIER=' . $test_results_name); putenv('TEST_RESULTS_DESCRIPTION=Tests using ' . phodevi::read_property('system', 'operating-system') . ' on ' . date('d F Y') . ' of ' . $test_results_name . '.'); self::select_drive_mount(); } pts_openbenchmarking::refresh_repository_lists(); pts_client::$display->generic_heading('Interactive Benchmarking'); echo 'System Hardware:' . PHP_EOL . phodevi::system_hardware(true) . (phodevi::read_property('motherboard', 'serial-number') != null ? PHP_EOL . 'System Serial Number: ' . phodevi::read_property('motherboard', 'serial-number') : null) . PHP_EOL . PHP_EOL . PHP_EOL; $reboot_on_exit = pts_flags::is_live_cd() && pts_client::user_home_directory() == '/root/'; do { $options = array('RUN_TEST' => 'Run A Test', 'RUN_SUITE' => 'Run A Suite [A Collection Of Tests]', 'RUN_SYSTEM_TEST' => 'Run Complex System Test', 'SHOW_INFO' => 'Show System Hardware / Software Information', 'SHOW_SENSORS' => 'Show Auto-Detected System Sensors', 'SET_RUN_COUNT' => 'Set Test Run Repetition'); if ($is_moscow) { unset($options['RUN_SUITE']); // $options['SELECT_DRIVE_MOUNT'] = 'Select Disk Drive To Use For Testing'; } if (count(pts_client::saved_test_results()) > 0) { $options['BACKUP_RESULTS_TO_USB'] = 'Backup Results To Media Storage'; } $options['EXIT'] = $reboot_on_exit ? 'Exit & Reboot' : 'Exit'; $response = pts_user_io::prompt_text_menu('Select Task', $options, false, true); switch ($response) { case 'RUN_TEST': $supported_tests = pts_openbenchmarking::available_tests(); $supported_tests = pts_types::identifiers_to_test_profile_objects($supported_tests, false, true); $longest_title_length = 0; foreach ($supported_tests as $i => &$test_profile) { if ($test_profile->get_title() == null || pts_test_run_manager::test_profile_system_compatibility_check($test_profile) == false) { unset($supported_tests[$i]); continue; } if ($is_moscow && pts_test_install_request::test_files_available_locally($test_profile) == false) { // Don't show tests where files need to be downloaded unset($supported_tests[$i]); continue; } $longest_title_length = max($longest_title_length, strlen($test_profile->get_title())); } $t = array(); foreach ($supported_tests as $i => &$test_profile) { if ($test_profile instanceof pts_test_profile) { $t[$test_profile->get_identifier()] = sprintf('%-' . ($longest_title_length + 1) . 'ls - %-10ls', $test_profile->get_title(), $test_profile->get_test_hardware_type()); } } $supported_tests = $t; asort($supported_tests); $tests_to_run = pts_user_io::prompt_text_menu('Select Test', $supported_tests, true, true); $tests_to_run = explode(',', $tests_to_run); pts_test_installer::standard_install($tests_to_run); $run_manager = pts_test_run_manager::standard_run($tests_to_run, pts_c::defaults_mode | pts_c::auto_mode); if ($run_manager != false) { pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true); } break; case 'RUN_SUITE': $possible_suites = pts_openbenchmarking::available_suites(); foreach (array_map('strtolower', pts_types::subsystem_targets()) as $subsystem) { array_push($possible_suites, 'pts/' . $subsystem); } $suites_to_run = pts_user_io::prompt_text_menu('Select Suite', $possible_suites, true); foreach (explode(',', $suites_to_run) as $suite_to_run) { pts_test_installer::standard_install($suite_to_run); pts_test_run_manager::standard_run($suite_to_run, pts_c::defaults_mode | pts_c::auto_mode); } break; case 'SELECT_DRIVE_MOUNT': self::select_drive_mount(); break; case 'RUN_SYSTEM_TEST': pts_client::$display->generic_heading('System Test'); $system_tests = array('apache', 'c-ray', 'ramspeed', 'postmark'); pts_test_installer::standard_install($system_tests); $run_manager = pts_test_run_manager::standard_run($system_tests, pts_c::defaults_mode | pts_c::auto_mode); if ($run_manager != false) { pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $run_manager->get_file_name() . '/index.html', null, true, true); } break; case 'SHOW_INFO': pts_client::$display->generic_heading('System Software / Hardware Information'); echo 'Hardware:' . PHP_EOL . phodevi::system_hardware(true) . PHP_EOL . PHP_EOL; echo 'Software:' . PHP_EOL . phodevi::system_software(true) . PHP_EOL . PHP_EOL; break; case 'SHOW_SENSORS': pts_client::$display->generic_heading('Detected System Sensors'); foreach (phodevi::supported_sensors() as $sensor) { echo phodevi::sensor_name($sensor) . ': ' . phodevi::read_sensor($sensor) . ' ' . phodevi::read_sensor_unit($sensor) . PHP_EOL; } break; case 'SET_RUN_COUNT': $run_count = pts_user_io::prompt_user_input('Set the minimum number of times each test should repeat', false); putenv('FORCE_TIMES_TO_RUN=' . trim($run_count)); break; case 'BACKUP_RESULTS_TO_USB': pts_client::$display->generic_heading('Backing Up Test Results'); if ($is_moscow) { $drives = pts_file_io::glob('/dev/sd*'); sort($drives); if (count($drives) > 0 && is_writable('/media/')) { $select_drive = pts_user_io::prompt_text_menu('Select Drive / Partition To Save Results', $drives); echo PHP_EOL . 'Attempting to mount: ' . $select_drive . PHP_EOL; mkdir('/media/00-results-backup'); exec('mount ' . $select_drive . ' /media/00-results-backup'); } } foreach (pts_file_io::glob('/media/*') as $media_dir) { if (!is_writable($media_dir)) { echo PHP_EOL . $media_dir . ' is not writable.' . PHP_EOL; continue; } echo PHP_EOL . 'Writing Test Results To: ' . $media_dir . PHP_EOL; pts_file_io::copy(PTS_SAVE_RESULTS_PATH, $media_dir . '/'); break; } if ($is_moscow && is_dir('/media/00-results-backup')) { exec('umount /media/00-results-backup'); rmdir('/media/00-results-backup'); } break; } echo PHP_EOL . PHP_EOL; } while ($response != 'EXIT'); if ($reboot_on_exit) { if (is_dir('/media/pts-auto-mount')) { pts_file_io::delete('/media/pts-auto-mount/pts', null, true); exec('umount /media/pts-auto-mount 2>&1'); } exec('reboot'); } }