コード例 #1
0
 public static function run($r)
 {
     if (pts_result_file::is_test_result_file($r[0])) {
         $result_file = new pts_result_file($r[0]);
         pts_client::$display->generic_heading($r[0]);
         $valid = $result_file->validate();
         if ($valid == false) {
             echo PHP_EOL . 'Errors occurred parsing the main XML.' . PHP_EOL;
             pts_validation::process_libxml_errors();
             return false;
         } else {
             echo PHP_EOL . 'The result file is Valid.' . PHP_EOL;
         }
     }
 }
コード例 #2
0
 public static function run($args)
 {
     $result = $args[0];
     $result_file = new pts_result_file($result);
     $result_file_identifiers = $result_file->get_system_identifiers();
     if (count($result_file_identifiers) < 2) {
         echo PHP_EOL . 'There are not multiple test runs in this result file.' . PHP_EOL;
         return false;
     }
     $extract_identifiers = pts_strings::comma_explode(pts_user_io::prompt_text_menu('Select the test run(s) to extract', $result_file_identifiers, true));
     $extract_selects = array();
     foreach ($extract_identifiers as $extract_identifier) {
         array_push($extract_selects, new pts_result_merge_select($result, $extract_identifier));
     }
     do {
         echo PHP_EOL . 'Enter new result file to extract to: ';
         $extract_to = pts_user_io::read_user_input();
         $extract_to = pts_test_run_manager::clean_save_name($extract_to);
     } while (empty($extract_to) || pts_result_file::is_test_result_file($extract_to));
     $extract_result = call_user_func_array(array('pts_merge', 'merge_test_results'), $extract_selects);
     pts_client::save_test_result($extract_to . '/composite.xml', $extract_result);
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $extract_to . '/index.html');
 }
コード例 #3
0
 public static function upload_unscheduled_results($to_upload)
 {
     if (!phoromatic::phoromatic_setup_module()) {
         return false;
     }
     if (!isset($to_upload[0]) || pts_result_file::is_test_result_file($to_upload[0]) == false) {
         echo PHP_EOL . 'No test result file was found to upload.' . PHP_EOL;
         return false;
     }
     phoromatic::upload_unscheduled_test_results($to_upload[0]);
 }
コード例 #4
0
 protected function auto_generate_description()
 {
     $hw_components = array(pts_result_file_analyzer::system_component_string_to_array(phodevi::system_hardware(true)));
     $sw_components = array(pts_result_file_analyzer::system_component_string_to_array(phodevi::system_software(true)));
     if (pts_result_file::is_test_result_file($this->file_name)) {
         $result_file = new pts_result_file($this->file_name);
         $existing_identifier_count = count($result_file->get_system_identifiers());
         foreach ($result_file->get_system_hardware() as $component_string) {
             array_push($hw_components, pts_result_file_analyzer::system_component_string_to_array($component_string));
         }
         foreach ($result_file->get_system_software() as $component_string) {
             array_push($sw_components, pts_result_file_analyzer::system_component_string_to_array($component_string));
         }
     } else {
         $existing_identifier_count = 0;
     }
     $auto_description = 'Running ' . implode(', ', array_unique($this->get_tests_to_run_identifiers()));
     $subsystems_to_test = $this->subsystems_under_test();
     // TODO: hook into $hw_components and $sw_components for leveraging existing result file data for comparisons already in existent
     // dropped: count($subsystems_to_test) == 1 && $
     if ($existing_identifier_count == 0) {
         switch ($subsystems_to_test) {
             case 'Graphics':
                 $auto_description = phodevi::read_property('gpu', 'model') . ' graphics testing with ' . phodevi::read_property('system', 'display-driver-string') . ' / ' . phodevi::read_property('system', 'opengl-driver');
                 break;
             case 'Disk':
                 $auto_description = phodevi::read_name('disk') . ' testing on ' . phodevi::read_property('system', 'operating-system') . ' with a ' . phodevi::read_property('system', 'filesystem') . ' file-system';
                 break;
             case 'Memory':
             case 'Processor':
                 $auto_description = phodevi::read_property('cpu', 'model') . ' testing with a ' . phodevi::read_name('motherboard') . ' on ' . phodevi::read_property('system', 'operating-system');
                 break;
             default:
                 if (phodevi::read_property('system', 'system-layer')) {
                     // Virtualization, Wine testing...
                     $auto_description = phodevi::read_property('system', 'system-layer') . ' testing on ' . phodevi::read_property('system', 'operating-system');
                 } else {
                     if (phodevi::read_name('motherboard') != null && phodevi::read_property('gpu', 'model') != null) {
                         // Standard description
                         $auto_description = phodevi::read_property('cpu', 'model') . ' testing with a ' . phodevi::read_name('motherboard') . ' and ' . phodevi::read_property('gpu', 'model') . ' on ' . phodevi::read_property('system', 'operating-system');
                     } else {
                         // A virtualized environment or a BSD or other OS where not all hardware info is available...
                         $auto_description = phodevi::read_property('cpu', 'model') . ' testing on ' . phodevi::read_property('system', 'operating-system');
                     }
                 }
                 break;
         }
     } else {
         if (pts_result_file::is_test_result_file($this->file_name)) {
             $result_file = new pts_result_file($this->file_name);
             $result_file_intent = pts_result_file_analyzer::analyze_result_file_intent($result_file);
             if (is_array($result_file_intent) && $result_file_intent[0] != 'Unknown') {
                 $auto_description = 'A ' . $result_file_intent[0] . ' comparison';
             }
         }
     }
     $auto_description .= ' via the Phoronix Test Suite.';
     return $auto_description;
 }
コード例 #5
0
 public static function identifiers_to_objects($identifiers, &$archive_unknown_objects = false)
 {
     // Provide an array containing the location(s) of all test(s) for the supplied object name
     $objects = array();
     foreach (pts_arrays::to_array($identifiers) as $identifier_item) {
         if ($identifier_item instanceof pts_test_profile || $identifier_item instanceof pts_test_suite || $identifier_item instanceof pts_result_file) {
             array_push($objects, $identifier_item);
         } else {
             if (PTS_IS_CLIENT && $identifier_item instanceof pts_virtual_test_queue) {
                 // Object is a virtual suite
                 array_push($objects, $identifier_item);
             } else {
                 if ($tp_identifier = pts_test_profile::is_test_profile($identifier_item)) {
                     // Object is a test
                     array_push($objects, new pts_test_profile($tp_identifier));
                 } else {
                     if (pts_test_suite::is_suite($identifier_item)) {
                         // Object is a suite
                         array_push($objects, new pts_test_suite($identifier_item));
                     } else {
                         if (pts_result_file::is_test_result_file($identifier_item)) {
                             // Object is a saved results file
                             array_push($objects, new pts_result_file($identifier_item));
                         } else {
                             if (pts_openbenchmarking::is_openbenchmarking_result_id($identifier_item)) {
                                 // Object is an OpenBenchmarking.org result
                                 // Clone it locally so it's just handled like a pts_result_file
                                 $success = pts_openbenchmarking::clone_openbenchmarking_result($identifier_item);
                                 if ($success) {
                                     array_push($objects, new pts_result_file($identifier_item));
                                 }
                             } else {
                                 if (PTS_IS_CLIENT && pts_virtual_test_suite::is_virtual_suite($identifier_item)) {
                                     // Object is a virtual suite
                                     array_push($objects, new pts_virtual_test_suite($identifier_item));
                                 } else {
                                     if (pts_suite_nye_XmlReader::is_temporary_suite($identifier_item)) {
                                         // Object is a suite
                                         array_push($objects, new pts_test_suite($identifier_item));
                                     } else {
                                         if (is_array($archive_unknown_objects)) {
                                             // Unknown / nothing / broken
                                             array_push($archive_unknown_objects, $identifier_item);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $objects;
 }
コード例 #6
0
 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;
 }