public static function read_osx_system_profiler($data_type, $object, $multiple_objects = false, $ignore_values = array())
 {
     $value = $multiple_objects ? array() : false;
     if (pts_client::executable_in_path('system_profiler')) {
         $info = trim(shell_exec('system_profiler ' . $data_type . ' 2>&1'));
         $lines = explode("\n", $info);
         for ($i = 0; $i < count($lines) && ($value == false || $multiple_objects); $i++) {
             $line = pts_strings::colon_explode($lines[$i]);
             if (isset($line[0]) == false) {
                 continue;
             }
             $line_object = str_replace(' ', null, $line[0]);
             if (($cut_point = strpos($line_object, '(')) > 0) {
                 $line_object = substr($line_object, 0, $cut_point);
             }
             if (strtolower($line_object) == strtolower($object) && isset($line[1])) {
                 $this_value = trim($line[1]);
                 if (!empty($this_value) && !in_array($this_value, $ignore_values)) {
                     if ($multiple_objects) {
                         array_push($value, $this_value);
                     } else {
                         $value = $this_value;
                     }
                 }
             }
         }
     }
     return $value;
 }
 public static function run($args)
 {
     $result_file = new pts_result_file($args[0]);
     $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;
     }
     echo PHP_EOL . 'Enter The New Order To Display The New Results, From Left To Right.' . PHP_EOL;
     $sorted_identifiers = array();
     do {
         $extract_identifier = pts_user_io::prompt_text_menu('Select the test run to be showed next', $result_file_identifiers);
         $sorted_identifiers[] = $extract_identifier;
         $old_identifiers = $result_file_identifiers;
         $result_file_identifiers = array();
         foreach ($old_identifiers as $identifier) {
             if ($identifier != $extract_identifier) {
                 $result_file_identifiers[] = $identifier;
             }
         }
     } while (count($result_file_identifiers) > 0);
     $result_file->reorder_runs($sorted_identifiers);
     pts_client::save_test_result($result_file->get_file_location(), $result_file->get_xml());
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html');
 }
 public static function run($r)
 {
     define('PHOROMATIC_PROCESS', true);
     $commands = array('detailed_system_info' => null, 'list_available_tests' => null, 'list_available_suites' => null, 'info' => array('pts/all'), 'clone_openbenchmarking_result' => array('1107247-LI-MESACOMMI48', '1509040-HA-GCCINTELS17', '1508201-HA-GTX95073337', '1508233-HA-INTELSKYL16'), 'refresh_graphs' => array('1107247-LI-MESACOMMI48'), 'result_file_to_text' => array('1107247-LI-MESACOMMI48'), 'merge_results' => array('1107247-LI-MESACOMMI48', '1509040-HA-GCCINTELS17', '1508201-HA-GTX95073337', '1508233-HA-INTELSKYL16'), 'diagnostics' => null, 'dump_possible_options' => null, 'debug_render_test' => null);
     $individual_times = array();
     phodevi::clear_cache();
     $start = microtime(true);
     foreach ($commands as $command => $args) {
         echo PHP_EOL . '### ' . $command . ' ###' . PHP_EOL;
         $individual_times[$command] = array();
         for ($i = 0; $i < 3; $i++) {
             $c_start = microtime(true);
             pts_client::execute_command($command, $args);
             $c_finish = microtime(true);
             $individual_times[$command][] = $c_finish - $c_start;
         }
     }
     $finish = microtime(true);
     echo PHP_EOL . PHP_EOL . '### OVERALL DATA ###' . PHP_EOL . PHP_EOL;
     echo 'PHP:  ' . PTS_PHP_VERSION . PHP_EOL;
     $longest_c = max(array_map('strlen', array_keys($individual_times)));
     foreach ($individual_times as $component => $times) {
         echo strtoupper($component) . ': ' . str_repeat(' ', $longest_c - strlen($component)) . pts_math::set_precision(round(array_sum($times) / count($times), 3), 3) . ' seconds' . PHP_EOL;
     }
     echo PHP_EOL . 'TOTAL ELAPSED TIME: ' . str_repeat(' ', $longest_c - strlen('ELAPSED TIME')) . round($finish - $start, 3) . ' seconds';
     echo PHP_EOL . 'PEAK MEMORY USAGE: ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE')) . round(memory_get_peak_usage(true) / 1048576, 3) . ' MB';
     echo PHP_EOL . 'PEAK MEMORY USAGE EMALLOC: ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE (emalloc)')) . round(memory_get_peak_usage() / 1048576, 3) . ' MB';
     echo PHP_EOL;
 }
 public static function what_provides($files_needed)
 {
     $packages_needed = array();
     foreach (pts_arrays::to_array($files_needed) as $file) {
         if (pts_client::executable_in_path('apt-file')) {
             if (!defined('APT_FILE_UPDATED')) {
                 shell_exec('apt-file update 2>&1');
                 define('APT_FILE_UPDATED', 1);
             }
             // Try appending common paths
             if (strpos($file, '.h') !== false) {
                 $apt_provides = self::run_apt_file_provides('/usr/include/' . $file);
                 if ($apt_provides != null) {
                     $packages_needed[$file] = $apt_provides;
                 }
             } else {
                 if (strpos($file, '.so') !== false) {
                     $apt_provides = self::run_apt_file_provides('/usr/lib/' . $file);
                     if ($apt_provides != null) {
                         $packages_needed[$file] = $apt_provides;
                     }
                 } else {
                     foreach (array('/usr/bin/', '/bin/', '/usr/sbin') as $possible_path) {
                         $apt_provides = self::run_apt_file_provides($possible_path . $file);
                         if ($apt_provides != null) {
                             $packages_needed[$file] = $apt_provides;
                             break;
                         }
                     }
                 }
             }
         }
     }
     return $packages_needed;
 }
 private static function net_counter($IFACE = 'en0')
 {
     $net_counter = -1;
     if (pts_client::executable_in_path('netstat') != false) {
         $netstat_lines = explode("\n", shell_exec('netstat -ib 2>&1'));
         $ibytes_index = -1;
         $obytes_index = -1;
         $ibytes = -1;
         $obytes = -1;
         foreach ($netstat_lines as $line) {
             if (strtok($line, ' ') == 'Name') {
                 $ibytes_index = strpos($line, 'Ierrs') + 6;
                 $obytes_index = strpos($line, 'Oerrs') + 6;
                 continue;
             }
             //$netstat_data = pts_strings::trim_explode(' ', $line);
             /*
              * Sample output:
              * Name  Mtu   Network       Address            Ipkts Ierrs     Ibytes    Opkts Oerrs     Obytes  Coll
              * en0   1500  <Link#4>    00:25:4b:c5:95:66    23350     0   19111634    13494     0    1632167     0
              */
             if (strtok($line, ' ') == $IFACE) {
                 $ibytes = strtok(substr($line, $ibytes_index), ' ');
                 $obytes = strtok(substr($line, $obytes_index), ' ');
                 $net_counter = $ibytes + $obytes;
             }
             if ($ibytes != -1 && $obytes != -1) {
                 break;
             }
         }
     }
     return $net_counter;
 }
 public static function run($r)
 {
     $commands = array('detailed_system_info' => null, 'list_available_tests' => null, 'list_available_suites' => null, 'info' => array('xonotic'), 'clone_openbenchmarking_result' => array('1107247-LI-MESACOMMI48'), 'result_file_to_text' => array('1107247-LI-MESACOMMI48'), 'diagnostics' => null, 'dump_possible_options' => null);
     $individual_times = array();
     phodevi::clear_cache();
     $start = microtime(true);
     foreach ($commands as $command => $args) {
         echo PHP_EOL . '### ' . $command . ' ###' . PHP_EOL;
         $individual_times[$command] = array();
         for ($i = 0; $i < 3; $i++) {
             $c_start = microtime(true);
             pts_client::execute_command($command, $args);
             $c_finish = microtime(true);
             array_push($individual_times[$command], $c_finish - $c_start);
         }
     }
     $finish = microtime(true);
     echo PHP_EOL . PHP_EOL . '### OVERALL DATA ###' . PHP_EOL . PHP_EOL;
     echo 'PHP:  ' . PTS_PHP_VERSION . PHP_EOL;
     $longest_c = max(array_map('strlen', array_keys($individual_times)));
     foreach ($individual_times as $component => $times) {
         echo strtoupper($component) . ': ' . str_repeat(' ', $longest_c - strlen($component)) . pts_math::set_precision(round(array_sum($times) / count($times), 3), 3) . ' seconds' . PHP_EOL;
     }
     echo PHP_EOL . 'ELAPSED TIME: ' . str_repeat(' ', $longest_c - strlen('ELAPSED TIME')) . round($finish - $start, 3) . ' seconds';
     echo PHP_EOL . 'PEAK MEMORY USAGE: ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE')) . round(memory_get_peak_usage(true) / 1048576, 3) . ' MB';
     echo PHP_EOL . 'PEAK MEMORY USAGE (emalloc): ' . str_repeat(' ', $longest_c - strlen('PEAK MEMORY USAGE (emalloc)')) . round(memory_get_peak_usage() / 1048576, 3) . ' MB';
     echo PHP_EOL;
 }
 public static function user_home_directory()
 {
     // Gets the system user's home directory
     static $userhome = null;
     if ($userhome == null) {
         if (function_exists('posix_getpwuid') && function_exists('posix_getuid')) {
             $userinfo = posix_getpwuid(posix_getuid());
             $userhome = $userinfo['dir'];
         } else {
             if ($home = pts_client::read_env('HOME')) {
                 $userhome = $home;
             } else {
                 if ($home = pts_client::read_env('HOMEPATH')) {
                     $userhome = pts_client::read_env('HOMEDRIVE') . $home;
                 } else {
                     if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
                         $userhome = PTS_USER_PATH;
                     } else {
                         if (!is_writable('/')) {
                             echo PHP_EOL . 'ERROR: Cannot find home directory.' . PHP_EOL;
                         }
                         $userhome = null;
                     }
                 }
             }
         }
         $userhome = pts_strings::add_trailing_slash($userhome);
     }
     return $userhome;
 }
 public static function run($r)
 {
     $result = $r[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;
     }
     $remove_identifiers = explode(',', pts_user_io::prompt_text_menu('Select the test run(s) to remove', $result_file_identifiers, true));
     $keep_identifiers = array();
     foreach ($result_file_identifiers as $identifier) {
         if (!in_array($identifier, $remove_identifiers)) {
             array_push($keep_identifiers, $identifier);
         }
     }
     foreach (array('test-logs', 'system-logs', 'installation-logs') as $dir_name) {
         foreach ($remove_identifiers as $remove_identifier) {
             if (is_dir(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $remove_identifier)) {
                 pts_file_io::delete(PTS_SAVE_RESULTS_PATH . $r[0] . '/' . $dir_name . '/' . $remove_identifier, null, true);
             }
         }
     }
     $extract_select = new pts_result_merge_select($result, $keep_identifiers);
     $extract_result = pts_merge::merge_test_results($extract_select);
     pts_client::save_test_result($r[0] . '/composite.xml', $extract_result);
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $r[0] . '/index.html');
 }
 public function generate_download_object_list($do_file_checks = true)
 {
     $download_xml_file = $this->test_profile->get_file_download_spec();
     if ($download_xml_file != null) {
         $xml_parser = new pts_test_downloads_nye_XmlReader($download_xml_file);
         $package_url = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/URL');
         $package_md5 = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/MD5');
         $package_sha256 = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/SHA256');
         $package_filename = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/FileName');
         $package_filesize = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/FileSize');
         $package_platform = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/PlatformSpecific');
         $package_architecture = $xml_parser->getXMLArrayValues('PhoronixTestSuite/Downloads/Package/ArchitectureSpecific');
         foreach (array_keys($package_url) as $i) {
             if (!empty($package_platform[$i]) && $do_file_checks) {
                 $platforms = pts_strings::comma_explode($package_platform[$i]);
                 if (!in_array(phodevi::operating_system(), $platforms) && !(phodevi::is_bsd() && in_array('Linux', $platforms) && (pts_client::executable_in_path('kldstat') && strpos(shell_exec('kldstat -n linux 2>&1'), 'linux.ko') != false))) {
                     // This download does not match the operating system
                     continue;
                 }
             }
             if (!empty($package_architecture[$i]) && $do_file_checks) {
                 $architectures = pts_strings::comma_explode($package_architecture[$i]);
                 if (phodevi::cpu_arch_compatible($architectures) == false) {
                     // This download does not match the CPU architecture
                     continue;
                 }
             }
             $this->test_files[] = new pts_test_file_download($package_url[$i], $package_filename[$i], $package_filesize[$i], $package_md5[$i], $package_sha256[$i], $package_platform[$i], $package_architecture[$i]);
         }
     }
 }
 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_selects = array();
     echo PHP_EOL . 'Enter The New Order To Display The New Results, From Left To Right.' . PHP_EOL;
     do {
         $extract_identifier = pts_user_io::prompt_text_menu('Select the test run to be showed next', $result_file_identifiers);
         array_push($extract_selects, new pts_result_merge_select($result, $extract_identifier));
         $old_identifiers = $result_file_identifiers;
         $result_file_identifiers = array();
         foreach ($old_identifiers as $identifier) {
             if ($identifier != $extract_identifier) {
                 array_push($result_file_identifiers, $identifier);
             }
         }
     } while (count($result_file_identifiers) > 0);
     $ordered_result = pts_merge::merge_test_results_array($extract_selects);
     pts_client::save_test_result($args[0] . '/composite.xml', $ordered_result);
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $args[0] . '/index.html');
 }
 public static function set_amd_pcsdb($attribute, $value)
 {
     // Sets a value for AMD's PCSDB, Persistent Configuration Store Database
     if (phodevi::is_ati_graphics() && phodevi::is_linux() && !empty($value)) {
         $DISPLAY = substr(pts_client::read_env("DISPLAY"), 1, 1);
         $info = shell_exec("DISPLAY=:" . $DISPLAY . " aticonfig --set-pcs-val=" . $attribute . "," . $value . "  2>&1");
     }
 }
 public static function run($r)
 {
     $URL = PTS_SAVE_RESULTS_PATH . $r[0];
     if (!is_dir($URL . '/result-graphs/')) {
         pts_client::generate_result_file_graphs($r[0], PTS_SAVE_RESULTS_PATH . $r[0] . '/');
     }
     pts_client::display_web_page($URL . '/index.html', null, false, true);
 }
 public static function run($r)
 {
     // Make sure you're debugging the latest test script...
     pts_test_installer::standard_install($r);
     // For debugging, usually running just once is sufficient, unless FORCE_TIMES_TO_RUN is preset
     pts_client::pts_set_environment_variable('FORCE_TIMES_TO_RUN', 1);
     // Run the test(s) in debug mode
     pts_test_run_manager::standard_run($r, pts_c::debug_mode);
 }
 public static function run($r)
 {
     $result_file = new pts_result_file($r[0]);
     $result_output = pts_result_file_output::result_file_to_csv($result_file);
     // To save the result:
     $file = pts_client::user_home_directory() . $r[0] . '.csv';
     file_put_contents($file, $result_output);
     echo $result_output;
 }
 public function __construct($script, $env_vars = null, $set_current_path = null)
 {
     if (!isset($env_vars['HOME'])) {
         $env_vars['HOME'] = $set_current_path;
     }
     $this->environmental_variables = $env_vars == null ? pts_client::environmental_variables() : array_merge(pts_client::environmental_variables(), $env_vars);
     $this->script_file = is_file($script) ? $script : null;
     $this->var_current_directory = $set_current_path;
 }
 public static function run($r)
 {
     $test_profiles = pts_types::identifiers_to_test_profile_objects($r, true, true);
     if (count($test_profiles) > 0) {
         echo PHP_EOL . 'Downloading Test Files For: ' . implode(' ', $test_profiles);
         pts_test_installer::only_download_test_files($test_profiles, pts_client::read_env('DOWNLOAD_CACHE_LOCATION'));
     } else {
         echo PHP_EOL . 'Nothing found to download.' . PHP_EOL;
     }
 }
 public static function run($r)
 {
     $result_file = pts_types::identifier_to_object($r[0]);
     $upload_url = pts_openbenchmarking::upload_test_result($result_file);
     if ($upload_url) {
         pts_client::display_web_page($upload_url, 'Do you want to view the results on OpenBenchmarking.org', true);
     } else {
         echo PHP_EOL . 'Results Failed To Upload.' . PHP_EOL;
     }
 }
 public static function __run_manager_setup(&$test_run_manager)
 {
     // Verify LINUX_PERF is set, `perf` can be found, and is Linux
     if (getenv('LINUX_PERF') == 0 || !pts_client::executable_in_path('perf') || !phodevi::is_linux()) {
         return pts_module::MODULE_UNLOAD;
         // This module doesn't have anything else to do
     }
     echo PHP_EOL . 'Linux PERF Monitoring Enabled.' . PHP_EOL . PHP_EOL;
     // This module won't be too useful if you're not saving the results to see the graphs
     $test_run_manager->force_results_save();
 }
 public static function run($r)
 {
     $identifier = $r[0];
     $test_xml_files = pts_file_io::glob(PTS_SAVE_RESULTS_PATH . $identifier . '/test-*.xml');
     if (count($test_xml_files) == 0) {
         echo PHP_EOL . 'No test XML data was found.' . PHP_EOL;
         return false;
     }
     pts_client::save_test_result($identifier . '/composite.xml', pts_merge::merge_test_results_array($test_xml_files));
     pts_client::regenerate_graphs($identifier, 'The ' . $identifier . ' result file XML has been rebuilt.');
 }
 public function test_run_start(&$test_run_manager, &$test_result)
 {
     echo $this->print_test_identifier_prefix($test_result);
     if (($test_description = $test_result->get_arguments_description()) != false) {
         echo pts_client::swap_variables($test_description, array('pts_client', 'environmental_variables'));
     } else {
         echo 'Test Starting';
     }
     echo PHP_EOL;
     $this->trial_run_count_current = 0;
     $this->expected_trial_run_count = $test_result->test_profile->get_times_to_run();
 }
 public static function run($args)
 {
     $result_files = array();
     foreach ($args as $id) {
         $xml = pts_openbenchmarking::clone_openbenchmarking_result($id, true);
         if ($xml) {
             $result_file = new pts_result_file($xml);
             pts_client::save_test_result($id . '/composite.xml', $result_file->get_xml(), true);
             echo PHP_EOL . 'Result Saved To: ' . PTS_SAVE_RESULTS_PATH . $id . '/composite.xml' . PHP_EOL;
         }
     }
 }
 public static function run($args)
 {
     $result_files = array();
     foreach ($args as $id) {
         $xml = pts_openbenchmarking::clone_openbenchmarking_result($id, true);
         array_push($result_files, new pts_result_file($xml));
     }
     $writer = new pts_result_file_writer(null);
     pts_merge::merge_test_results_process($writer, $result_files);
     pts_client::save_test_result($args[0] . '/composite.xml', $writer->get_xml(), true);
     echo PHP_EOL . 'Result Saved To: ' . PTS_SAVE_RESULTS_PATH . $args[0] . '/composite.xml' . PHP_EOL;
 }
function pts_define_directories()
{
    // User's home directory for storing results, module files, test installations, etc.
    pts_define('PTS_CORE_PATH', PTS_PATH . 'pts-core/');
    pts_define('PTS_IS_DAEMONIZED_SERVER_PROCESS', PTS_IS_CLIENT && is_dir('/var/lib/') && is_writable('/') ? true : false);
    if (PTS_IS_DAEMONIZED_SERVER_PROCESS) {
        if (!is_dir('/var/cache/phoronix-test-suite/')) {
            mkdir('/var/cache/phoronix-test-suite/');
        }
        pts_define('PTS_USER_PATH', '/var/lib/phoronix-test-suite/');
        pts_define('PTS_CORE_STORAGE', PTS_USER_PATH . 'core.pt2so');
        pts_define('PTS_TEMP_STORAGE', PTS_USER_PATH . 'temp.pt2so');
        pts_define('PTS_MODULE_LOCAL_PATH', PTS_USER_PATH . 'modules/');
        pts_define('PTS_MODULE_DATA_PATH', PTS_USER_PATH . 'modules-data/');
        pts_define('PTS_DOWNLOAD_CACHE_PATH', '/var/cache/phoronix-test-suite/download-cache/');
        pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', '/var/cache/phoronix-test-suite/openbenchmarking.org/');
        pts_define('PTS_TEST_PROFILE_PATH', PTS_USER_PATH . 'test-profiles/');
        pts_define('PTS_TEST_SUITE_PATH', PTS_USER_PATH . 'test-suites/');
        pts_define('PTS_RESULTS_VIEWER_PATH', PTS_CORE_PATH . 'results-viewer/');
    } else {
        if (PTS_IS_CLIENT) {
            pts_define('PTS_USER_PATH', pts_client::user_home_directory() . '.phoronix-test-suite' . DIRECTORY_SEPARATOR);
            pts_define('PTS_CORE_STORAGE', PTS_USER_PATH . 'core.pt2so');
            pts_define('PTS_TEMP_STORAGE', PTS_USER_PATH . 'temp.pt2so');
            pts_define('PTS_MODULE_LOCAL_PATH', PTS_USER_PATH . 'modules/');
            pts_define('PTS_MODULE_DATA_PATH', PTS_USER_PATH . 'modules-data/');
            pts_define('PTS_DOWNLOAD_CACHE_PATH', PTS_USER_PATH . 'download-cache/');
            pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PTS_USER_PATH . 'openbenchmarking.org/');
            pts_define('PTS_TEST_PROFILE_PATH', PTS_USER_PATH . 'test-profiles/');
            pts_define('PTS_TEST_SUITE_PATH', PTS_USER_PATH . 'test-suites/');
            pts_define('PTS_RESULTS_VIEWER_PATH', PTS_CORE_PATH . 'results-viewer/');
        } else {
            if (defined('PTS_STORAGE_PATH')) {
                pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PTS_STORAGE_PATH . 'openbenchmarking.org/');
                pts_define('PTS_TEST_PROFILE_PATH', PTS_STORAGE_PATH . 'test-profiles/');
                pts_define('PTS_TEST_SUITE_PATH', PTS_STORAGE_PATH . 'test-suites/');
            } else {
                if (defined('PATH_TO_PHOROMATIC_STORAGE')) {
                    pts_define('PTS_OPENBENCHMARKING_SCRATCH_PATH', PATH_TO_PHOROMATIC_STORAGE . 'openbenchmarking.org/');
                    pts_define('PTS_TEST_PROFILE_PATH', PATH_TO_PHOROMATIC_STORAGE . 'test-profiles/');
                    pts_define('PTS_TEST_SUITE_PATH', PATH_TO_PHOROMATIC_STORAGE . 'test-suites/');
                }
            }
        }
    }
    // Misc Locations
    pts_define('PTS_MODULE_PATH', PTS_CORE_PATH . 'modules/');
    pts_define('PTS_CORE_STATIC_PATH', PTS_CORE_PATH . 'static/');
    pts_define('PTS_COMMAND_PATH', PTS_CORE_PATH . 'commands/');
    pts_define('PTS_EXDEP_PATH', PTS_CORE_PATH . 'external-test-dependencies/');
    pts_define('PTS_OPENBENCHMARKING_PATH', PTS_CORE_PATH . 'openbenchmarking.org/');
}
 public static function read_hal_property($udi, $key)
 {
     $value = false;
     if (pts_client::executable_in_path('hal-get-property')) {
         foreach (pts_arrays::to_array($udi) as $udi_check) {
             $value = trim(shell_exec('hal-get-property --udi ' . $udi_check . ' --key ' . $key . ' 2> /dev/null'));
             if ($value != false) {
                 break;
             }
         }
     }
     return $value;
 }
 public static function read_acpiconf($desc)
 {
     $info = false;
     if (pts_client::executable_in_path('acpiconf 2> /dev/null')) {
         $output = shell_exec('acpiconf -i0');
         if (($point = strpos($output, $desc . ':')) !== false) {
             $info = substr($output, $point + strlen($desc) + 1);
             $info = substr($info, 0, strpos($info, "\n"));
             $info = trim($info);
         }
     }
     return $info;
 }
 public static function run($r)
 {
     $_REQUEST['force_format'] = 'PNG';
     // Force to PNG renderer
     $_REQUEST['svg_dom_gd_no_interlacing'] = true;
     // Otherwise FPDF will fail
     $tdir = pts_client::create_temporary_directory();
     pts_client::generate_result_file_graphs($r[0], $tdir);
     $result_file = new pts_result_file($r[0]);
     $pdf_file = pts_core::user_home_directory() . $r[0] . '.pdf';
     $pdf_output = pts_result_file_output::result_file_to_pdf($result_file, $pdf_file, 'F');
     echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL;
 }
 public static function run($args)
 {
     $base_file = $args[0];
     do {
         $rand_file = rand(1000, 9999);
         $save_to = 'analyze-' . $rand_file . '/';
     } while (is_dir(PTS_SAVE_RESULTS_PATH . $save_to));
     $save_to .= 'composite.xml';
     // Analyze Results
     $SAVED_RESULTS = pts_merge::generate_analytical_batch_xml($base_file);
     pts_client::save_test_result($save_to, $SAVED_RESULTS);
     echo 'Results Saved To: ' . PTS_SAVE_RESULTS_PATH . $save_to . PHP_EOL . PHP_EOL;
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . dirname($save_to) . '/index.html');
 }
 public static function run($r)
 {
     $result = $r[0];
     if (is_dir(PTS_SAVE_RESULTS_PATH . $result)) {
         do {
             $new_result_name = pts_user_io::prompt_user_input('Enter a new result file name for ' . $result);
             $clean_result_name = pts_test_run_manager::clean_save_name($new_result_name, true);
         } while ($clean_result_name == null || is_dir(PTS_SAVE_RESULTS_PATH . $clean_result_name));
     }
     if (rename(PTS_SAVE_RESULTS_PATH . $result, PTS_SAVE_RESULTS_PATH . $clean_result_name)) {
         echo PHP_EOL . 'Renamed ' . $result . ' to ' . $clean_result_name . '.' . PHP_EOL . PHP_EOL;
     }
     pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $clean_result_name . '/index.html');
 }
 public static function run($r)
 {
     $test_profile = new pts_test_profile($r[0]);
     if ($test_profile->is_test_installed() == false) {
         echo PHP_EOL . 'This test is not installed.' . PHP_EOL;
         return false;
     }
     if (pts_user_io::prompt_bool_input('Are you sure you wish to remove the test ' . $test_profile, false)) {
         pts_client::remove_installed_test($test_profile);
         echo PHP_EOL . $test_profile . ' has been removed.' . PHP_EOL;
     } else {
         echo PHP_EOL;
     }
 }
 public static function __startup()
 {
     // Make sure the file is removed to avoid potential problems if it was leftover from earlier run
     pts_module::remove_file('is_running');
     if (pts_client::executable_in_path('import') == false) {
         echo PHP_EOL . 'ImageMagick must first be installed onto this system!' . PHP_EOL;
         return pts_module::MODULE_UNLOAD;
     }
     if (($interval = pts_module::read_variable('SCREENSHOT_INTERVAL')) > 1 && is_numeric($interval)) {
         self::$screenshot_interval = $interval;
         return true;
     }
     return pts_module::MODULE_UNLOAD;
     self::$existing_screenshots = pts_file_io::glob(pts_module::save_dir() . 'screenshot-*.png');
 }