Ejemplo n.º 1
0
 public static function run($r)
 {
     echo PHP_EOL . 'These are the default configuration options for when running the Phoronix Test Suite in a batch mode (i.e. running phoronix-test-suite batch-benchmark universe). Running in a batch mode is designed to be as autonomous as possible, except for where you\'d like any end-user interaction.' . PHP_EOL . PHP_EOL;
     $batch_options = array();
     $batch_options['PhoronixTestSuite/Options/BatchMode/SaveResults'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Save test results when in batch mode', true));
     if ($batch_options['PhoronixTestSuite/Options/BatchMode/SaveResults'] == 'TRUE') {
         $batch_options['PhoronixTestSuite/Options/BatchMode/OpenBrowser'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Open the web browser automatically when in batch mode', false));
         $batch_options['PhoronixTestSuite/Options/BatchMode/UploadResults'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Auto upload the results to OpenBenchmarking.org', true));
         $batch_options['PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Prompt for test identifier', true));
         $batch_options['PhoronixTestSuite/Options/BatchMode/PromptForTestDescription'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Prompt for test description', true));
         $batch_options['PhoronixTestSuite/Options/BatchMode/PromptSaveName'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Prompt for saved results file-name', true));
     } else {
         $batch_options['PhoronixTestSuite/Options/BatchMode/OpenBrowser'] = 'FALSE';
         $batch_options['PhoronixTestSuite/Options/BatchMode/UploadResults'] = 'FALSE';
         $batch_options['PhoronixTestSuite/Options/BatchMode/PromptForTestIdentifier'] = 'FALSE';
         $batch_options['PhoronixTestSuite/Options/BatchMode/PromptForTestDescription'] = 'FALSE';
         $batch_options['PhoronixTestSuite/Options/BatchMode/PromptSaveName'] = 'FALSE';
     }
     $batch_options['PhoronixTestSuite/Options/BatchMode/RunAllTestCombinations'] = pts_config::bool_to_string(pts_user_io::prompt_bool_input('Run all test options', true));
     $batch_options['PhoronixTestSuite/Options/BatchMode/Configured'] = 'TRUE';
     pts_config::user_config_generate($batch_options);
     echo PHP_EOL . 'Batch settings saved.' . PHP_EOL . PHP_EOL;
 }
Ejemplo n.º 2
0
 public static function user_agreement_check($command)
 {
     $pso = pts_storage_object::recover_from_file(PTS_CORE_STORAGE);
     if ($pso == false) {
         return false;
     }
     $config_md5 = $pso->read_object('user_agreement_cs');
     $current_md5 = md5_file(PTS_PATH . 'pts-core/user-agreement.txt');
     if (($config_md5 != $current_md5 || pts_config::read_user_config('PhoronixTestSuite/Options/OpenBenchmarking/AnonymousUsageReporting', 'UNKNOWN') == 'UNKNOWN') && !PTS_IS_DAEMONIZED_SERVER_PROCESS && getenv('PTS_SILENT_MODE') != 1 && $config_md5 != 'enterprise-agree') {
         $prompt_in_method = pts_client::check_command_for_function($command, 'pts_user_agreement_prompt');
         $user_agreement = file_get_contents(PTS_PATH . 'pts-core/user-agreement.txt');
         if ($prompt_in_method) {
             $user_agreement_return = call_user_func(array($command, 'pts_user_agreement_prompt'), $user_agreement);
             if (is_array($user_agreement_return)) {
                 if (count($user_agreement_return) == 3) {
                     list($agree, $usage_reporting) = $user_agreement_return;
                 } else {
                     $agree = array_shift($user_agreement_return);
                     $usage_reporting = -1;
                 }
             } else {
                 $agree = $user_agreement_return;
                 $usage_reporting = -1;
             }
         }
         if ($prompt_in_method == false || $usage_reporting == -1) {
             pts_client::$display->generic_heading('User Agreement');
             echo wordwrap($user_agreement, 65);
             $agree = pts_user_io::prompt_bool_input('Do you agree to these terms and wish to proceed', true);
             $usage_reporting = $agree ? pts_user_io::prompt_bool_input('Enable anonymous usage / statistics reporting', true) : -1;
         }
         if ($agree) {
             echo PHP_EOL;
             $pso->add_object('user_agreement_cs', $current_md5);
             $pso->save_to_file(PTS_CORE_STORAGE);
         } else {
             pts_client::exit_client('In order to run the Phoronix Test Suite, you must agree to the listed terms.');
         }
         pts_config::user_config_generate(array('PhoronixTestSuite/Options/OpenBenchmarking/AnonymousUsageReporting' => pts_config::bool_to_string($usage_reporting)));
     }
 }