How to use get_test_extensions_recursive method of pts_test_profile class

Best Phoronix-test-suite code snippet using pts_test_profile.get_test_extensions_recursive

pts_test_profile.php

Source:pts_test_profile.php Github

copy

Full Screen

...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 {135 $package_data = $exdep_generic_parser->get_package_data($dependency);136 $dependency_names[] = $package_data['title'];137 }138 }139 return $dependency_names;140 }141 public function get_times_to_run()142 {143 $times_to_run = parent::get_times_to_run();144 if(($force_runs = pts_client::read_env('FORCE_TIMES_TO_RUN')) && is_numeric($force_runs))145 {146 $times_to_run = $force_runs;147 }148 if(($force_runs = pts_client::read_env('FORCE_MIN_TIMES_TO_RUN')) && is_numeric($force_runs) && $force_runs > $times_to_run)149 {150 $times_to_run = $force_runs;151 }152 $display_format = $this->get_display_format();153 if($times_to_run < 1 || (strlen($display_format) > 6 && substr($display_format, 0, 6) == 'MULTI_' || substr($display_format, 0, 6) == 'IMAGE_'))154 {155 // Currently tests that output multiple results in one run can only be run once156 $times_to_run = 1;157 }158 return $times_to_run;159 }160 public function get_estimated_run_time()161 {162 // get estimated run-time (in seconds)163 if($this->test_installation != false && is_numeric($this->test_installation->get_average_run_time()) && $this->test_installation->get_average_run_time() > 0)164 {165 $estimated_run_time = $this->test_installation->get_average_run_time();166 }167 else168 {169 $estimated_run_time = parent::get_estimated_run_time();170 }171 if($estimated_run_time < 2 && PTS_IS_CLIENT)172 {173 $identifier = explode('/', $this->get_identifier(false));174 $repo_index = pts_openbenchmarking::read_repository_index($identifier[0]);175 $estimated_run_time = isset($identifier[1]) && isset($repo_index['tests'][$identifier[1]]) && isset($repo_index['tests'][$identifier[1]]['average_run_time']) ? $repo_index['tests'][$identifier[1]]['average_run_time'] : 0;176 }177 return $estimated_run_time;178 }179 public function is_supported($report_warnings = true)180 {181 $test_supported = true;182 if(PTS_IS_CLIENT && pts_client::read_env('SKIP_TEST_SUPPORT_CHECKS'))183 {184 // set SKIP_TEST_SUPPORT_CHECKS=1 environment variable for debugging purposes to run tests on unsupported platforms185 return true;186 }187 else if($this->is_test_architecture_supported() == false)188 {189 PTS_IS_CLIENT && $report_warnings && pts_client::$display->test_run_error($this->get_identifier() . ' is not supported on this architecture: ' . phodevi::read_property('system', 'kernel-architecture'));190 $test_supported = false;191 }192 else if($this->is_test_platform_supported() == false)193 {194 PTS_IS_CLIENT && $report_warnings && pts_client::$display->test_run_error($this->get_identifier() . ' is not supported by this operating system: ' . phodevi::operating_system());195 $test_supported = false;196 }197 else if($this->is_core_version_supported() == false)198 {199 PTS_IS_CLIENT && $report_warnings && pts_client::$display->test_run_error($this->get_identifier() . ' is not supported by this version of the Phoronix Test Suite: ' . PTS_VERSION);200 $test_supported = false;201 }202 else if(PTS_IS_CLIENT && ($custom_support_check = $this->custom_test_support_check()) !== true)203 {204 // A custom-self-generated error occurred, see code comments in custom_test_support_check()205 PTS_IS_CLIENT && $report_warnings && is_callable(array(pts_client::$display, 'test_run_error')) && pts_client::$display->test_run_error($this->get_identifier() . ': ' . $custom_support_check);206 $test_supported = false;207 }208 else if(PTS_IS_CLIENT)209 {210 foreach($this->extended_test_profiles() as $extension)211 {212 if($extension->is_supported($report_warnings) == false)213 {214 $test_supported = false;215 break;216 }217 }218 }219 return $test_supported;220 }221 public function custom_test_support_check()222 {223 /*224 As of Phoronix Test Suite 4.4, the software will check for the presence of a 'support-check' file.225 Any test profile can optionally include a support-check.sh file to check for arbitrary commands not covered by226 the rest of the PTS testing architecture, e.g. to check for the presence of systemd on the target system. If227 the script finds that the system is incompatible with the test, it can write a custom error message to the file228 specified by the $TEST_CUSTOM_ERROR environment variable. If the $TEST_CUSTOM_ERROR target is written to, the PTS229 client will abort the test installation with the specified error message.230 */231 $support_check_file = $this->get_resource_dir() . 'support-check.sh';232 if(PTS_IS_CLIENT && is_file($support_check_file))233 {234 $environment['TEST_CUSTOM_ERROR'] = pts_client::temporary_directory() . '/PTS-' . $this->get_identifier_base_name() . '-' . rand(1000, 9999);235 $support_check = pts_tests::call_test_script($this, 'support-check', null, null, $environment, false);236 if(is_file($environment['TEST_CUSTOM_ERROR']))237 {238 $support_result = pts_file_io::file_get_contents($environment['TEST_CUSTOM_ERROR']);239 pts_file_io::delete($environment['TEST_CUSTOM_ERROR']);240 return $support_result;241 }242 }243 return true;244 }245 public function is_test_architecture_supported()246 {247 // Check if the system's architecture is supported by a test248 $archs = $this->get_supported_architectures();249 return !empty($archs) ? phodevi::cpu_arch_compatible($archs) : true;250 }251 public function is_core_version_supported()252 {253 // Check if the test profile's version is compatible with pts-core254 $core_version_min = parent::requires_core_version_min();255 $core_version_max = parent::requires_core_version_max();256 return $core_version_min <= PTS_CORE_VERSION && $core_version_max > PTS_CORE_VERSION;257 }258 public function is_test_platform_supported()259 {260 // Check if the system's OS is supported by a test261 $supported = true;262 $platforms = $this->get_supported_platforms();263 if(!empty($platforms) && !in_array(phodevi::operating_system(), $platforms))264 {265 if(phodevi::is_bsd() && in_array('Linux', $platforms) && (pts_client::executable_in_path('kldstat') && strpos(shell_exec('kldstat -n linux 2>&1'), 'linux.ko') != false))266 {267 // The OS is BSD but there is Linux API/ABI compatibility support loaded268 $supported = true;269 }270 else if(phodevi::is_hurd() && in_array('Linux', $platforms) && in_array('BSD', $platforms))271 {272 // For now until test profiles explicity express Hurd support, just list as supported the tests that work on both BSD and Linux273 // TODO: fill in Hurd support for test profiles / see what works274 $supported = true;275 }276 else277 {278 $supported = false;279 }280 }281 return $supported;282 }283 public static function generate_comparison_hash($test_identifier, $arguments, $attributes = null, $version = null, $result_scale = null, $raw_output = true)284 {285 $hash_table = array(286 $test_identifier,287 trim($arguments),288 trim($attributes),289 trim($version),290 trim($result_scale)291 );292 return sha1(implode(',', $hash_table), $raw_output);293 }294 public function get_test_executable_dir()295 {296 $to_execute = null;297 $test_dir = $this->get_install_dir();298 $execute_binary = $this->get_test_executable();299 if(is_executable($test_dir . $execute_binary) || (phodevi::is_windows() && is_file($test_dir . $execute_binary)))300 {301 $to_execute = $test_dir;302 }303 return $to_execute;304 }305 public function is_test_installed()306 {307 return is_file($this->get_install_dir() . 'pts-install.xml');308 }309 public function get_install_dir()310 {311 return pts_client::test_install_root_path() . $this->identifier . '/';312 }313 public function get_installer_checksum()314 {315 return $this->get_file_installer() != false ? md5_file($this->get_file_installer()) : false;316 }317 public function get_file_installer()318 {319 $test_resources_location = $this->get_resource_dir();320 $os_postfix = '_' . strtolower(phodevi::operating_system());321 if(is_file($test_resources_location . 'install' . $os_postfix . '.sh'))322 {323 $installer = $test_resources_location . 'install' . $os_postfix . '.sh';324 }325 else if(is_file($test_resources_location . 'install.sh'))326 {327 $installer = $test_resources_location . 'install.sh';328 }329 else330 {331 $installer = null;332 }333 return $installer;334 }335 public function get_file_download_spec()336 {337 return is_file($this->get_resource_dir() . 'downloads.xml') ? $this->get_resource_dir() . 'downloads.xml' : false;338 }339 public function get_file_parser_spec()340 {341 $spec = is_file($this->get_resource_dir() . 'results-definition.xml') ? $this->get_resource_dir() . 'results-definition.xml' : false;342 if(!$spec)343 {344 $extends = $this->get_test_extension();345 if(!empty($extends))346 {347 $test_profile = new pts_test_profile($extends);348 $spec = $test_profile->get_file_parser_spec();349 }350 }351 return $spec;352 }353 public function extended_test_profiles()354 {355 // Provide an array containing the location(s) of all test(s) for the supplied object name356 $test_profiles = array();357 foreach(array_unique(array_reverse($this->get_test_extensions_recursive())) as $extended_test)358 {359 $test_profile = new pts_test_profile($extended_test);360 $test_profiles[] = $test_profile;361 }362 return $test_profiles;363 }364 public function needs_updated_install()365 {366 // Checks if test needs updating367 return $this->test_installation == false || $this->get_test_profile_version() != $this->test_installation->get_installed_version() || $this->get_installer_checksum() != $this->test_installation->get_installed_checksum() || $this->test_installation->get_installed_system_identifier() != phodevi::system_id_string();368 }369 public function to_json()370 {371 $file = $this->get_xml();...

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1require_once('pts-core/objects/test_profile.php');2$test_extensions = pts_test_profile::get_test_extensions_recursive('2.php');3print_r($test_extensions);4require_once('pts-core/objects/test_profile.php');5$test_extensions = pts_test_profile::get_test_extensions_recursive('1.php');6print_r($test_extensions);7require_once('pts-core/objects/test_profile.php');8$test_extensions = pts_test_profile::get_test_extensions_recursive('3.php');9print_r($test_extensions);10require_once('pts-core/objects/test_profile.php');11$test_extensions = pts_test_profile::get_test_extensions_recursive('4.php');12print_r($test_extensions);13require_once('pts-core/objects/test_profile.php');14$test_extensions = pts_test_profile::get_test_extensions_recursive('5.php');15print_r($test_extensions);16require_once('pts-core/objects/test_profile.php');17$test_extensions = pts_test_profile::get_test_extensions_recursive('6.php');18print_r($test_extensions);19require_once('pts-core/objects/test_profile.php');20$test_extensions = pts_test_profile::get_test_extensions_recursive('7.php');21print_r($test_extensions);22require_once('pts-core/objects/test_profile.php');23$test_extensions = pts_test_profile::get_test_extensions_recursive('8.php');24print_r($test_extensions);25require_once('pts-core/objects/test_profile.php');26$test_extensions = pts_test_profile::get_test_extensions_recursive('9.php');27print_r($test_extensions);28require_once('

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1$test_profile = new pts_test_profile('test1');2$test_profile->get_test_extensions_recursive();3$test_profile = new pts_test_profile('test1');4$test_profile->get_test_extensions_recursive(true);5$test_profile = new pts_test_profile('test1');6$test_profile->get_test_extensions_recursive(false, true);7$test_profile = new pts_test_profile('test1');8$test_profile->get_test_extensions_recursive(true, true);

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1$test_profile = new pts_test_profile('test_name');2$test_extensions = $test_profile->get_test_extensions_recursive();3print_r($test_extensions);4$test_profile = new pts_test_profile('test_name');5$test_extensions = $test_profile->get_test_extensions_recursive();6print_r($test_extensions);7$test_profile = new pts_test_profile('test_name');8$test_extensions = $test_profile->get_test_extensions_recursive();9print_r($test_extensions);10$test_profile = new pts_test_profile('test_name');11$test_extensions = $test_profile->get_test_extensions_recursive();12print_r($test_extensions);13$test_profile = new pts_test_profile('test_name');14$test_extensions = $test_profile->get_test_extensions_recursive();15print_r($test_extensions);16$test_profile = new pts_test_profile('test_name');17$test_extensions = $test_profile->get_test_extensions_recursive();18print_r($test_extensions);19$test_profile = new pts_test_profile('test_name');20$test_extensions = $test_profile->get_test_extensions_recursive();21print_r($test_extensions);22$test_profile = new pts_test_profile('test_name');23$test_extensions = $test_profile->get_test_extensions_recursive();24print_r($test_extensions);25$test_profile = new pts_test_profile('test_name

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1require_once('pts_test_profile.php');2$test_profile = new pts_test_profile('test-profile.xml');3$test_extensions = $test_profile->get_test_extensions_recursive();4echo '<table border="1">';5foreach($test_extensions as $test_extension)6{7 echo '<tr>';8 echo '<td>'.$test_extension['name'].'</td>';9 echo '<td>'.$test_extension['version'].'</td>';10 echo '<td>'.$test_extension['release_date'].'</td>';11 echo '</tr>';12}13echo '</table>';14require_once('pts_test_profile.php');15$test_profile = new pts_test_profile('test-profile.xml');16$test_extensions = $test_profile->get_test_extensions_recursive();17echo '<table border="1">';18foreach($test_extensions as $test_extension)19{20 echo '<tr>';21 echo '<td>'.$test_extension['name'].'</td>';22 echo '<td>'.$test_extension['version'].'</td>';23 echo '<td>'.$test_extension['release_date'].'</td>';24 echo '</tr>';25}26echo '</table>';27require_once('pts_test_profile.php');28$test_profile = new pts_test_profile('test-profile.xml');29$test_extensions = $test_profile->get_test_extensions_recursive();30echo '<table border="1">';31foreach($test_extensions as $test_extension)32{33 echo '<tr>';34 echo '<td>'.$test_extension['name'].'</td>';35 echo '<td>'.$test_extension['version'].'</td>';36 echo '<td>'.$test_extension['release_date'].'</td>';37 echo '</tr>';38}39echo '</table>';

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1function get_test_extensions_recursive($test_profile, $ignore_extensions = array())2{3 $extensions = array();4 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)5 {6 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));7 }8 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());9 $extensions = array_unique($extensions);10 foreach($ignore_extensions as $ignore_extension)11 {12 $extensions = array_diff($extensions, array($ignore_extension));13 }14 return $extensions;15}16function get_test_extensions_recursive($test_profile, $ignore_extensions = array())17{18 $extensions = array();19 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)20 {21 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));22 }23 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());24 $extensions = array_unique($extensions);25 foreach($ignore_extensions as $ignore_extension)26 {27 $extensions = array_diff($extensions, array($ignore_extension));28 }29 return $extensions;30}31function get_test_extensions_recursive($test_profile, $ignore_extensions = array())32{33 $extensions = array();34 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)35 {36 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));37 }38 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1function get_test_extensions_recursive($test_profile, $ignore_extensions = array())2{3 $extensions = array();4 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)5 {6 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));7 }8 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());9 $extensions = array_unique($extensions);10 foreach($ignore_extensions as $ignore_extension)11 {12 $extensions = array_diff($extensions, array($ignore_extension));13 }14 return $extensions;15}16function get_test_extensions_recursive($test_profile, $ignore_extensions = array())17{18 $extensions = array();19 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)20 {21 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));22 }23 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());24 $extensions = array_unique($extensions);25 foreach($ignore_extensions as $ignore_extension)26 {27 $extensions = array_diff($extensions, array($ignore_extension));28 }29 return $extensions;30}31function get_test_extensions_recursive($test_profile, $ignore_extensions = array())32{33 $extensions = array();34 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)35 {36 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));37 }38 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());

Full Screen

Full Screen

get_test_extensions_recursive

Using AI Code Generation

copy

Full Screen

1function get_test_extensions_recursive($test_profile, $ignore_extensions = array())2{3 $extensions = array();4 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)5 {6 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));7 }8 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());9 $extensions = array_unique($extensions);10 foreach($ignore_extensions as $ignore_extension)11 {12 $extensions = array_diff($extensions, array($ignore_extension));13 }14 return $extensions;15}16function get_test_extensions_recursive($test_profile, $ignore_extensions = array())17{18 $extensions = array();19 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)20 {21 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));22 }23 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());24 $extensions = array_unique($extensions);25 foreach($ignore_extensions as $ignore_extension)26 {27 $extensions = array_diff($extensions, array($ignore_extension));28 }29 return $extensions;30}31function get_test_extensions_recursive($test_profile, $ignore_extensions = array())32{33 $extensions = array();34 foreach($test_profile->get_contained_test_profiles() as $contained_test_profile)35 {36 $extensions = array_merge($extensions, get_test_extensions_recursive($contained_test_profile, $ignore_extensions));37 }38 $extensions = array_merge($extensions, $test_profile->get_test_executable_extensions());

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful