public static function run($r) { foreach (pts_types::identifiers_to_test_profile_objects($r, true, true) as $test_profile) { pts_client::$display->generic_heading($test_profile); pts_validation::validate_test_profile($test_profile); } }
public static function run($r) { if (pts_openbenchmarking_client::user_name() == false) { echo PHP_EOL . 'You must first be logged into an OpenBenchmarking.org account.' . PHP_EOL; echo PHP_EOL . 'Create An Account: http://openbenchmarking.org/'; echo PHP_EOL . 'Log-In Command: phoronix-test-suite openbenchmarking-setup' . PHP_EOL . PHP_EOL; return false; } foreach (pts_types::identifiers_to_test_profile_objects($r, true, true) as $test_profile) { // validate_test_profile if (pts_validation::validate_test_profile($test_profile)) { pts_client::$display->generic_heading($test_profile); $zip_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $test_profile->get_identifier_base_name() . '-' . $test_profile->get_test_profile_version() . '.zip'; $zip_created = pts_compression::zip_archive_create($zip_file, pts_file_io::glob($test_profile->get_resource_dir() . '*')); if ($zip_created == false) { echo PHP_EOL . 'Failed to create zip file.' . PHP_EOL; return false; } if (filesize($zip_file) > 104857) { echo PHP_EOL . 'The test profile package is too big.' . PHP_EOL; return false; } $commit_description = pts_user_io::prompt_user_input('Enter a test commit description', false); echo PHP_EOL; $server_response = pts_openbenchmarking::make_openbenchmarking_request('upload_test_profile', array('tp_identifier' => $test_profile->get_identifier_base_name(), 'tp_sha1' => sha1_file($zip_file), 'tp_zip' => base64_encode(file_get_contents($zip_file)), 'tp_zip_name' => basename($zip_file), 'commit_description' => $commit_description)); echo PHP_EOL; $json = json_decode($server_response, true); if (isset($json['openbenchmarking']['upload']['error']) && !empty($json['openbenchmarking']['upload']['error'])) { echo 'ERROR: ' . $json['openbenchmarking']['upload']['error'] . PHP_EOL; } if (isset($json['openbenchmarking']['upload']['id']) && !empty($json['openbenchmarking']['upload']['id'])) { echo 'Command: phoronix-test-suite benchmark ' . $json['openbenchmarking']['upload']['id'] . PHP_EOL; } if (isset($json['openbenchmarking']['upload']['url']) && !empty($json['openbenchmarking']['upload']['url'])) { pts_openbenchmarking::refresh_repository_lists(null, true); echo 'URL: ' . $json['openbenchmarking']['upload']['url'] . PHP_EOL; } echo PHP_EOL; // TODO: chmod +x the .sh files, appropriate permissions elsewhere unlink($zip_file); } } }