Пример #1
0
 public static function run($args)
 {
     $save_name = $args[0];
     $result_file = new pts_result_file($args[0]);
     $system_identifiers = $result_file->get_system_identifiers();
     $test_positions = array();
     $pos = 0;
     foreach ($result_file->get_result_objects() as $result_object) {
         $this_result_object_identifiers = $result_object->test_result_buffer->get_identifiers();
         foreach ($system_identifiers as $system_identifier) {
             if (!in_array($system_identifier, $this_result_object_identifiers)) {
                 if (!isset($test_positions[$system_identifier])) {
                     $test_positions[$system_identifier] = array();
                 }
                 array_push($test_positions[$system_identifier], $pos);
             }
         }
         $pos++;
     }
     $incomplete_identifiers = array_keys($test_positions);
     if (count($incomplete_identifiers) == 0) {
         echo PHP_EOL . 'It appears that there are no incomplete test results within this saved file.' . PHP_EOL . PHP_EOL;
         return false;
     }
     $selected = pts_user_io::prompt_text_menu('Select which incomplete test run you would like to finish', $incomplete_identifiers);
     // Now run it
     if (pts_test_run_manager::initial_checks($args[0]) == false) {
         return false;
     }
     $test_run_manager = new pts_test_run_manager(pts_c::is_recovering);
     // Load the tests to run
     if ($test_run_manager->load_result_file_to_run($save_name, $selected, $result_file, $test_positions[$selected]) == false) {
         return false;
     }
     // Run the actual tests
     $test_run_manager->pre_execution_process();
     $test_run_manager->call_test_runs();
     $test_run_manager->post_execution_process();
 }
 public function run_benchmark($user, $args)
 {
     $json_queue = json_decode(base64_decode($args), true);
     $json['pts']['msg']['name'] = 'run_benchmark_queue';
     if (!isset($json_queue['tests']) || count($json_queue['tests']) == 0) {
         $json['pts']['msg']['error'] = 'No tests in the queue.';
     } else {
         if (!isset($json_queue['title']) || $json_queue['title'] == null) {
             $json['pts']['msg']['error'] = 'No test title/name provided.';
         } else {
             if (!isset($json_queue['identifier']) || $json_queue['identifier'] == null) {
                 $json['pts']['msg']['error'] = 'No test identifier provided.';
             } else {
                 $json['pts']['msg']['go'] = 'Benchmarking.';
             }
         }
     }
     $this->send_json_data($user->socket, $json);
     if (isset($json['pts']['msg']['error']) && $json['pts']['msg']['error'] != null) {
         exit(1);
     }
     pts_client::$display = new pts_websocket_display_mode();
     pts_client::$display->set_web_socket($this, $user->id);
     $virtual_test_queue = array();
     $virtual_test_queue[0] = new pts_virtual_test_queue();
     foreach ($json_queue['tests'] as $test) {
         $virtual_test_queue[0]->add_to_queue($test['test_profile_id'], $test['test_options_title'], $test['test_options_value']);
     }
     $test_run_manager = new pts_test_run_manager(false, true);
     pts_test_installer::standard_install($virtual_test_queue, false, true);
     if ($test_run_manager->initial_checks($virtual_test_queue) == false) {
         $j['pts']['msg']['name'] = 'benchmark_state';
         $j['pts']['msg']['current_state'] = 'failed';
         $j['pts']['msg']['error'] = 'Failed to install test.';
         $this->send_json_data($user->socket, $j);
         exit(1);
     }
     if ($test_run_manager->load_tests_to_run($virtual_test_queue)) {
         // SETUP
         $test_run_manager->auto_upload_to_openbenchmarking();
         pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', true);
         $test_run_manager->auto_save_results($json_queue['title'], $json_queue['identifier'], $json_queue['description'], true);
         // BENCHMARK
         $test_run_manager->pre_execution_process();
         $test_run_manager->call_test_runs();
         $test_run_manager->post_execution_process();
         $j['pts']['msg']['name'] = 'benchmark_state';
         $j['pts']['msg']['current_state'] = 'complete';
         $j['pts']['msg']['result_title'] = $test_run_manager->get_title();
         $j['pts']['msg']['result_file_name'] = $test_run_manager->get_file_name();
         $j['pts']['msg']['result_identifier'] = $test_run_manager->get_results_identifier();
         $j['pts']['msg']['result_url'] = $test_run_manager->get_results_url();
         $this->send_json_data($user->socket, $j);
     }
     // exit(0);
 }
 public static function run($r)
 {
     pts_client::$display->generic_heading('Random Test Execution');
     $allow_new_tests_to_be_installed = pts_user_io::prompt_bool_input('Allow new tests to be installed', true);
     $allow_new_dependencies_to_be_installed = $allow_new_tests_to_be_installed ? pts_user_io::prompt_bool_input('Allow new test external dependencies to be installed', false) : false;
     $limit_test_subsystem = pts_user_io::prompt_bool_input('Limit tests to a given subsystem', false);
     $limit_test_subsystem = $limit_test_subsystem ? pts_user_io::prompt_text_menu('Select subsystem(s) to test', pts_types::subsystem_targets(), true) : false;
     $upload_to_openbenchmarking = pts_user_io::prompt_bool_input('Auto-upload test results to OpenBenchmarking.org', true);
     while (1) {
         $to_test = array();
         if ($limit_test_subsystem) {
             foreach (explode(',', $limit_test_subsystem) as $test_type) {
                 $tests = pts_openbenchmarking_client::popular_tests(-1, $test_type);
                 $to_test = array_merge($to_test, $tests);
             }
             if (empty($to_test)) {
                 pts_client::$display->generic_sub_heading('No tests could be found to run.');
                 return false;
             }
             shuffle($to_test);
             $to_test = array_slice($to_test, 0, rand(1, 12));
         } else {
             if (rand(1, 6) == 2) {
                 $ob_ids = pts_openbenchmarking_client::popular_openbenchmarking_results();
                 $ob_type = rand(0, 1) == 1 ? 'recent_popular_results' : 'recent_results';
                 if (isset($ob_ids[$ob_type]) && !empty($ob_ids[$ob_type])) {
                     shuffle($ob_ids[$ob_type]);
                     $to_test = array(array_pop($ob_ids[$ob_type]));
                 }
             }
         }
         if (empty($to_test)) {
             // Randomly pick some installed tests
             $installed_tests = pts_tests::installed_tests();
             if ($installed_tests > 3) {
                 shuffle($installed_tests);
                 $to_test = array_slice($installed_tests, 0, rand(1, 8));
             }
             if (!isset($to_test[2]) && $allow_new_tests_to_be_installed) {
                 $available_tests = pts_openbenchmarking::available_tests();
                 shuffle($available_tests);
                 $to_test = array_merge($to_test, array_slice($available_tests, 0, rand(1, 10)));
             }
         }
         if (empty($to_test)) {
             pts_client::$display->generic_sub_heading('No tests could be found to run.');
             return false;
         }
         echo PHP_EOL;
         pts_client::$display->generic_sub_heading('Tests To Run: ' . implode(', ', $to_test));
         // QUERY FROM OB
         $random_titles = array(phodevi::read_property('cpu', 'model') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Benchmarks', phodevi::read_property('system', 'operating-system') . ' Performance', phodevi::read_property('cpu', 'model') . ' Performance', phodevi::read_property('cpu', 'model') . ' + ' . phodevi::read_property('gpu', 'model') . ' + ' . phodevi::read_property('motherboard', 'identifier'), phodevi::read_property('motherboard', 'identifier') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('cpu', 'model') . ' On ' . phodevi::read_property('system', 'operating-system'), phodevi::read_property('system', 'kernel') . ' + ' . phodevi::read_property('system', 'operating-system') . ' Tests');
         shuffle($random_titles);
         $title = array_pop($random_titles);
         if ($limit_test_subsystem) {
             $subsystems_to_test = explode(',', $limit_test_subsystem);
             $subsystems_to_avoid = array_diff(pts_types::subsystem_targets(), $subsystems_to_test);
             pts_client::pts_set_environment_variable('SKIP_TESTING_SUBSYSTEMS', implode(',', $subsystems_to_avoid));
         }
         if ($allow_new_tests_to_be_installed) {
             pts_test_installer::standard_install($to_test, false, true, $allow_new_dependencies_to_be_installed);
         }
         $batch_mode_settings = array('UploadResults' => false, 'SaveResults' => true, 'PromptForTestDescription' => false, 'RunAllTestCombinations' => false, 'PromptSaveName' => false, 'PromptForTestIdentifier' => false, 'OpenBrowser' => false);
         if ($upload_to_openbenchmarking) {
             $batch_mode_settings['UploadResults'] = true;
             pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', true);
         }
         pts_test_run_manager::set_batch_mode($batch_mode_settings);
         $test_run_manager = new pts_test_run_manager($batch_mode_settings, 2);
         if ($test_run_manager->initial_checks($to_test) != false) {
             if ($test_run_manager->load_tests_to_run($to_test)) {
                 // SETUP
                 $test_run_manager->auto_save_results($title, null, 'Various open-source benchmarks by the ' . pts_core::program_title(true) . '.', true);
                 $test_run_manager->auto_generate_results_identifier();
                 echo PHP_EOL;
                 pts_client::$display->generic_sub_heading('Result File: ' . $test_run_manager->get_file_name());
                 pts_client::$display->generic_sub_heading('Result Identifier: ' . $test_run_manager->get_results_identifier());
                 // BENCHMARK
                 $test_run_manager->pre_execution_process();
                 $test_run_manager->call_test_runs();
                 $test_run_manager->post_execution_process();
                 pts_client::remove_saved_result_file($test_run_manager->get_file_name());
             }
         }
         echo PHP_EOL;
         sleep(30);
     }
 }
Пример #4
0
    public static function run_matisk($args)
    {
        echo PHP_EOL . 'MATISK For The Phoronix Test Suite' . PHP_EOL;
        if (!isset($args[0]) || !is_file($args[0])) {
            echo PHP_EOL . 'You must specify a MATISK INI file to load.' . PHP_EOL . PHP_EOL;
            return false;
        }
        self::$matisk_config_dir = dirname($args[0]) . '/';
        pts_file_io::mkdir(pts_module::save_dir());
        $ini = parse_ini_file($args[0], true);
        foreach (self::$ini_struct as $section => $items) {
            foreach ($items as $key => $r) {
                if (is_array($r) && !isset($ini[$section][$key])) {
                    $ini[$section][$key] = $r[0];
                }
            }
        }
        // Checks
        if (pts_test_suite::is_suite($ini['workload']['suite']) == false) {
            // See if the XML suite-definition was just tossed into the same directory
            if (($xml_file = self::find_file($ini['workload']['suite'] . '.xml')) !== false) {
                pts_file_io::mkdir(PTS_TEST_SUITE_PATH . 'local/' . $ini['workload']['suite']);
                copy($xml_file, PTS_TEST_SUITE_PATH . 'local/' . $ini['workload']['suite'] . '/suite-definition.xml');
            }
            if (pts_test_suite::is_suite($ini['workload']['suite']) == false) {
                echo PHP_EOL . 'A test suite must be specified to execute. If a suite needs to be constructed, run: ' . PHP_EOL . 'phoronix-test-suite build-suite' . PHP_EOL . PHP_EOL;
                return false;
            }
        }
        if ($ini['set_context']['external_contexts'] != null) {
            switch ($ini['set_context']['external_contexts_delimiter']) {
                case 'EOL':
                case '':
                    $ini['set_context']['external_contexts_delimiter'] = PHP_EOL;
                    break;
                case 'TAB':
                    $ini['set_context']['external_contexts_delimiter'] = "\t";
                    break;
            }
            if ($ff = self::find_file($ini['set_context']['external_contexts'])) {
                if (is_executable($ff)) {
                    $ini['set_context']['context'] = shell_exec($ff . ' 2> /dev/null');
                } else {
                    $ini['set_context']['context'] = file_get_contents($ff);
                }
            } else {
                // Hopefully it's a command to execute then...
                $ini['set_context']['context'] = shell_exec($ini['set_context']['external_contexts'] . ' 2> /dev/null');
            }
            $ini['set_context']['context'] = explode($ini['set_context']['external_contexts_delimiter'], $ini['set_context']['context']);
        } else {
            if ($ini['set_context']['context'] != null && !is_array($ini['set_context']['context'])) {
                $ini['set_context']['context'] = array($ini['set_context']['context']);
            }
        }
        if (is_array($ini['set_context']['context']) && count($ini['set_context']['context']) > 0) {
            foreach ($ini['set_context']['context'] as $i => $context) {
                if ($context == null) {
                    unset($ini['set_context']['context'][$i]);
                }
            }
            // Context testing
            if (count($ini['set_context']['context']) > 0 && $ini['set_context']['pre_run'] == null && $ini['set_context']['pre_install'] == null) {
                echo PHP_EOL . 'The pre_run or pre_install set_context fields must be set in order to set the system\'s context.' . PHP_EOL;
                return false;
            }
            if ($ini['set_context']['reverse_context_order']) {
                $ini['set_context']['context'] = array_reverse($ini['set_context']['context']);
            }
        }
        if (pts_strings::string_bool($ini['workload']['save_results'])) {
            if ($ini['workload']['save_name'] == null) {
                echo PHP_EOL . 'The save_name field cannot be left empty when saving the test results.' . PHP_EOL;
                return false;
            }
            /*
            if($ini['workload']['result_identifier'] == null)
            {
            	echo PHP_EOL . 'The result_identifier field cannot be left empty when saving the test results.' . PHP_EOL;
            	return false;
            }
            */
        }
        if (!empty($ini['environmental_variables']) && is_array($ini['environmental_variables'])) {
            foreach ($ini['environmental_variables'] as $key => $value) {
                putenv(trim($key) . '=' . trim($value));
            }
        }
        if (empty($ini['set_context']['context'])) {
            $ini['set_context']['context'] = array($ini['workload']['result_identifier']);
        }
        if (pts_strings::string_bool($ini['set_context']['log_context_outputs'])) {
            pts_file_io::mkdir(pts_module::save_dir() . $ini['workload']['save_name']);
        }
        $spent_context_file = pts_module::save_dir() . $ini['workload']['save_name'] . '.spent-contexts';
        if (!is_file($spent_context_file)) {
            touch($spent_context_file);
        } else {
            // If recovering from an existing run, don't rerun contexts that were already executed
            $spent_contexts = pts_file_io::file_get_contents($spent_context_file);
            $spent_contexts = explode(PHP_EOL, $spent_contexts);
            foreach ($spent_contexts as $sc) {
                if (($key = array_search($sc, $ini['set_context']['context'])) !== false) {
                    unset($ini['set_context']['context'][$key]);
                }
            }
        }
        if ($ini['set_context']['reboot_support'] && phodevi::is_linux()) {
            // In case a set-context involves a reboot, auto-recover
            $xdg_config_home = is_dir('/etc/xdg/autostart') && is_writable('/etc/xdg/autostart') ? '/etc/xdg/autostart' : pts_client::read_env('XDG_CONFIG_HOME');
            if ($xdg_config_home == false) {
                $xdg_config_home = pts_client::user_home_directory() . '.config';
            }
            if ($xdg_config_home != false && is_dir($xdg_config_home)) {
                $autostart_dir = $xdg_config_home . '/autostart/';
                pts_file_io::mkdir($xdg_config_home . '/autostart/');
            }
            file_put_contents($xdg_config_home . '/autostart/phoronix-test-suite-matisk.desktop', '
[Desktop Entry]
Name=Phoronix Test Suite Matisk Recovery
GenericName=Phoronix Test Suite
Comment=Matisk Auto-Recovery Support
Exec=gnome-terminal -e \'phoronix-test-suite matisk ' . $args[0] . '\'
Icon=phoronix-test-suite
Type=Application
Encoding=UTF-8
Categories=System;Monitor;');
        }
        if ($ini['installation']['block_phodevi_caching']) {
            // Block Phodevi caching if changing out system components and there is a chance one of the strings of changed contexts might be cached (e.g. OpenGL user-space driver)
            phodevi::$allow_phodevi_caching = false;
        }
        if (phodevi::system_uptime() < 60) {
            echo PHP_EOL . 'Sleeping 45 seconds while waiting for the system to settle...' . PHP_EOL;
            sleep(45);
        }
        self::$ini = $ini;
        $total_context_count = count(self::$ini['set_context']['context']);
        while (($context = array_shift(self::$ini['set_context']['context'])) !== null) {
            echo PHP_EOL . ($total_context_count - count(self::$ini['set_context']['context'])) . ' of ' . $total_context_count . ' in test execution queue [' . $context . ']' . PHP_EOL . PHP_EOL;
            self::$context = $context;
            if (pts_strings::string_bool(self::$ini['installation']['install_check']) || $ini['set_context']['pre_install'] != null) {
                self::process_user_config_external_hook_process('pre_install');
                $force_install = false;
                $no_prompts = true;
                if (pts_strings::string_bool(self::$ini['installation']['force_install'])) {
                    $force_install = true;
                }
                if (self::$ini['installation']['external_download_cache'] != null) {
                    pts_test_install_manager::add_external_download_cache(self::$ini['installation']['external_download_cache']);
                }
                // Do the actual test installation
                pts_test_installer::standard_install(self::$ini['workload']['suite'], $force_install, $no_prompts);
                self::process_user_config_external_hook_process('post_install');
            }
            $batch_mode = false;
            $auto_mode = true;
            $test_run_manager = new pts_test_run_manager($batch_mode, $auto_mode);
            if ($test_run_manager->initial_checks(self::$ini['workload']['suite']) == false) {
                return false;
            }
            if (self::$skip_test_set == false) {
                self::process_user_config_external_hook_process('pre_run');
                // Load the tests to run
                if ($test_run_manager->load_tests_to_run(self::$ini['workload']['suite']) == false) {
                    return false;
                }
                // Save results?
                $result_identifier = $ini['workload']['result_identifier'];
                if ($result_identifier == null) {
                    $result_identifier = '$MATISK_CONTEXT';
                }
                // Allow $MATIISK_CONTEXT as a valid user variable to pass it...
                $result_identifier = str_replace('$MATISK_CONTEXT', self::$context, $result_identifier);
                $test_run_manager->set_save_name(self::$ini['workload']['save_name']);
                $test_run_manager->set_results_identifier($result_identifier);
                $test_run_manager->set_description(self::$ini['workload']['description']);
                // Don't upload results unless it's the last in queue where the context count is now 0
                $test_run_manager->auto_upload_to_openbenchmarking(count(self::$ini['set_context']['context']) == 0 && self::$ini['general']['upload_to_openbenchmarking']);
                // Run the actual tests
                $test_run_manager->pre_execution_process();
                $test_run_manager->call_test_runs();
                $test_run_manager->post_execution_process();
            }
            self::$skip_test_set = false;
            file_put_contents($spent_context_file, self::$context . PHP_EOL, FILE_APPEND);
            pts_file_io::unlink(pts_module::save_dir() . self::$context . '.last-call');
            self::process_user_config_external_hook_process('post_run');
        }
        unlink($spent_context_file);
        isset($xdg_config_home) && pts_file_io::unlink($xdg_config_home . '/autostart/phoronix-test-suite-matisk.desktop');
    }
Пример #5
0
 public static function user_system_process()
 {
     $last_communication_minute = date('i');
     $communication_attempts = 0;
     static $current_hw = null;
     static $current_sw = null;
     if (define('PHOROMATIC_START', true)) {
         echo PHP_EOL . 'Registering Status With Phoromatic Server @ ' . date('H:i:s') . PHP_EOL;
         $times_tried = 0;
         do {
             if ($times_tried > 0) {
                 echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
                 sleep(60);
             }
             $update_sd = phoromatic::update_system_details();
             $times_tried++;
         } while (!$update_sd && $times_tried < 5);
         if (!$update_sd) {
             echo 'Server connection still failed. Exiting...' . PHP_EOL;
             return false;
         }
         $current_hw = phodevi::system_hardware(true);
         $current_sw = phodevi::system_software(true);
         echo PHP_EOL . 'Idling 30 seconds for system to settle...' . PHP_EOL;
         sleep(30);
     }
     do {
         $exit_loop = false;
         echo PHP_EOL . 'Checking Status From Phoromatic Server @ ' . date('H:i:s');
         if ($last_communication_minute == date('i') && $communication_attempts > 2) {
             // Something is wrong, Phoromatic shouldn't be communicating with server more than three times a minute
             $response = M_PHOROMATIC_RESPONSE_IDLE;
         } else {
             $server_response = phoromatic::upload_to_remote_server(array('r' => 'status_check'));
             $xml_parser = new nye_XmlReader($server_response);
             $response = $xml_parser->getXMLValue(M_PHOROMATIC_GEN_RESPONSE);
             if (date('i') != $last_communication_minute) {
                 $last_communication_minute = date('i');
                 $communication_attempts = 0;
             }
             $communication_attempts++;
         }
         echo ' [' . $response . ']' . PHP_EOL;
         switch ($response) {
             case M_PHOROMATIC_RESPONSE_RUN_TEST:
                 $test_flags = pts_c::auto_mode | pts_c::recovery_mode;
                 do {
                     $suite_identifier = 'phoromatic-' . rand(1000, 9999);
                 } while (is_file(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'));
                 file_put_contents(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml', $server_response);
                 $phoromatic_schedule_id = $xml_parser->getXMLValue(M_PHOROMATIC_ID);
                 $phoromatic_results_identifier = $xml_parser->getXMLValue(M_PHOROMATIC_SYS_NAME);
                 $phoromatic_trigger = $xml_parser->getXMLValue(M_PHOROMATIC_TRIGGER);
                 if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_RUN_INSTALL_COMMAND, M_PHOROMATIC_RESPONSE_TRUE))) {
                     phoromatic::set_user_context($xml_parser->getXMLValue(M_PHOROMATIC_SET_CONTEXT_PRE_INSTALL), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
                     pts_client::set_test_flags($test_flags);
                     pts_test_installer::standard_install($suite_identifier);
                 }
                 phoromatic::set_user_context($xml_parser->getXMLValue(M_PHOROMATIC_SET_CONTEXT_PRE_RUN), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
                 // Do the actual running
                 if (pts_test_run_manager::initial_checks($suite_identifier)) {
                     $test_run_manager = new pts_test_run_manager($test_flags);
                     // Load the tests to run
                     if ($test_run_manager->load_tests_to_run($suite_identifier)) {
                         if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_UPLOAD_TO_GLOBAL, 'FALSE'))) {
                             $test_run_manager->auto_upload_to_openbenchmarking();
                         }
                         // Save results?
                         $test_run_manager->auto_save_results(date('Y-m-d H:i:s'), $phoromatic_results_identifier, 'A Phoromatic run.');
                         // Run the actual tests
                         $test_run_manager->pre_execution_process();
                         $test_run_manager->call_test_runs();
                         $test_run_manager->post_execution_process();
                         // Upload to Phoromatic
                         pts_file_io::unlink(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml');
                         // Upload test results
                         if (is_file(PTS_SAVE_RESULTS_PATH . $save_identifier . '/composite.xml')) {
                             phoromatic::update_system_status('Uploading Test Results');
                             $times_tried = 0;
                             do {
                                 if ($times_tried > 0) {
                                     echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
                                     sleep(60);
                                 }
                                 $uploaded_test_results = phoromatic::upload_test_results($save_identifier, $phoromatic_schedule_id, $phoromatic_results_identifier, $phoromatic_trigger);
                                 $times_tried++;
                             } while ($uploaded_test_results == false && $times_tried < 5);
                             if ($uploaded_test_results == false) {
                                 echo 'Server connection failed. Exiting...' . PHP_EOL;
                                 return false;
                             }
                             if (pts_strings::string_bool($xml_parser->getXMLValue(M_PHOROMATIC_ARCHIVE_RESULTS_LOCALLY, M_PHOROMATIC_RESPONSE_TRUE)) == false) {
                                 pts_client::remove_saved_result_file($save_identifier);
                             }
                         }
                     }
                 }
                 break;
             case M_PHOROMATIC_RESPONSE_EXIT:
                 echo PHP_EOL . 'Phoromatic received a remote command to exit.' . PHP_EOL;
                 phoromatic::update_system_status('Exiting Phoromatic');
                 pts_client::release_lock(PTS_USER_PATH . 'phoromatic_lock');
                 $exit_loop = true;
                 break;
             case M_PHOROMATIC_RESPONSE_SERVER_MAINTENANCE:
                 // The Phoromatic server is down for maintenance, so don't bother updating system status and wait longer before checking back
                 echo PHP_EOL . 'The Phoromatic server is currently down for maintenance. Waiting for service to be restored.' . PHP_EOL;
                 sleep((15 - date('i') % 15) * 60);
                 break;
             case M_PHOROMATIC_RESPONSE_SHUTDOWN:
                 echo PHP_EOL . 'Shutting down the system.' . PHP_EOL;
                 $exit_loop = true;
                 shell_exec('poweroff');
                 // Currently assuming root
                 break;
             case M_PHOROMATIC_RESPONSE_REBOOT:
                 echo PHP_EOL . 'Rebooting the system.' . PHP_EOL;
                 $exit_loop = true;
                 shell_exec('reboot');
                 // Currently assuming root
                 break;
             case M_PHOROMATIC_RESPONSE_IDLE:
             default:
                 phoromatic::update_system_status('Idling, Waiting For Task');
                 sleep((10 - date('i') % 10) * 60);
                 // Check with server every 10 minutes
                 break;
         }
         if (phodevi::system_hardware(true) != $current_hw || phodevi::system_software(true) != $current_sw) {
             // Hardware and/or software has changed while PTS/Phoromatic has been running, update the Phoromatic Server
             echo 'Updating Installed Hardware / Software With Phoromatic Server' . PHP_EOL;
             phoromatic::update_system_details();
             $current_hw = phodevi::system_hardware(true);
             $current_sw = phodevi::system_software(true);
         }
     } while ($exit_loop == false);
     phoromatic::update_system_status('Offline');
 }
 public static function standard_run($to_run, $test_flags = 0)
 {
     if (pts_test_run_manager::initial_checks($to_run, $test_flags) == false) {
         return false;
     }
     $test_run_manager = new pts_test_run_manager($test_flags);
     // Load the tests to run
     if ($test_run_manager->load_tests_to_run($to_run) == false) {
         return false;
     }
     // Save results?
     $test_run_manager->save_results_prompt();
     // Run the actual tests
     $test_run_manager->pre_execution_process();
     $test_run_manager->call_test_runs();
     $test_run_manager->post_execution_process();
     return $test_run_manager;
 }