summaryrefslogtreecommitdiffstats
path: root/pts-core
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-30 15:39:23 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-30 15:39:23 -0500
commit07eac35d5549b4a2f29753791b3677a89ae7dbf1 (patch)
tree6e133547e4485ca5bd2c8c350c039811df827c40 /pts-core
parent3ddf326717d87f563468feffda1ecb35ea6f82dd (diff)
downloadphoronix-test-suite-upstream-07eac35d5549b4a2f29753791b3677a89ae7dbf1.tar.gz
phoronix-test-suite-upstream-07eac35d5549b4a2f29753791b3677a89ae7dbf1.tar.xz
phoronix-test-suite-upstream-07eac35d5549b4a2f29753791b3677a89ae7dbf1.zip
pts-core: Add download-test-files option to download files for a
test/suite but don't install
Diffstat (limited to 'pts-core')
-rw-r--r--pts-core/functions/pts-functions-install.php44
-rw-r--r--pts-core/options/download_test_files.php55
2 files changed, 78 insertions, 21 deletions
diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php
index b767395..89420dc 100644
--- a/pts-core/functions/pts-functions-install.php
+++ b/pts-core/functions/pts-functions-install.php
@@ -308,6 +308,28 @@ function pts_remove_local_download_test_files($identifier)
}
}
}
+function pts_setup_install_test_directory($identifier, $remove_old_files = false)
+{
+ if(!is_dir(TEST_ENV_DIR))
+ {
+ mkdir(TEST_ENV_DIR);
+ }
+
+ if(!is_dir(TEST_ENV_DIR . $identifier))
+ {
+ mkdir(TEST_ENV_DIR . $identifier);
+ }
+ else if($remove_old_files)
+ {
+ // Remove any files that were installed, since this test will be reinstalled and remove any old download files not used
+ $ignore_files = array("pts-install.xml");
+ foreach(pts_objects_test_downloads($identifier) as $download_object)
+ {
+ array_push($ignore_files, $download_object->get_filename());
+ }
+ pts_remove(TEST_ENV_DIR . $identifier, $ignore_files);
+ }
+}
function pts_install_test($identifier)
{
if(!pts_is_test($identifier))
@@ -357,27 +379,7 @@ function pts_install_test($identifier)
pts_set_assignment("PTS_TOTAL_SIZE_MSG", 1);
}
- if(!is_dir(TEST_ENV_DIR))
- {
- mkdir(TEST_ENV_DIR);
- }
-
- if(!is_dir(TEST_ENV_DIR . $identifier))
- {
- mkdir(TEST_ENV_DIR . $identifier);
- }
- else
- {
- // Remove any files that were installed, since this test will be reinstalled and remove any old download files not used
- $ignore_files = array("pts-install.xml");
- foreach(pts_objects_test_downloads($identifier) as $one_package_object)
- {
- array_push($ignore_files, $one_package_object->get_filename());
- }
-
- pts_remove(TEST_ENV_DIR . $identifier, $ignore_files);
- }
-
+ pts_setup_install_test_directory($identifier, true);
$download_test_files = pts_download_test_files($identifier);
if($download_test_files == false)
diff --git a/pts-core/options/download_test_files.php b/pts-core/options/download_test_files.php
new file mode 100644
index 0000000..4fa6eb2
--- /dev/null
+++ b/pts-core/options/download_test_files.php
@@ -0,0 +1,55 @@
+<?php
+
+/*
+ Phoronix Test Suite
+ URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
+ Copyright (C) 2008, Phoronix Media
+ Copyright (C) 2008, Michael Larabel
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+class download_test_files implements pts_option_interface
+{
+ public static function run($r)
+ {
+ include_once("pts-core/functions/pts-functions-install.php");
+ $test = $r[0];
+
+ if(empty($test))
+ {
+ echo "\nThe test or suite name to install must be supplied.\n";
+ }
+ else
+ {
+ $tests = pts_contained_tests(strtolower($test), true);
+
+ if(count($tests) == 0)
+ {
+ echo "\n" . $test . " isn't recognized.\n";
+ }
+ else
+ {
+ foreach($tests as $this_test)
+ {
+ // Download Test Files
+ pts_setup_install_test_directory($this_test, false);
+ pts_download_test_files($this_test);
+ }
+ }
+ }
+ }
+}
+
+?>