How to use pts_test_profile_parser class

Best Phoronix-test-suite code snippet using pts_test_profile_parser

pts_test_profile.php

Source:pts_test_profile.php Github

copy

Full Screen

...14 GNU General Public License for more details.15 You should have received a copy of the GNU General Public License16 along with this program. If not, see <http://www.gnu.org/licenses/>.17*/18class pts_test_profile extends pts_test_profile_parser19{20 public $test_installation = false;21 public function __construct($identifier = null, $override_values = null, $normal_init = true)22 {23 parent::__construct($identifier, $normal_init);24 if($override_values != null && is_array($override_values))25 {26 $this->set_override_values($override_values);27 }28 if($normal_init && PTS_IS_CLIENT && is_file($this->get_install_dir() . 'pts-install.xml'))29 {30 $this->test_installation = new pts_installed_test($this);31 }32 }33 public function validate()34 {35 $dom = new DOMDocument();36 $dom->loadXML($this->get_xml());37 return $dom->schemaValidate(PTS_OPENBENCHMARKING_PATH . 'schemas/test-profile.xsd');38 }39 public static function is_test_profile($identifier)40 {41 $identifier = pts_openbenchmarking::evaluate_string_to_qualifier($identifier, true, 'test');42 return $identifier != false && is_file(PTS_TEST_PROFILE_PATH . $identifier . '/test-definition.xml') ? $identifier : false;43 }44 public function get_resource_dir()45 {46 return PTS_TEST_PROFILE_PATH . $this->identifier . '/';47 }48 public function get_override_values($as_string = false)49 {50 if($as_string)51 {52 $o = $this->overrides;53 foreach($o as $x => &$y)54 {55 $y = $x . '=' . $y;56 }57 return implode(';', $o);58 }59 else60 {61 return $this->overrides;62 }63 }64 public function set_override_values($override_values)65 {66 if(is_array($override_values))67 {68 foreach($override_values as $xml_tag => $value)69 {70 $this->xs($xml_tag, $value);71 }72 }73 }74 public function get_download_size($include_extensions = true, $divider = 1048576)75 {76 $estimated_size = 0;77 foreach(pts_test_install_request::read_download_object_list($this->identifier) as $download_object)78 {79 $estimated_size += $download_object->get_filesize();80 }81 if($include_extensions)82 {83 $extends = $this->get_test_extension();84 if(!empty($extends))85 {86 $test_profile = new pts_test_profile($extends);87 $estimated_size += $test_profile->get_download_size(true, 1);88 }89 }90 $estimated_size = $estimated_size > 0 && $divider > 1 ? round($estimated_size / $divider, 2) : 0;91 return $estimated_size;92 }93 public function get_environment_size($include_extensions = true)94 {95 $estimated_size = parent::get_environment_size();96 if($include_extensions)97 {98 $extends = $this->get_test_extension();99 if(!empty($extends))100 {101 $test_profile = new pts_test_profile($extends);102 $estimated_size += $test_profile->get_environment_size(true);103 }104 }105 return $estimated_size;106 }107 public function get_test_extensions_recursive()108 {109 // Process Extensions / Cascading Test Profiles110 $extensions = array();111 $extended_test = $this->get_test_extension();112 if(!empty($extended_test))113 {114 do115 {116 if(!in_array($extended_test, $extensions))117 {118 $extensions[] = $extended_test;119 }120 $extended_test = new pts_test_profile_parser($extended_test);121 $extended_test = $extended_test->get_test_extension();122 }123 while(!empty($extended_test));124 }125 return $extensions;126 }127 public function get_dependency_names()128 {129 $dependency_names = array();130 $exdep_generic_parser = new pts_exdep_generic_parser();131 foreach($this->get_external_dependencies() as $dependency)132 {133 if($exdep_generic_parser->is_package($dependency))134 {...

Full Screen

Full Screen

pts_test_profile_parser.php

Source:pts_test_profile_parser.php Github

copy

Full Screen

...14 GNU General Public License for more details.15 You should have received a copy of the GNU General Public License16 along with this program. If not, see <http://www.gnu.org/licenses/>.17*/18class pts_test_profile_parser19{20 protected $identifier;21 private $xml;22 private $raw_xml;23 protected $overrides;24 private $tp_extends;25 protected $block_test_extension_support = false;26 private $file_location = false;27 public function __construct($read = null, $normal_init = true)28 {29 $this->overrides = array();30 $this->tp_extends = null;31 if($normal_init == false)32 {33 $this->identifier = $read;34 return;35 }36 if(!isset($read[200]) && strpos($read, '<?xml version="1.0"?>') === false)37 {38 if(PTS_IS_CLIENT && (!defined('PTS_TEST_PROFILE_PATH') || !is_file(PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml')))39 {40 $read = pts_openbenchmarking::evaluate_string_to_qualifier($read, true, 'test');41 if($read == false && pts_openbenchmarking::openbenchmarking_has_refreshed() == false)42 {43 // Test profile might be brand new, so refresh repository and then check44 // pts_openbenchmarking::refresh_repository_lists(null, true);45 $read = pts_openbenchmarking::evaluate_string_to_qualifier($read, true, 'test');46 }47 }48 }49 if(!isset($read[64]))50 {51 // Passed is not an identifier since it's too long52 $this->identifier = $read;53 }54 if(!isset($read[512]) && !is_file($read))55 {56 if(defined('PTS_TEST_PROFILE_PATH') && is_file(PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml'))57 {58 $read = PTS_TEST_PROFILE_PATH . $read . '/test-definition.xml';59 }60 }61 else if(substr($read, -4) == '.zip' && is_file($read))62 {63 $zip = new ZipArchive();64 if($zip->open($read) === true)65 {66 $read = $zip->getFromName('test-definition.xml');67 $zip->close();68 }69 }70 //$xml_options = 0;71 //if(defined('LIBXML_COMPACT'))72 //{73 $xml_options = LIBXML_COMPACT | LIBXML_PARSEHUGE;74 //}75 if(is_file($read))76 {77 $this->file_location = $read;78 $this->xml = simplexml_load_file($read, 'SimpleXMLElement', $xml_options);79 }80 else81 {82 $this->raw_xml = $read;83 if(strpos($read, '<') !== false)84 {85 $this->xml = simplexml_load_string($read, 'SimpleXMLElement', $xml_options);86 }87 }88 }89 public function get_xml()90 {91 if($this->file_location)92 {93 return file_get_contents($this->file_location);94 }95 return $this->raw_xml;96 }97 public function get_file_location()98 {99 return $this->file_location;100 }101 public function __toString()102 {103 return $this->get_identifier();104 }105 public function block_test_extension_support()106 {107 $this->block_test_extension_support = true;108 }109 public function xs($xpath, &$value)110 {111 $this->overrides[$xpath] = $value;112 }113 public function xg($xpath, $default_on_null = null)114 {115 if(isset($this->overrides[$xpath]))116 {117 return $this->overrides[$xpath];118 }119 $r = $this->xml ? $this->xml->xpath($xpath) : null;120 if(empty($r))121 {122 $r = null;123 }124 else if(isset($r[0]))125 {126 if(!isset($r[1]))127 {128 // Single129 $r = $r[0]->__toString();130 }131 }132 if($r == null && $this->block_test_extension_support == false)133 {134 if($this->tp_extends === null)135 {136 $this->tp_extends = false;137 $tp_identifier = $this->get_test_extension();138 if($tp_identifier != null && PTS_IS_CLIENT)139 {140 $this->tp_extends = new pts_test_profile_parser($tp_identifier);141 }142 else143 {144 $this->block_test_extension_support = true;145 }146 }147 if($this->tp_extends)148 {149 $r = $this->tp_extends->xg($xpath);150 }151 }152 if($r == null)153 {154 $r = $default_on_null;...

Full Screen

Full Screen

pts_test_profile_parser

Using AI Code Generation

copy

Full Screen

1require_once('pts_test_profile_parser.php');2require_once('pts_test_profile.php');3require_once('pts_module_manager.php');4require_once('pts_module_interface.php');5require_once('pts_module_manager.php');6require_once('pts_module_interface.php');7require_once('pts_test_result_parser.php');8require_once('pts_test_result_parser.php');9require_once('pts_test_profile_parser.php');10require_once('pts_test_profile.php');11require_once('pts_module_manager.php');12require_once('pts_module_interface.php');13require_once('pts_module_manager.php');14require_once('pts_module_interface.php');15require_once('pts_test_result_parser.php');16require_once('pts_test_result_parser.php');17require_once('pts_test_profile_parser.php');18require_once('pts_test_profile.php');19require_once('pts_module_manager.php');20require_once('pts_module_interface.php');21require_once('pts_module_manager.php');22require_once('

Full Screen

Full Screen

pts_test_profile_parser

Using AI Code Generation

copy

Full Screen

1require_once('pts-test-profile-parser.php');2$pts = new pts_test_profile_parser();3$pts->set_test_profile_path('tests/pts/pts-test-profile-parser/2.xml');4echo $pts->get_title();5echo $pts->get_description();6echo $pts->get_maintainer();7echo $pts->get_license();8echo $pts->get_version();9echo $pts->get_release_date();10echo $pts->get_supported_platforms();11echo $pts->get_supported_operating_systems();12echo $pts->get_supported_architectures();13echo $pts->get_supported_devices();14echo $pts->get_supported_graphics_cards();15echo $pts->get_dependencies();16echo $pts->get_run_time_dependencies();17echo $pts->get_test_profiles();18echo $pts->get_test_suites();19echo $pts->get_test_arguments();20echo $pts->get_test_run_time_arguments();21echo $pts->get_test_results();22echo $pts->get_test_result_types();23echo $pts->get_test_result_units();24echo $pts->get_test_result_scales();25echo $pts->get_test_result_precision();26echo $pts->get_test_result_options();27echo $pts->get_test_result_option_descriptions();

Full Screen

Full Screen

pts_test_profile_parser

Using AI Code Generation

copy

Full Screen

1require_once 'pts_test_profile_parser.php';2$test_profile = new pts_test_profile_parser('test-profile.xml');3$test_profile->set_test_profile();4$test_profile->set_test_profile_version();5$test_profile->set_test_profile_description();6$test_profile->set_test_profile_license();7$test_profile->set_test_profile_maintainer();8$test_profile->set_test_profile_homepage();9$test_profile->set_test_profile_test_type();10$test_profile->set_test_profile_test_dependencies();11$test_profile->set_test_profile_result_protection();12$test_profile->set_test_profile_display_format();13$test_profile->set_test_profile_display_format_fields();14$test_profile->set_test_profile_display_format_field_units();15$test_profile->set_test_profile_display_format_field_titles();16$test_profile->set_test_profile_display_format_field_descriptions();17$test_profile->set_test_profile_display_format_field_graphs();18$test_profile->set_test_profile_display_format_field_graph_titles();19$test_profile->set_test_profile_display_format_field_graph_max();20$test_profile->set_test_profile_display_format_field_graph_min();21$test_profile->set_test_profile_display_format_field_graph_scale();22$test_profile->set_test_profile_display_format_field_graph_scale_type();23$test_profile->set_test_profile_display_format_field_graph_scale_decimals();24$test_profile->set_test_profile_display_format_field_graph_scale_graph();25$test_profile->set_test_profile_display_format_field_graph_scale_graph_max();26$test_profile->set_test_profile_display_format_field_graph_scale_graph_min();27$test_profile->set_test_profile_display_format_field_graph_scale_graph_decimals();28$test_profile->set_test_profile_display_format_field_graph_scale_graph_type();29$test_profile->set_test_profile_display_format_field_graph_scale_graph_scale();30$test_profile->set_test_profile_test_installation();31$test_profile->set_test_profile_test_installation_type();32$test_profile->set_test_profile_test_installation_source();33$test_profile->set_test_profile_test_installation_source_type();34$test_profile->set_test_profile_test_installation_source_url();35$test_profile->set_test_profile_test_installation_source_file();36$test_profile->set_test_profile_test_installation_source_md5();37$test_profile->set_test_profile_test_installation_source_sha1();38$test_profile->set_test_profile_test_installation_source_sha256();39$test_profile->set_test_profile_test_installation_source_sha512();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used methods in pts_test_profile_parser

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful