public static function run($r)
 {
     echo PHP_EOL . 'OpenBenchmarking.org Repositories:' . PHP_EOL . PHP_EOL;
     foreach (pts_openbenchmarking::linked_repositories() as $repo) {
         if ($repo == 'local') {
             // Skip local since it's a fake repository
             continue;
         }
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         $generated_time = date('F d H:i', $repo_index['main']['generated']);
         $tab = '    ';
         foreach (array('tests', 'suites') as $t) {
             echo PHP_EOL . str_repeat('=', 40) . PHP_EOL . strtoupper($repo . ' ' . $t) . PHP_EOL . 'Generated: ' . $generated_time . PHP_EOL . str_repeat('=', 40) . PHP_EOL . PHP_EOL;
             foreach ($repo_index[$t] as $identifier => $test) {
                 echo 'Identifier: ' . $identifier . PHP_EOL;
                 foreach ($test as $i => $j) {
                     echo sprintf('%-22ls', $i) . ': ';
                     if (is_array($j)) {
                         echo implode(', ', $j);
                     } else {
                         echo $j;
                     }
                     echo PHP_EOL;
                 }
                 echo PHP_EOL;
             }
         }
     }
 }
 public static function available_virtual_suites()
 {
     $virtual_suites = array();
     $possible_identifiers = array_merge(array('all', 'installed'), array_map('strtolower', self::available_operating_systems()), array_map('strtolower', pts_types::subsystem_targets()), array_map('strtolower', pts_types::test_profile_software_types()));
     foreach (pts_openbenchmarking::linked_repositories() as $repo) {
         $repo_identifiers = array_merge($possible_identifiers, self::tags_in_repo($repo));
         foreach ($repo_identifiers as $id) {
             $virt_suite = $repo . '/' . $id;
             if (self::is_virtual_suite($virt_suite)) {
                 $virtual_suite = pts_types::identifier_to_object($virt_suite);
                 if ($virtual_suite instanceof pts_virtual_test_suite) {
                     array_push($virtual_suites, $virtual_suite);
                 }
             }
         }
     }
     return $virtual_suites;
 }
 public static function run($r)
 {
     echo PHP_EOL . 'Linked OpenBenchmarking.org Repositories:' . PHP_EOL . PHP_EOL;
     foreach (pts_openbenchmarking::linked_repositories() as $repo) {
         if ($repo == 'local') {
             // Skip local since it's a fake repository
             continue;
         }
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         $test_count = count($repo_index['tests']);
         $suite_count = count($repo_index['suites']);
         $generated_time = date('F d H:i', $repo_index['main']['generated']);
         echo sprintf('    REPO: %-20ls WEB: %-35ls' . PHP_EOL, $repo, 'http://openbenchmarking.org/user/' . $repo);
         echo sprintf('        LAST GENERATED:  %-3ls' . PHP_EOL, $generated_time);
         echo sprintf('        TEST COUNT:      %-3ls    SUITE COUNT: %-3ls' . PHP_EOL, $test_count, $suite_count);
         echo PHP_EOL;
     }
 }
 public static function run($r)
 {
     pts_client::$display->generic_heading('Recently Updated OpenBenchmarking.org Tests');
     $recently_updated = array();
     foreach (pts_openbenchmarking::linked_repositories() as $repo) {
         if ($repo == 'local') {
             // Skip local since it's a fake repository
             continue;
         }
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         $changes[$repo] = pts_openbenchmarking_client::fetch_repository_changelog($repo);
         if (isset($repo_index['tests']) && is_array($repo_index['tests'])) {
             foreach (array_keys($repo_index['tests']) as $identifier) {
                 if ($repo_index['tests'][$identifier]['last_updated'] > time() - 90 * 86400) {
                     $recently_updated[$repo . '/' . $identifier] = $repo_index['tests'][$identifier];
                 }
             }
         }
     }
     if (count($recently_updated) > 0) {
         // sort by date
         uasort($recently_updated, array('openbenchmarking_changes', 'compare_time_stamps'));
         // so that tests are shown from newest to oldest
         $recently_updated = array_reverse($recently_updated);
         $longest_identifier_length = array_keys($recently_updated);
         $longest_identifier_length = strlen(pts_strings::find_longest_string($longest_identifier_length)) + 1;
         foreach ($recently_updated as $test_profile => $repo_data) {
             echo sprintf('%-' . $longest_identifier_length . 'ls - %-35ls', $test_profile, $repo_data['title']) . PHP_EOL;
             $br = explode('/', $test_profile);
             if (isset($changes[$br[0]]['tests'][$br[1]]['changes'])) {
                 foreach ($changes[$br[0]]['tests'][$br[1]]['changes'] as $test_profile_version => $data) {
                     echo 'v' . $test_profile_version . ' [' . date('d M Y', $data['last_updated']) . ']' . PHP_EOL;
                     echo '  - ' . $data['commit_description'] . PHP_EOL;
                 }
             } else {
                 echo 'Last Updated: ' . date('d F Y', $repo_data['last_updated']) . PHP_EOL;
             }
             echo PHP_EOL;
             // $repo_data['test_type']
         }
     } else {
         echo PHP_EOL . 'No updated tests were found.' . PHP_EOL;
     }
 }
 public static function tests_available()
 {
     $test_count = 0;
     foreach (pts_openbenchmarking::linked_repositories() as $repo) {
         $repo_index = pts_openbenchmarking::read_repository_index($repo);
         if (isset($repo_index['tests']) && is_array($repo_index['tests'])) {
             $test_count += count($repo_index['tests']);
         }
     }
     return $test_count;
 }
Esempio n. 6
0
 public static function invalid_command_helper($passed_args)
 {
     $showed_recent_results = self::recently_saved_results();
     if (!empty($passed_args)) {
         $arg_soundex = soundex($passed_args);
         $similar_tests = array();
         foreach (pts_openbenchmarking::linked_repositories() as $repo) {
             $repo_index = pts_openbenchmarking::read_repository_index($repo);
             foreach (array('tests', 'suites') as $type) {
                 if (isset($repo_index[$type]) && is_array($repo_index[$type])) {
                     foreach (array_keys($repo_index[$type]) as $identifier) {
                         if (soundex($identifier) == $arg_soundex) {
                             array_push($similar_tests, array('- ' . $repo . '/' . $identifier, ' [' . ucwords(substr($type, 0, -1)) . ']'));
                         }
                     }
                 }
             }
         }
         foreach (pts_client::saved_test_results() as $result) {
             if (soundex($result) == $arg_soundex) {
                 array_push($similar_tests, array('- ' . $result, ' [Test Result]'));
             }
         }
         if (count($similar_tests) > 0) {
             echo 'Possible Suggestions:' . PHP_EOL;
             if (isset($similar_tests[12])) {
                 // lots of tests... trim it down
                 $similar_tests = array_rand($similar_tests, 12);
             }
             echo pts_user_io::display_text_table($similar_tests) . PHP_EOL . PHP_EOL;
         }
     }
     if ($showed_recent_results == false) {
         echo 'See available tests to run by visiting OpenBenchmarking.org or running:' . PHP_EOL . PHP_EOL;
         echo '    phoronix-test-suite list-tests' . PHP_EOL . PHP_EOL;
         echo 'Tests can be installed by running:' . PHP_EOL . PHP_EOL;
         echo '    phoronix-test-suite install <test-name>' . PHP_EOL;
     }
 }