diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-12-08 09:01:13 -0500 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-12-08 09:01:13 -0500 |
commit | 90246c6ed42a41b61f54a0e3965c6b02b150373e (patch) | |
tree | b31eb0c4b1019b25697f45b1e72ac8c764fa72f3 /pts-core/functions | |
parent | ebd8934969dfdade04b87e298391c359a65f96e5 (diff) | |
download | phoronix-test-suite-upstream-90246c6ed42a41b61f54a0e3965c6b02b150373e.tar.gz phoronix-test-suite-upstream-90246c6ed42a41b61f54a0e3965c6b02b150373e.tar.xz phoronix-test-suite-upstream-90246c6ed42a41b61f54a0e3965c6b02b150373e.zip |
pts-core: Add auto-disks and auto-disk-partitions to automatic
population of test profile menus from identifiers
Diffstat (limited to 'pts-core/functions')
-rw-r--r-- | pts-core/functions/pts-functions-run.php | 50 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_tests.php | 4 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_types.php | 4 |
3 files changed, 54 insertions, 4 deletions
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php index 5315e59..e4887e3 100644 --- a/pts-core/functions/pts-functions-run.php +++ b/pts-core/functions/pts-functions-run.php @@ -402,7 +402,7 @@ function pts_prompt_save_file_name($check_env = true, $to_run) $CUSTOM_TITLE = $PROPOSED_FILE_NAME; $PROPOSED_FILE_NAME = pts_input_string_to_identifier($PROPOSED_FILE_NAME); - $is_reserved_word = pts_is_test($PROPOSED_FILE_NAME) || pts_is_suite($PROPOSED_FILE_NAME); + $is_reserved_word = pts_is_run_object($PROPOSED_FILE_NAME); } } @@ -1122,7 +1122,7 @@ function pts_all_combos(&$return_arr, $current_string, $options, $counter, $deli function pts_auto_process_test_option($identifier, &$option_names, &$option_values) { // Some test items have options that are dynamically built - if(count($option_names) == 1 && count($option_values) == 1) + if(count($option_names) < 2 && count($option_values) < 2) { switch($identifier) { @@ -1145,6 +1145,52 @@ function pts_auto_process_test_option($identifier, &$option_names, &$option_valu array_push($option_values, $this_value); } break; + case "auto-disk-partitions": + $all_devices = array_merge(glob("/dev/hd*"), glob("/dev/sd*")); + $all_devices_count = count($all_devices); + + for($i = 0; $i < $all_devices_count; $i++) + { + $last_char = substr($all_devices[$i], -1); + + if(!is_numeric($last_char)) + { + unset($all_devices[$i]); + } + } + + $option_values = array(); + + foreach($all_devices as $partition) + { + array_push($option_values, $partition); + } + + $option_names = $option_values; + break; + case "auto-disks": + $all_devices = array_merge(glob("/dev/hd*"), glob("/dev/sd*")); + $all_devices_count = count($all_devices); + + for($i = 0; $i < $all_devices_count; $i++) + { + $last_char = substr($all_devices[$i], -1); + + if(is_numeric($last_char)) + { + unset($all_devices[$i]); + } + } + + $option_values = array(); + + foreach($all_devices as $disk) + { + array_push($option_values, $disk); + } + + $option_names = $option_values; + break; } } } diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php index a3a2c64..a04fab2 100644 --- a/pts-core/functions/pts-functions_tests.php +++ b/pts-core/functions/pts-functions_tests.php @@ -207,9 +207,9 @@ function pts_save_result($save_to = null, $save_results = null) return $bool; } -function pts_suite_test_types() +function pts_subsystem_test_types() { - return array("System", "Processor", "Hard Disk", "Graphics", "Memory", "Network"); + return array("System", "Processor", "Disk", "Graphics", "Memory", "Network"); } function pts_get_results_viewer_xsl_formatted($format_type = "PNG") { diff --git a/pts-core/functions/pts-functions_types.php b/pts-core/functions/pts-functions_types.php index 183d367..bc9f2ad 100644 --- a/pts-core/functions/pts-functions_types.php +++ b/pts-core/functions/pts-functions_types.php @@ -31,6 +31,10 @@ define("TYPE_LOCAL_TEST_SUITE", "LOCAL_TEST_SUITE"); // Type is a test suite define("TYPE_SCTP_TEST", "LOCAL_SCTP_TEST"); // Type is a SCTP test define("TYPE_BASE_TEST", "BASE_TEST"); // Type is a SCTP test +function pts_is_run_object($object) +{ + return pts_is_test($object) || pts_is_suite($object); +} function pts_is_suite($object) { $type = pts_test_type($object); |