diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-08-17 21:01:06 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-08-17 21:01:06 -0400 |
commit | 9afeef36f31044f7c28cc5854b148a9abd6d2709 (patch) | |
tree | a8f5a5a65b5ea4b752c522ebb770eb91c8d2e879 /pts-core | |
parent | 07e5b996a6c95277942921734e28f93f352f7552 (diff) | |
download | phoronix-test-suite-upstream-9afeef36f31044f7c28cc5854b148a9abd6d2709.tar.gz phoronix-test-suite-upstream-9afeef36f31044f7c28cc5854b148a9abd6d2709.tar.xz phoronix-test-suite-upstream-9afeef36f31044f7c28cc5854b148a9abd6d2709.zip |
pts-core: If TEST_RESULTS_NAME environmental variable set, use that
value instead of prompting for save name
Diffstat (limited to 'pts-core')
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 22 | ||||
-rw-r--r-- | pts-core/pts-run-test.php | 7 |
2 files changed, 17 insertions, 12 deletions
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 32ae0b6..ad59d2d 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -66,19 +66,25 @@ function pts_prompt_results_identifier($current_identifiers = null) return $RESULTS_IDENTIFIER; } -function pts_prompt_save_file_name() +function pts_prompt_save_file_name($check_env = true) { - if(!IS_BATCH_MODE || pts_read_user_config(P_OPTION_BATCH_PROMPTSAVENAME, "FALSE") == "TRUE") + if($check_env && ($save_name = getenv("TEST_RESULTS_NAME")) != FALSE) { - do + $PROPOSED_FILE_NAME = $save_name; + echo "Saving results to: " . $PROPOSED_FILE_NAME . "\n"; + } + else + { + if(!IS_BATCH_MODE || pts_read_user_config(P_OPTION_BATCH_PROMPTSAVENAME, "FALSE") == "TRUE") { - echo "Enter a name to save these results: "; - $PROPOSED_FILE_NAME = trim(fgets(STDIN)); + do + { + echo "Enter a name to save these results: "; + $PROPOSED_FILE_NAME = trim(fgets(STDIN)); + } + while(empty($PROPOSED_FILE_NAME)); } - while(empty($PROPOSED_FILE_NAME)); } - else - $PROPOSED_FILE_NAME = date("Y-m-d_Hi"); $CUSTOM_TITLE = $PROPOSED_FILE_NAME; $PROPOSED_FILE_NAME = trim(str_replace(array(' ', '/', '&', '\''), "", strtolower($PROPOSED_FILE_NAME))); // Clean up name diff --git a/pts-core/pts-run-test.php b/pts-core/pts-run-test.php index 99eea6b..bad94e2 100644 --- a/pts-core/pts-run-test.php +++ b/pts-core/pts-run-test.php @@ -77,6 +77,8 @@ else echo "\n"; if(getenv("PTS_SAVE_RESULTS") == "NO") $SAVE_RESULTS = FALSE; + else if(getenv("TEST_RESULTS_NAME") != FALSE) + $SAVE_RESULTS = TRUE; else $SAVE_RESULTS = pts_bool_question("Would you like to save these test results (Y/n)?", true, "SAVE_RESULTS"); @@ -86,9 +88,6 @@ else $PROPOSED_FILE_NAME = $FILE_NAME[0]; $CUSTOM_TITLE = $FILE_NAME[1]; - if(empty($PROPOSED_FILE_NAME)) - $PROPOSED_FILE_NAME = date("Y-m-d-Hi"); - do { if(is_file(SAVE_RESULTS_DIR . $PROPOSED_FILE_NAME . "/composite.xml")) @@ -114,7 +113,7 @@ else if(!$is_validated) { echo pts_string_header("This saved file-name is associated with a different test ($test_suite) from $TO_RUN. Enter a new name for saving the results."); - $FILE_NAME = pts_prompt_save_file_name(); + $FILE_NAME = pts_prompt_save_file_name(FALSE); $PROPOSED_FILE_NAME = $FILE_NAME[0]; $CUSTOM_TITLE = $FILE_NAME[1]; } |