public static function run($r)
 {
     pts_client::$display->generic_heading('Available Tests');
     $test_count = 0;
     foreach (pts_openbenchmarking::available_tests(false) as $identifier) {
         $repo = substr($identifier, 0, strpos($identifier, '/'));
         $id = substr($identifier, strlen($repo) + 1);
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         if (!in_array(phodevi::operating_system(), $repo_index['tests'][$id]['supported_platforms']) || empty($repo_index['tests'][$id]['title'])) {
             // Don't show unsupported tests
             continue;
         }
         echo sprintf('%-30ls - %-35ls %-9ls', $identifier, $repo_index['tests'][$id]['title'], $repo_index['tests'][$id]['test_type']) . PHP_EOL;
         $test_count++;
     }
     foreach (pts_file_io::glob(PTS_TEST_PROFILE_PATH . 'local/*/test-definition.xml') as $path) {
         $test_profile = new pts_test_profile('local/' . basename(dirname($path)));
         if ($test_profile->get_title() != null && $test_profile->is_supported(false)) {
             echo sprintf('%-30ls - %-35ls %-9ls', $test_profile->get_identifier(), $test_profile->get_title(), $test_profile->get_test_hardware_type()) . PHP_EOL;
             $test_count++;
         }
     }
     if ($test_count == 0) {
         echo PHP_EOL . 'No tests found. Please check that you have Internet connectivity to download test profile data from OpenBenchmarking.org. The Phoronix Test Suite has documentation on configuring the network setup, proxy settings, and PHP network options. Please contact Phoronix Media if you continuing to experience problems.' . PHP_EOL . PHP_EOL;
     }
 }
 public function get_contained_test_profiles()
 {
     $contained = array();
     foreach ($this->tests as $test) {
         $test_profile = new pts_test_profile($test['test']);
         if ($test_profile->is_supported(false)) {
             array_push($contained, $test_profile);
         }
     }
     return $contained;
 }
 public function get_contained_test_profiles()
 {
     $contained = array();
     // read the repo
     $repo_index = pts_openbenchmarking::read_repository_index($this->repo);
     if (isset($repo_index['tests']) && is_array($repo_index['tests'])) {
         foreach ($repo_index['tests'] as $test_identifier => &$test) {
             if (!in_array(phodevi::operating_system(), $test['supported_platforms']) || empty($test['title'])) {
                 // Initial check to not do unsupported tests
                 continue;
             }
             if ($this->is_virtual_os_selector && !in_array($this->virtual, array_map('strtolower', $test['supported_platforms']))) {
                 // Doing a virtual suite of all tests specific to an OS, but this test profile is not supported there
                 continue;
             } else {
                 if ($this->is_virtual_subsystem_selector && $this->virtual != strtolower($test['test_type'])) {
                     // Doing a virtual suite of all tests specific to a test_type, but this test profile is not supported there
                     continue;
                 } else {
                     if ($this->is_virtual_software_type && $this->virtual != strtolower($test['software_type'])) {
                         // Doing a virtual suite of all tests specific to a software_type, but this test profile is not supported there
                         continue;
                     } else {
                         if ($this->is_virtual_internal_tag && !in_array($this->virtual, array_map('strtolower', $test['internal_tags']))) {
                             // Doing a virtual suite of all tests matching an internal tag
                             continue;
                         }
                     }
                 }
             }
             $test_version = array_shift($test['versions']);
             $test_profile = new pts_test_profile($this->repo . '/' . $test_identifier . '-' . $test_version);
             if ($test_profile->get_display_format() != 'BAR_GRAPH' || !in_array($test_profile->get_license(), array('Free', 'Non-Free'))) {
                 // Also ignore these tests
                 continue;
             }
             if ($this->is_virtual_installed && $test_profile->is_test_installed() == false) {
                 // Test is not installed
                 continue;
             }
             if ($test_profile->is_supported(false)) {
                 // All checks passed, add to virtual suite
                 array_push($contained, $test_profile);
                 continue;
             }
         }
     }
     return $contained;
 }
 public static function render_page_process($PATH)
 {
     $local_only = false;
     switch (isset($PATH[0]) ? $PATH[0] : null) {
         case 'locally_available_tests':
             $local_only = true;
             $selected = 'Locally Available Tests';
             $tests = pts_openbenchmarking::available_tests();
             break;
         case 'available_tests':
             $selected = 'Available Tests';
             $tests = pts_openbenchmarking::available_tests();
             break;
         case 'installed_tests':
         default:
             $tests = pts_tests::installed_tests();
             $selected = 'Installed Tests';
             break;
     }
     echo '<h2>';
     $sub_links = array('Available Tests' => 'tests/available_tests', 'Locally Available Tests' => 'tests/locally_available_tests', 'Installed Tests' => 'tests/installed_tests');
     foreach ($sub_links as $txt => $loc) {
         echo '<a href="/?' . $loc . '">' . ($selected == $txt ? '<span class="alt">' : null) . $txt . ($selected == $txt ? '<span class="alt">' : null) . '</a> ';
     }
     echo '</h2>';
     $installed_dependencies = pts_external_dependencies::installed_dependency_names();
     $tests_to_show = array();
     foreach ($tests as $identifier) {
         $test_profile = new pts_test_profile($identifier);
         if (!$test_profile->is_supported(false) || $test_profile->get_title() == null) {
             // Don't show unsupported tests
             continue;
         }
         if ($local_only && count($test_dependencies = $test_profile->get_dependencies()) > 0) {
             $dependencies_met = true;
             foreach ($test_dependencies as $d) {
                 if (!in_array($d, $installed_dependencies)) {
                     $dependencies_met = false;
                     break;
                 }
             }
             if ($dependencies_met == false) {
                 continue;
             }
         }
         if ($local_only && pts_test_install_request::test_files_available_locally($test_profile) == false) {
             continue;
         }
         array_push($tests_to_show, $test_profile);
     }
     echo '<div style="overflow: hidden;">';
     $tests_to_show = array_unique($tests_to_show);
     usort($tests_to_show, array('pts_webui_tests', 'cmp_result_object_sort'));
     $category = null;
     foreach ($tests_to_show as &$test_profile) {
         if ($category != $test_profile->get_test_hardware_type()) {
             $category = $test_profile->get_test_hardware_type();
             echo '</div><a name="' . $category . '"></a>' . PHP_EOL . '<h2>' . $category . '</h2>' . PHP_EOL . '<div style="overflow: hidden;">';
             $popularity_index = pts_openbenchmarking_client::popular_tests(-1, pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'test_type'));
         }
         $last_updated = pts_openbenchmarking_client::read_repository_test_profile_attribute($test_profile, 'last_updated');
         $popularity = array_search($test_profile->get_identifier(false), $popularity_index);
         $secondary_message = null;
         if ($last_updated > time() - 60 * 60 * 24 * 21) {
             // Mark it as newly updated if uploaded in past 3 weeks
             $secondary_message = '<strong>Newly Updated.</strong>';
         } else {
             if ($popularity === 0) {
                 $secondary_message = '<strong>Most Popular.</strong>';
             } else {
                 if ($popularity < 4) {
                     $secondary_message = '<strong>Very Popular.</strong>';
                 }
             }
         }
         echo '<a href="?test/' . $test_profile->get_identifier() . '"><div class="pts_blue_bar"><strong>' . trim($test_profile->get_title() . ' ' . $test_profile->get_app_version()) . '</strong><br /><span style="">~' . max(1, round($test_profile->get_estimated_run_time() / 60)) . ' mins To Run. ' . $secondary_message . '</span></div></a>';
     }
     echo '</div>';
 }