diff options
-rw-r--r-- | CHANGE-LOG | 1 | ||||
-rwxr-xr-x | phoronix-test-suite | 6 | ||||
-rw-r--r-- | pts-core/functions/pts-functions-extra.php | 26 | ||||
-rw-r--r-- | pts-core/pts-run-cmd.php | 31 |
4 files changed, 49 insertions, 15 deletions
@@ -21,6 +21,7 @@ Phoronix Test Suite - Add MONITOR= environmental variable. If MONITOR=gpu.temp, the low, average, and high temperatures will be reported at end of test - Add a lot more sensor and monitoring support... Add MONITOR=sys.temp and MONITOR=cpu.temp. Multiple sensors supported that are delimited by comma (depends upon LM_Sensors) - Clean up pts-results-viewer as well as switching to Liberation Sans for the font in graph rendering and clean up graph alignment +- Add remove-all-results option Phoronix Test Suite 0.4.0 April 24, 2008 diff --git a/phoronix-test-suite b/phoronix-test-suite index 65c66bd..b1315ce 100755 --- a/phoronix-test-suite +++ b/phoronix-test-suite @@ -60,6 +60,9 @@ case "$1" in "remove-result") $PHP_BIN pts-core/pts-run-cmd.php REMOVE_RESULT $2 ;; +"remove-all-results") + $PHP_BIN pts-core/pts-run-cmd.php REMOVE_ALL_RESULTS + ;; "upload") $PHP_BIN pts-core/pts-run-cmd.php UPLOAD_RESULT $2 ;; @@ -109,10 +112,11 @@ case "$1" in echo "benchmark <suite OR test OR saved file>: Same as manually running install and then run" echo "batch-benchmark <suite OR test OR saved file>: Same as manually running install and then run in Batch Mode" echo "merge-results <Saved File 1 OR Global ID> <Saved File 2 OR Global ID> <Save To>: Merge two saved result sets" - echo "remove-result <Saved File>: Remove this saved result file and associated files" echo "list-tests: List all Phoronix Test Suite test profiles" echo "list-suites: List all Phoronix Test Suites" echo "list-results: List all saved results" + echo "remove-result <Saved File>: Remove this saved result file and associated files" + echo "remove-all-results: Removes all saved results and associated files" echo "suite-info: Show tests in a suite and other information about the suite" echo "test-info: Show information about a test" echo "system-info: Dump detected software and hardware information detected by PTS" diff --git a/pts-core/functions/pts-functions-extra.php b/pts-core/functions/pts-functions-extra.php new file mode 100644 index 0000000..a656fdb --- /dev/null +++ b/pts-core/functions/pts-functions-extra.php @@ -0,0 +1,26 @@ +<?php + +function pts_remove_saved_result($identifier) +{ + $return_value = false; + + if(is_file(SAVE_RESULTS_DIR . $identifier . "/composite.xml")) + { + @unlink(SAVE_RESULTS_DIR . $identifier . "/composite.xml"); + + foreach(glob(SAVE_RESULTS_DIR . $identifier . "/result-graphs/*.png") as $remove_file) + @unlink($remove_file); + + foreach(glob(SAVE_RESULTS_DIR . $identifier . "/test-*.xml") as $remove_file) + @unlink($remove_file); + + @unlink(SAVE_RESULTS_DIR . $identifier . "/pts-results-viewer.xsl"); + @rmdir(SAVE_RESULTS_DIR . $identifier . "/result-graphs/"); + @rmdir(SAVE_RESULTS_DIR . $identifier); + echo "Removed: $identifier\n"; + $return_value = true; + } + return $return_value; +} + +?> diff --git a/pts-core/pts-run-cmd.php b/pts-core/pts-run-cmd.php index f0df6fc..c390e2d 100644 --- a/pts-core/pts-run-cmd.php +++ b/pts-core/pts-run-cmd.php @@ -1,6 +1,7 @@ <?php require("pts-core/functions/pts-functions.php"); +require("pts-core/functions/pts-functions-extra.php"); $COMMAND = $argv[1]; @@ -12,21 +13,23 @@ if(isset($argv[3])) switch($COMMAND) { + case "REMOVE_ALL_RESULTS": + $remove_all = pts_bool_question("Are you sure you wish to remove all saved results (Y/n)?", true); + + if($remove_all) + { + foreach(glob(SAVE_RESULTS_DIR . "*/composite.xml") as $benchmark_file) + { + $saved_identifier = array_pop(explode('/', dirname($benchmark_file))); + pts_remove_saved_result($saved_identifier); + } + } + break; case "REMOVE_RESULT": if(is_file(SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml")) { - unlink(SAVE_RESULTS_DIR . $ARG_1 . "/composite.xml"); - - foreach(glob(SAVE_RESULTS_DIR . $ARG_1 . "/result-graphs/*.png") as $remove_file) - unlink($remove_file); - - foreach(glob(SAVE_RESULTS_DIR . $ARG_1 . "/test-*.xml") as $remove_file) - unlink($remove_file); - - unlink(SAVE_RESULTS_DIR . $ARG_1 . "/pts-results-viewer.xsl"); - rmdir(SAVE_RESULTS_DIR . $ARG_1 . "/result-graphs/"); - rmdir(SAVE_RESULTS_DIR . $ARG_1); - echo "\nRemoved: $ARG_1\n"; + echo "\n"; + pts_remove_saved_result($ARG_1); } else echo "\nThis result doesn't exist!\n"; @@ -63,12 +66,12 @@ switch($COMMAND) if(!empty($title)) { echo $title . "\n"; - printf("Saved Name: %-15ls Test: %-18ls \n", $saved_identifier, $suite); + printf("Saved Name: %-18ls Test: %-18ls \n", $saved_identifier, $suite); foreach($identifiers as $id) echo "\t- $id\n"; - echo "\n\n"; + echo "\n"; } } break; |