From 3a90c84c198da72e5db522f97c886a20ae523d03 Mon Sep 17 00:00:00 2001 From: Michael Larabel Date: Mon, 25 Aug 2008 21:44:24 -0400 Subject: pts-coere: Add SupportedPlatforms tag for optionally specifying on what operating systems this test is compatible with (Linux, Solaris, and FreeBSD) --- pts-core/functions/pts-functions-install.php | 30 +++++++++++++++++++++++++++- pts-core/functions/pts-interfaces.php | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pts-core/functions/pts-functions-install.php b/pts-core/functions/pts-functions-install.php index 16246aa..de127cc 100644 --- a/pts-core/functions/pts-functions-install.php +++ b/pts-core/functions/pts-functions-install.php @@ -316,7 +316,11 @@ function pts_install_test($identifier) { if(!pts_test_architecture_supported($identifier)) { - echo pts_string_header($identifier . " is not supported on this platform (" . kernel_arch() . ")."); + echo pts_string_header($identifier . " is not supported with this processor architecture (" . kernel_arch() . ")."); + } + else if(!pts_test_platform_supported($identifier)) + { + echo pts_string_header($identifier . " is not supported by this operating system (" . OPERATING_SYSTEM . ")."); } else { @@ -618,6 +622,30 @@ function pts_test_architecture_supported($identifier) return $supported; } +function pts_test_platform_supported($identifier) +{ + // Check if the system's OS is supported by a test + $supported = true; + + if(is_file(XML_PROFILE_DIR . $identifier . ".xml")) + { + $xml_parser = new tandem_XmlReader(XML_PROFILE_DIR . $identifier . ".xml"); + $platforms = $xml_parser->getXMLValue(P_TEST_SUPPORTEDPLATFORMS); + + if(!empty($platforms)) + { + $platforms = explode(",", $platforms); + + foreach($platforms as $key => $value) + $platforms[$key] = trim($value); + + if(!in_array(OPERATING_SYSTEM, $platforms) && OPERATING_SYSTEM != "Unknown") + $supported = false; + } + } + + return $supported; +} function pts_estimated_download_size($identifier) { // Estimate the size of files to be downloaded diff --git a/pts-core/functions/pts-interfaces.php b/pts-core/functions/pts-interfaces.php index ffb39d2..873d104 100644 --- a/pts-core/functions/pts-interfaces.php +++ b/pts-core/functions/pts-interfaces.php @@ -46,6 +46,7 @@ define("P_TEST_MAINTAINER", "PhoronixTestSuite/TestProfile/Maintainer"); // Test define("P_TEST_LICENSE", "PhoronixTestSuite/TestProfile/License"); // Test software license define("P_TEST_STATUS", "PhoronixTestSuite/TestProfile/Status"); // The status of the test profile define("P_TEST_SUPPORTEDARCHS", "PhoronixTestSuite/TestProfile/SupportedArchitectures"); // The system architectures supported by this test +define("P_TEST_SUPPORTEDPLATFORMS", "PhoronixTestSuite/TestProfile/SupportedPlatforms"); // The OS software platforms supported by this test define("P_TEST_ROOTNEEDED", "PhoronixTestSuite/TestProfile/RequiresRoot"); // Is root access needed? (TODO: Implement RequiresRoot) define("P_TEST_DOWNLOADSIZE", "PhoronixTestSuite/TestProfile/DownloadSize"); // Estimated size of capacity needed for downloads (in MB) define("P_TEST_ENVIRONMENTSIZE", "PhoronixTestSuite/TestProfile/EnvironmentSize"); // Estimated size of capacity needed for testing environment (in MB) -- cgit