コード例 #1
0
 protected function test_prompts_to_result_objects(&$test_profile)
 {
     $result_objects = array();
     if ($this->batch_mode && $this->batch_mode['RunAllTestCombinations']) {
         list($test_arguments, $test_arguments_description) = pts_test_run_options::batch_user_options($test_profile);
     } else {
         if ($this->auto_mode == 2) {
             list($test_arguments, $test_arguments_description) = pts_test_run_options::default_user_options($test_profile);
         } else {
             list($test_arguments, $test_arguments_description) = pts_test_run_options::prompt_user_options($test_profile);
         }
     }
     foreach (array_keys($test_arguments) as $i) {
         $test_result = new pts_test_result($test_profile);
         $test_result->set_used_arguments($test_arguments[$i]);
         $test_result->set_used_arguments_description($test_arguments_description[$i]);
         array_push($result_objects, $test_result);
     }
     return $result_objects;
 }
コード例 #2
0
 public function get_contained_test_result_objects()
 {
     $test_result_objects = array();
     $test_names = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/Execute/Test');
     $sub_modes = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/Execute/Mode');
     $sub_arguments = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/Execute/Arguments');
     $sub_arguments_description = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/Execute/Description');
     $override_test_options = $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/Execute/OverrideTestOptions');
     for ($i = 0; $i < count($test_names); $i++) {
         $obj = pts_types::identifier_to_object($test_names[$i]);
         if ($obj instanceof pts_test_profile) {
             // Check for test profile values to override
             $override_options = array();
             if (!empty($override_test_options[$i])) {
                 foreach (explode(';', $override_test_options[$i]) as $override_string) {
                     $override_segments = pts_strings::trim_explode('=', $override_string);
                     if (count($override_segments) == 2 && !empty($override_segments[0]) && !empty($override_segments[1])) {
                         $override_options[$override_segments[0]] = $override_segments[1];
                     }
                 }
             }
             switch ($sub_modes[$i]) {
                 case 'BATCH':
                     $option_output = pts_test_run_options::batch_user_options($obj);
                     break;
                 case 'DEFAULTS':
                     $option_output = pts_test_run_options::default_user_options($obj);
                     break;
                 default:
                     $option_output = array(array($sub_arguments[$i]), array($sub_arguments_description[$i]));
                     break;
             }
             foreach (array_keys($option_output[0]) as $x) {
                 if ($override_options != null) {
                     $test_profile->set_override_values($override_options);
                 }
                 $test_result = new pts_test_result($obj);
                 $test_result->set_used_arguments($option_output[0][$x]);
                 $test_result->set_used_arguments_description($option_output[1][$x]);
                 array_push($test_result_objects, $test_result);
             }
         } else {
             if ($obj instanceof pts_test_suite) {
                 foreach ($obj->get_contained_test_result_objects() as $test_result) {
                     array_push($test_result_objects, $test_result);
                 }
             }
         }
     }
     return $test_result_objects;
 }