How to use cleanup_tests_to_run method of pts_test_run_manager class

Best Phoronix-test-suite code snippet using pts_test_run_manager.cleanup_tests_to_run

pts_test_run_manager.php

Source:pts_test_run_manager.php Github

copy

Full Screen

...794 trigger_error('The test installation directory is on a file-system mounted with the \'noexec\' mount option. Re-mount the file-system appropriately or change the Phoronix Test Suite user configuration file to point to an alternative mount point.' . PHP_EOL . 'Location: ' . pts_client::test_install_root_path(), E_USER_ERROR);795 return false;796 }797 // Cleanup tests to run798 if($this->cleanup_tests_to_run($to_run) == false)799 {800 return false;801 }802 else if(count($to_run) == 0)803 {804 //trigger_error('You must enter at least one test, suite, or result identifier to run.', E_USER_ERROR);805 return false;806 }807 return true;808 }809 public function pre_execution_process()810 {811 if($this->is_new_result_file || $this->result_already_contains_identifier() == false)812 {813 $this->result_file->set_title($this->file_name_title);814 $this->result_file->set_description($this->run_description);815 $this->result_file->set_notes($this->get_notes());816 $this->result_file->set_internal_tags($this->get_internal_tags());817 $this->result_file->set_reference_id($this->get_reference_id());818 $this->result_file->set_preset_environment_variables($this->get_preset_environment_variables());819 // TODO XXX JSON In null and notes820 $json_attr = $this->generate_json_system_attributes();821 $sys = new pts_result_file_system($this->results_identifier, phodevi::system_hardware(true), phodevi::system_software(true), $json_attr, pts_client::current_user(), null, date('Y-m-d H:i:s', pts_client::current_time()), PTS_VERSION, $this->result_file);822 $this->result_file->add_system($sys);823 }824 if($this->do_save_results())825 {826 pts_client::setup_test_result_directory($this->get_file_name());827 }828 }829 protected function generate_json_system_attributes()830 {831 $test_external_dependencies = array();832 $test_hardware_types = array();833 $test_internal_tags = array();834 foreach($this->tests_to_run as &$test_to_run)835 {836 $test_external_dependencies = array_merge($test_external_dependencies, $test_to_run->test_profile->get_external_dependencies());837 $test_internal_tags = array_merge($test_internal_tags, $test_to_run->test_profile->get_internal_tags());838 pts_arrays::unique_push($test_hardware_types, $test_to_run->test_profile->get_test_hardware_type());839 }840 return self::pull_test_notes(false, $test_external_dependencies, $test_internal_tags, $test_hardware_types);841 }842 public static function pull_test_notes($show_all = false, $test_external_dependencies = array(), $test_internal_tags = array(), $test_hardware_types = array())843 {844 $notes = null;845 if($show_all || in_array('build-utilities', $test_external_dependencies))846 {847 // So compiler tests were run....848 $test = false;849 $compiler_mask_dir = pts_test_installer::create_compiler_mask($test);850 if($compiler_mask_dir && is_executable($compiler_mask_dir . 'cc'))851 {852 $compiler_configuration = phodevi_system::sw_compiler_build_configuration($compiler_mask_dir . 'cc');853 pts_file_io::delete($compiler_mask_dir, null, true);854 if(!empty($compiler_configuration))855 {856 $notes['compiler-configuration'] = $compiler_configuration;857 }858 }859 }860 if($show_all || in_array('OpenCL', $test_internal_tags) || in_array('opencl', $test_external_dependencies))861 {862 // So OpenCL tests were run....863 $gpu_compute_cores = phodevi::read_property('gpu', 'compute-cores');864 if($gpu_compute_cores > 0)865 {866 $notes['graphics-compute-cores'] = $gpu_compute_cores;867 }868 }869 if($show_all || in_array('Disk', $test_hardware_types))870 {871 // A disk test was run so report some disk information...872 $disk_scheduler = phodevi::read_property('disk', 'scheduler');873 if($disk_scheduler)874 {875 $notes['disk-scheduler'] = $disk_scheduler;876 }877 $mount_options = phodevi::read_property('disk', 'mount-options');878 if(isset($mount_options['mount-options']) && $mount_options['mount-options'] != null)879 {880 $notes['disk-mount-options'] = $mount_options['mount-options'];881 }882 $extra = phodevi::read_property('disk', 'extra-disk-details');883 if($extra != null)884 {885 $notes['disk-details'] = $extra;886 }887 }888 if(true || $show_all || in_array('Processor', $test_hardware_types) || in_array('System', $test_hardware_types))889 {890 // makes sense always reporting the CPU scaling governor891 $scaling_governor = phodevi::read_property('cpu', 'scaling-governor');892 if($scaling_governor)893 {894 $notes['cpu-scaling-governor'] = $scaling_governor;895 }896 $cpu_microcode = phodevi::read_property('cpu', 'microcode-version');897 if($cpu_microcode)898 {899 $notes['cpu-microcode'] = $cpu_microcode;900 }901 if(phodevi::is_linux() && pts_client::executable_in_path('thermald') && (pts_client::is_process_running('thermald') || phodevi_linux_parser::systemctl_active('thermald')))902 {903 $thermald_version = trim(shell_exec('thermald --version 2>/dev/null'));904 if(!empty($thermald_version) && pts_strings::is_version($thermald_version))905 {906 $notes['cpu-thermald'] = $thermald_version;907 }908 }909 // POWER processors have configurable SMT, 1-8 per core.910 $smt = phodevi::read_property('cpu', 'smt');911 if($smt)912 {913 $notes['cpu-smt'] = $smt;914 }915 $cpu_pm = phodevi::read_property('cpu', 'power-management');916 if($cpu_pm)917 {918 $notes['cpu-pm'] = $cpu_pm;919 }920 $platform_profile = phodevi::read_property('system', 'platform-profile');921 if($platform_profile)922 {923 $notes['platform-profile'] = $platform_profile;924 }925 }926 if($show_all || in_array('Graphics', $test_hardware_types))927 {928 $accel_2d = phodevi::read_property('gpu', '2d-acceleration');929 if($accel_2d)930 {931 $notes['graphics-2d-acceleration'] = $accel_2d;932 }933 $aa = phodevi::read_property('gpu', 'aa-level');934 if($aa)935 {936 $notes['graphics-aa'] = $aa;937 }938 $af = phodevi::read_property('gpu', 'af-level');939 if($af)940 {941 $notes['graphics-af'] = $af;942 }943 $oc_offset = phodevi::read_property('gpu', 'oc-offset-string');944 if(!empty($oc_offset))945 {946 $notes['graphics-oc'] = $oc_offset;947 }948 $bar1_visible_vram_rebar = phodevi::read_property('gpu', 'bar1-visible-vram');949 if(!empty($bar1_visible_vram_rebar))950 {951 $notes['bar1-visible-vram'] = $bar1_visible_vram_rebar;952 }953 }954 if($show_all || phodevi::read_property('system', 'kernel-parameters'))955 {956 $notes['kernel-parameters'] = phodevi::read_property('system', 'kernel-parameters');957 }958 if($show_all || phodevi::read_property('system', 'kernel-extra-details'))959 {960 $notes['kernel-extra-details'] = phodevi::read_property('system', 'kernel-extra-details');961 }962 if($show_all || phodevi::read_property('system', 'environment-variables', false))963 {964 $notes['environment-variables'] = phodevi::read_property('system', 'environment-variables', false);965 }966 if($show_all || in_array('Java', $test_internal_tags) || in_array('java', $test_external_dependencies))967 {968 $notes['java'] = phodevi::read_property('system', 'java-version');969 }970 if($show_all || in_array('Python', $test_internal_tags) || in_array('python', $test_external_dependencies))971 {972 $notes['python'] = phodevi::read_property('system', 'python-version');973 }974 if(in_array('wine', $test_external_dependencies))975 {976 phodevi_system::$report_wine_override = true;977 }978 $notes['security'] = phodevi::read_property('system', 'security-features');979 foreach($notes as $key => $value)980 {981 if(empty($value))982 {983 unset($notes[$key]);984 }985 }986 return $notes;987 }988 public function post_execution_process()989 {990 $this->benchmark_log->log('Test Run Process Ended');991 if($this->do_save_results() && !$this->skip_post_execution_options)992 {993 // Save the results994 echo PHP_EOL;995 pts_module_manager::module_process('__event_results_process', $this);996 pts_client::save_test_result($this->get_file_name() . '/composite.xml', $this->result_file->get_xml(), true, $this->results_identifier);997 pts_module_manager::module_process('__event_results_saved', $this);998 if($this->test_run_success_counter == 0 && $this->is_new_result_file)999 {1000 return false;1001 }1002 }1003 if($this->test_run_success_counter > 3 && pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/ShowPostRunStatistics', 'TRUE'))1004 {1005 // Show any post run statistics1006 pts_module_manager::module_process('__event_post_run_stats', $this);1007 if($this->result_file->get_system_count() == 2)1008 {1009 $highlights = pts_result_file_analyzer::display_results_baseline_two_way_compare($this->result_file, true, false, true, ' ');1010 if($highlights)1011 {1012 echo ' ' . pts_client::cli_just_bold('Result Highlights') . PHP_EOL;1013 echo $highlights . PHP_EOL;1014 }1015 }1016 if($this->result_file->get_system_count() > 2)1017 {1018 // Display winners and losers1019 echo pts_result_file_analyzer::display_results_wins_losses($this->result_file, $this->get_results_identifier(), ' ') . PHP_EOL;1020 }1021 if($this->result_file->get_system_count() > 1)1022 {1023 echo pts_result_file_analyzer::display_result_file_stats_pythagorean_means($this->result_file, $this->get_results_identifier());1024 }1025 }1026 if($this->do_save_results() && !$this->skip_post_execution_options)1027 {1028 // See if the results should be displayed1029 //echo PHP_EOL . 'Results Saved To: ; . PTS_SAVE_RESULTS_PATH . $this->get_file_name() . ;/composite.xml' . PHP_EOL;1030 if(!$this->auto_mode)1031 {1032 if($this->batch_mode)1033 {1034 if($this->batch_mode['OpenBrowser'])1035 {1036 pts_client::display_result_view($this->result_file, true, null);1037 }1038 }1039 else1040 {1041 if(!phodevi::is_display_server_active() && !defined('PHOROMATIC_PROCESS'))1042 {1043 pts_client::display_result_view($this->result_file, false, 'Do you want to view the text results of the testing');1044 }1045 else1046 {1047 pts_client::display_result_view($this->result_file, false, '');1048 }1049 }1050 }1051 if($this->allow_sharing_of_results && pts_network::internet_support_available() && pts_openbenchmarking::ob_upload_support_available())1052 {1053 if($this->auto_upload_to_openbenchmarking || pts_openbenchmarking_client::auto_upload_results() || pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/AlwaysUploadResultsToOpenBenchmarking', 'FALSE'))1054 {1055 $upload_results = true;1056 }1057 else if($this->batch_mode)1058 {1059 $upload_results = $this->batch_mode['UploadResults'];1060 }1061 else if(!$this->auto_mode)1062 {1063 $upload_results = pts_user_io::prompt_bool_input('Would you like to upload the results to OpenBenchmarking.org', -1);1064 }1065 else1066 {1067 $upload_results = false;1068 }1069 if($upload_results)1070 {1071 $this->openbenchmarking_results_data = pts_openbenchmarking::upload_test_result($this, true, (!$this->auto_mode && !$this->batch_mode));1072 if($this->get_results_url())1073 {1074 if(!$this->auto_mode && !$this->batch_mode && pts_openbenchmarking_client::auto_upload_results() == false)1075 {1076 pts_client::display_web_page($this->get_results_url(), 'Do you want to launch OpenBenchmarking.org', true);1077 }1078 }1079 else1080 {1081 echo PHP_EOL . 'Results Failed To Upload.' . PHP_EOL;1082 }1083 }1084 }1085 }1086 }1087 public function get_results_url()1088 {1089 return isset($this->openbenchmarking_results_data['url']) ? $this->openbenchmarking_results_data['url'] : false;1090 }1091 public function set_batch_mode($custom_preset = false)1092 {1093 $this->batch_mode = array(1094 'UploadResults' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/UploadResults', 'TRUE'),1095 'SaveResults' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/SaveResults', 'TRUE'),1096 'PromptForTestDescription' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/PromptForTestDescription', 'FALSE'),1097 'RunAllTestCombinations' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/RunAllTestCombinations', 'TRUE'),1098 'PromptSaveName' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/PromptSaveName', 'FALSE'),1099 'PromptForTestIdentifier' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier', 'TRUE'),1100 'Configured' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/Configured', 'FALSE'),1101 'OpenBrowser' => pts_config::read_bool_config('PhoronixTestSuite/Options/BatchMode/OpenBrowser', 'FALSE'),1102 );1103 if($custom_preset && is_array($custom_preset))1104 {1105 foreach($custom_preset as $key => $value)1106 {1107 $this->batch_mode[$key] = $value;1108 }1109 $this->batch_mode['Configured'] = true;1110 }1111 }1112 public function cleanup_test_profile_valid(&$test_profile, &$tests_missing, $check_for_new_on_fail = true)1113 {1114 if($test_profile->get_title() == null)1115 {1116 pts_client::$display->generic_sub_heading('Not A Test: ' . $test_profile);1117 return false;1118 }1119 else1120 {1121 if($test_profile->is_supported(false) == false)1122 {1123 return false;1124 }1125 if(!$test_profile->test_installation || $test_profile->test_installation->is_installed() == false)1126 {1127 // If the desired test version is not installed, see if a newer version in that release stream (minor version difference) is installed1128 if($check_for_new_on_fail)1129 {1130 $tp = pts_openbenchmarking_client::test_profile_newer_minor_version_available($test_profile);1131 if($tp && $this->cleanup_test_profile_valid($tp, $tests_missing, false))1132 {1133 return $tp;1134 }1135 }1136 if($test_profile->get_identifier(false) != null)1137 {1138 $tests_missing[] = $test_profile;1139 }1140 return false;1141 }1142 }1143 return $test_profile;1144 }1145 public function cleanup_tests_to_run(&$to_run_objects)1146 {1147 $skip_tests = ($e = pts_env::read('SKIP_TESTS')) ? pts_strings::comma_explode($e) : false;1148 $tests_verified = array();1149 $tests_missing = array();1150 foreach($to_run_objects as &$run_object)1151 {1152 if($skip_tests && (in_array($run_object->get_identifier(false), $skip_tests) || ($run_object instanceof pts_test_profile && in_array($run_object->get_identifier_base_name(), $skip_tests))))1153 {1154 pts_client::$display->generic_sub_heading('Skipping: ' . $run_object->get_identifier());1155 continue;1156 }1157 else if($run_object instanceof pts_test_profile)1158 {1159 $valid = $this->cleanup_test_profile_valid($run_object, $tests_missing);1160 if($valid == false)1161 {1162 continue;1163 }1164 // Set $valid to $run_object in case it's a newer version of the test profile that was upgraded1165 $run_object = $valid;1166 }1167 else if($run_object instanceof pts_result_file)1168 {1169 $num_installed = 0;1170 foreach($run_object->get_contained_test_profiles() as $test_profile)1171 {1172 $valid = $this->cleanup_test_profile_valid($test_profile, $tests_missing);1173 if($valid == false)1174 {1175 continue;1176 }1177 $num_installed++;1178 }1179 if($num_installed == 0)1180 {1181 continue;1182 }1183 }1184 else if($run_object instanceof pts_test_suite)1185 {1186 if($run_object->is_core_version_supported() == false)1187 {1188 pts_client::$display->generic_sub_heading($run_object->get_title() . ' is a suite not supported by this version of the Phoronix Test Suite.');1189 continue;1190 }1191 $num_installed = 0;1192 foreach($run_object->get_contained_test_profiles() as $test_profile)1193 {1194 $valid = $this->cleanup_test_profile_valid($test_profile, $tests_missing);1195 if($valid == false)1196 {1197 continue;1198 }1199 $num_installed++;1200 }1201 if($num_installed == 0)1202 {1203 continue;1204 }1205 }1206 else1207 {1208 pts_client::$display->generic_sub_heading('Not Recognized: ' . $run_object);1209 continue;1210 }1211 $tests_verified[] = $run_object;1212 }1213 $to_run_objects = $tests_verified;1214 if(count($tests_missing) > 0 && !defined('PHOROMATIC_PROCESS'))1215 {1216 $tests_missing = array_unique($tests_missing);1217 if(count($tests_missing) == 1)1218 {1219 trigger_error($tests_missing[0] . ' is not installed.', E_USER_ERROR);1220 // PHP_EOL . 'To install, run: phoronix-test-suite install ' . $tests_missing[0]1221 }1222 else1223 {1224 $message = PHP_EOL . PHP_EOL . 'Multiple tests are not installed:' . PHP_EOL . PHP_EOL;1225 $message .= pts_user_io::display_text_list($tests_missing);1226 //$message .= PHP_EOL . 'To install, run: phoronix-test-suite install ' . implode(' ', $tests_missing) . PHP_EOL . PHP_EOL;1227 echo $message;1228 }1229 if(!$this->batch_mode && !$this->auto_mode && pts_client::current_command() != 'benchmark')1230 {1231 $stop_and_install = pts_user_io::prompt_bool_input('Would you like to stop and install these tests now', true);1232 if($stop_and_install)1233 {1234 pts_test_installer::standard_install($tests_missing);1235 $to_run_objects = array_merge($to_run_objects, $tests_missing);1236 $this->cleanup_tests_to_run($to_run_objects);1237 }1238 }1239 }1240 return true;1241 }1242 public function auto_save_results($save_name, $result_identifier, $description = null, $is_new_save = false)1243 {1244 $this->set_save_name($save_name, $is_new_save);1245 $this->set_results_identifier($result_identifier);1246 $this->set_description($description);1247 }1248 public function set_description($description)1249 {1250 $this->run_description = $description == null ? self::auto_generate_description() : $description;...

Full Screen

Full Screen

cleanup_tests_to_run

Using AI Code Generation

copy

Full Screen

1$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests_to_run);2$test_results = pts_test_run_manager::run_tests($tests_to_run);3$test_results = pts_test_run_manager::replace_run_with_result($test_results);4pts_test_run_manager::save_test_results($test_results);5$test_results = pts_test_run_manager::prepare_test_results($test_results);6pts_test_run_manager::display_results($test_results);7pts_test_run_manager::save_results_to_file($test_results);8pts_test_run_manager::upload_results_to_phoronix($test_results);9pts_test_run_manager::cleanup();10pts_test_run_manager::initialize();11$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests_to_run);

Full Screen

Full Screen

cleanup_tests_to_run

Using AI Code Generation

copy

Full Screen

1$tests_to_run = array('pts/test1', 'pts/test2', 'pts/test3', 'pts/test4');2$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests_to_run);3print_r($tests_to_run);4$tests_to_run = array('pts/test1', 'pts/test2', 'pts/test3', 'pts/test4');5$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests_to_run);6print_r($tests_to_run);7$tests_to_run = array('pts/test1', 'pts/test2', 'pts/test3', 'pts/test4');8$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests_to_run);9print_r($tests_to_run);10$tests_to_run = array('pts/test1', 'pts/test2', 'pts/test3', 'pts/test4');11$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests_to_run);12print_r($tests_to_run);

Full Screen

Full Screen

cleanup_tests_to_run

Using AI Code Generation

copy

Full Screen

1$test_run_manager = new pts_test_run_manager();2$tests_to_run = $test_run_manager->cleanup_tests_to_run($tests_to_run);3 (4 (5 (6 [test_profile_license] => GNU General Public License (GPL)

Full Screen

Full Screen

cleanup_tests_to_run

Using AI Code Generation

copy

Full Screen

1$tests = array('pts_test', 'pts_test', 'pts_test');2$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests);3$tests = array('pts_test', 'pts_test', 'pts_test');4$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests);5$tests = array('pts_test', 'pts_test', 'pts_test');6$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests);7$tests = array('pts_test', 'pts_test', 'pts_test');8$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests);9$tests = array('pts_test', 'pts_test', 'pts_test');10$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests);11$tests = array('pts_test', 'pts_test', 'pts_test');12$tests_to_run = pts_test_run_manager::cleanup_tests_to_run($tests);13$tests = array('pts_test', 'pts_test', 'pts_test

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 method in pts_test_run_manager

Trigger cleanup_tests_to_run code on LambdaTest Cloud Grid

Execute automation tests with cleanup_tests_to_run on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

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