public static function init()
 {
     self::$flags = 0;
     self::$os_identifier_sha1 = sha1(phodevi::read_property('system', 'vendor-identifier'));
     self::$is_live_cd = 1 << 1;
     self::$no_network_communication = 1 << 2;
     self::$no_openbenchmarking_reporting = 1 << 3;
     self::$user_agreement_skip = 1 << 4;
     self::$skip_md5_checks = 1 << 5;
     self::$remove_test_on_completion = 1 << 6;
     self::$no_phodevi_cache = 1 << 7;
     self::$no_external_dependencies = 1 << 8;
     self::$upload_to_openbenchmarking = 1 << 9;
     switch (self::$os_identifier_sha1) {
         case 'b28d6a7148b34595c5b397dfcf5b12ac7932b3dc':
             // Moscow 2011-04 client
             self::$flags = self::$is_live_cd | self::$no_network_communication | self::$no_openbenchmarking_reporting | self::$user_agreement_skip | self::$skip_md5_checks | self::$remove_test_on_completion;
             break;
     }
     if (pts_client::read_env('NO_FILE_HASH_CHECKS') != false || pts_client::read_env('NO_MD5_CHECKS') != false) {
         self::$flags |= self::$skip_md5_checks;
     }
     if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/RemoveTestInstallOnCompletion', 'FALSE')) {
         self::$flags |= self::$remove_test_on_completion;
     }
     if (pts_config::read_bool_config('PhoronixTestSuite/Options/Testing/AlwaysUploadResultsToOpenBenchmarking', 'FALSE')) {
         self::$flags |= self::$upload_to_openbenchmarking;
     }
     if (pts_client::read_env('NO_PHODEVI_CACHE') != false) {
         self::$flags |= self::$no_phodevi_cache;
     }
     if (pts_client::read_env('NO_EXTERNAL_DEPENDENCIES') != false || pts_client::read_env('SKIP_EXTERNAL_DEPENDENCIES') == 1) {
         // NO_EXTERNAL_DEPENDENCIES was deprecated in PTS 3.6 and replaced by more versatile SKIP_EXTERNAL_DEPENDENCIES
         self::$flags |= self::$no_external_dependencies;
     }
 }
 public function call_test_runs()
 {
     // Create a lock
     $lock_path = pts_client::temporary_directory() . '/phoronix-test-suite.active';
     pts_client::create_lock($lock_path);
     if ($this->pre_run_message != null) {
         pts_client::$display->display_interrupt_message($this->pre_run_message);
     }
     // Hook into the module framework
     self::$test_run_process_active = true;
     pts_module_manager::module_process('__pre_run_process', $this);
     pts_file_io::unlink(PTS_USER_PATH . 'halt-testing');
     pts_file_io::unlink(PTS_USER_PATH . 'skip-test');
     $continue_test_flag = true;
     $tests_to_run_count = $this->get_test_count();
     pts_client::$display->test_run_process_start($this);
     $total_loop_count = ($t = pts_client::read_env('TOTAL_LOOP_COUNT')) && is_numeric($t) && $t > 0 ? $t : 1;
     $total_loop_time = ($t = pts_client::read_env('TOTAL_LOOP_TIME')) && is_numeric($t) && $t > 9 ? $t * 60 : -1;
     $loop_end_time = $total_loop_time != -1 ? time() + $total_loop_time : false;
     $this->test_run_count = $tests_to_run_count * $total_loop_count;
     for ($loop = 1; $loop <= $total_loop_count && $continue_test_flag; $loop++) {
         for ($i = 0; $i < $tests_to_run_count && $continue_test_flag; $i++) {
             $this->test_run_pos = $i;
             $continue_test_flag = $this->process_test_run_request($i);
             if (pts_flags::remove_test_on_completion()) {
                 // Remove the installed test if it's no longer needed in this run queue
                 $this_test_profile_identifier = $this->get_test_to_run($this->test_run_pos)->test_profile->get_identifier();
                 $still_in_queue = false;
                 for ($j = $this->test_run_pos + 1; $j < $tests_to_run_count && $still_in_queue == false; $j++) {
                     if ($this->get_test_to_run($j)->test_profile->get_identifier() == $this_test_profile_identifier) {
                         $still_in_queue = true;
                     }
                 }
                 if ($still_in_queue == false) {
                     pts_client::remove_installed_test($this->get_test_to_run($this->test_run_pos)->test_profile);
                 }
             }
             if ($loop_end_time) {
                 if (time() > $loop_end_time) {
                     $continue_test_flag = false;
                 } else {
                     if ($this->test_run_count == $i + 1) {
                         // There's still time remaining so increase the run count....
                         $this->test_run_count += $tests_to_run_count;
                     }
                 }
             }
         }
     }
     pts_file_io::unlink(PTS_SAVE_RESULTS_PATH . $this->get_file_name() . '/active.xml');
     foreach ($this->tests_to_run as &$run_request) {
         // Remove cache shares
         foreach (pts_file_io::glob($run_request->test_profile->get_install_dir() . 'cache-share-*.pt2so') as $cache_share_file) {
             unlink($cache_share_file);
         }
     }
     if ($this->post_run_message != null) {
         pts_client::$display->display_interrupt_message($this->post_run_message);
     }
     self::$test_run_process_active = -1;
     pts_module_manager::module_process('__post_run_process', $this);
     pts_client::release_lock($lock_path);
     // Report any tests that failed to properly run
     if (pts_c::$test_flags ^ pts_c::batch_mode || pts_c::$test_flags & pts_c::debug_mode || $this->get_test_count() > 3) {
         if (count($this->failed_tests_to_run) > 0) {
             echo PHP_EOL . PHP_EOL . 'The following tests failed to properly run:' . PHP_EOL . PHP_EOL;
             foreach ($this->failed_tests_to_run as &$run_request) {
                 echo "\t- " . $run_request->test_profile->get_identifier() . ($run_request->get_arguments_description() != null ? ': ' . $run_request->get_arguments_description() : null) . PHP_EOL;
             }
             echo PHP_EOL;
         }
     }
 }