diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-20 17:50:34 -0500 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-11-20 17:50:34 -0500 |
commit | 17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc (patch) | |
tree | 8ef926c100cd06b30feecc4a5a111786e3f73f97 | |
parent | 82fbbacb2bee2874f120d1562976d7dd5339310e (diff) | |
download | phoronix-test-suite-upstream-17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc.tar.gz phoronix-test-suite-upstream-17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc.tar.xz phoronix-test-suite-upstream-17cdd0c1cf0ca6eb2f31c9bf423afeb692acdccc.zip |
pts-core: Return false on failure from read_sysctl() instead of
"Unknown" string
-rw-r--r-- | TYDAL-CHANGE-LOG | 1 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_cpu.php | 10 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_graphics.php | 7 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_hardware.php | 8 | ||||
-rw-r--r-- | pts-core/functions/pts-functions_system_parsing.php | 4 |
5 files changed, 24 insertions, 6 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG index ca44d3a..24af97b 100644 --- a/TYDAL-CHANGE-LOG +++ b/TYDAL-CHANGE-LOG @@ -42,6 +42,7 @@ Phoronix Test Suite (Git) - pts-core: Fixes in FreeBSD 7 support - pts-core: Return false on failure from read_pci() instead of "Unknown" string - pts-core: Return false on failure from read_lsb() instead of "Unknown" string +- pts-core: Return false on failure from read_sysctl() instead of "Unknown" string - pts: Add External Dependencies support for FreeBSD using pkg_add command - pts: Update most test profiles to reflect whether they are supported on *BSD operating systems - tandem_XmlReader: Switch caching from using a GLOBALS variable to using a static variable within the XML reading class diff --git a/pts-core/functions/pts-functions_system_cpu.php b/pts-core/functions/pts-functions_system_cpu.php index 1244155..e26538b 100644 --- a/pts-core/functions/pts-functions_system_cpu.php +++ b/pts-core/functions/pts-functions_system_cpu.php @@ -24,6 +24,8 @@ function hw_cpu_core_count() { // Returns number of cores present on the system + $info = null; + if(IS_LINUX) { $processors = read_cpuinfo("processor"); @@ -43,7 +45,8 @@ function hw_cpu_core_count() { $info = read_osx_system_profiler("SPHardwareDataType", "TotalNumberOfCores"); } - else + + if(empty($info)) { $info = 1; } @@ -125,6 +128,11 @@ function hw_cpu_string() else if(IS_BSD) { $info = read_sysctl("hw.model"); + + if(empty($info)) + { + $info = "Unknown"; + } } else if(IS_MACOSX) { diff --git a/pts-core/functions/pts-functions_system_graphics.php b/pts-core/functions/pts-functions_system_graphics.php index 6dd3d8d..589dce5 100644 --- a/pts-core/functions/pts-functions_system_graphics.php +++ b/pts-core/functions/pts-functions_system_graphics.php @@ -787,10 +787,15 @@ function hw_gpu_string() { $info = read_sysctl("dev.drm.0.%desc"); - if($info == "Unknown") + if(empty($info)) { $info = read_sysctl("dev.agp.0.%desc"); } + + if(empty($info)) + { + $info = "Unknown"; + } } if(IS_NVIDIA_GRAPHICS && $video_ram > DEFAULT_VIDEO_RAM_CAPACITY && strpos($info, $video_ram) == false) diff --git a/pts-core/functions/pts-functions_system_hardware.php b/pts-core/functions/pts-functions_system_hardware.php index 23e4280..55bfb29 100644 --- a/pts-core/functions/pts-functions_system_hardware.php +++ b/pts-core/functions/pts-functions_system_hardware.php @@ -25,6 +25,7 @@ function hw_sys_motherboard_string() { // Returns the motherboard / system model name or number $info = ""; + if(IS_MACOSX) { $info = read_osx_system_profiler("SPHardwareDataType", "ModelName"); @@ -41,7 +42,10 @@ function hw_sys_motherboard_string() } else if(IS_BSD) { - $info = trim(read_sysctl("hw.vendor") . " " . read_sysctl("hw.version")); + if(($vendor = read_sysctl("hw.vendor")) != false && ($version = read_sysctl("hw.version")) != false) + { + $info = trim($vendor . " " . $version); + } } if(empty($info)) @@ -402,7 +406,7 @@ function hw_sys_memory_capacity() { $mem_size = read_sysctl("hw.physmem"); - if($mem_size == "Unknown") + if(empty($mem_size)) { $mem_size = read_sysctl("hw.realmem"); } diff --git a/pts-core/functions/pts-functions_system_parsing.php b/pts-core/functions/pts-functions_system_parsing.php index 2e7683d..dfcbe81 100644 --- a/pts-core/functions/pts-functions_system_parsing.php +++ b/pts-core/functions/pts-functions_system_parsing.php @@ -222,14 +222,14 @@ function read_lsb($desc) function read_sysctl($desc) { // Read sysctl, used by *BSDs - $info = "Unknown"; + $info = false; if(!is_array($desc)) { $desc = array($desc); } - for($i = 0; $i < count($desc) && $info == "Unknown"; $i++) + for($i = 0; $i < count($desc) && empty($info); $i++) { $output = shell_exec("sysctl " . $desc[$i] . " 2>&1"); |