diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-05-28 09:33:38 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-05-28 09:33:38 -0400 |
commit | b33b604547d1157c2a958dc95f37d47cdf9f9639 (patch) | |
tree | 1797e82243a2597e3594cf75953ee9066708b8d8 /pts/test-resources | |
parent | cf85fcb6c8e9f6e6f24647a916834404c28b485a (diff) | |
download | phoronix-test-suite-upstream-b33b604547d1157c2a958dc95f37d47cdf9f9639.tar.gz phoronix-test-suite-upstream-b33b604547d1157c2a958dc95f37d47cdf9f9639.tar.xz phoronix-test-suite-upstream-b33b604547d1157c2a958dc95f37d47cdf9f9639.zip |
Add compliance-sensors test for checking if some important LM_Sensors
sensors are properly detected and working
Diffstat (limited to 'pts/test-resources')
-rw-r--r-- | pts/test-resources/compliance-sensors/install.sh | 51 | ||||
-rw-r--r-- | pts/test-resources/compliance-sensors/parse-results.php | 1 |
2 files changed, 52 insertions, 0 deletions
diff --git a/pts/test-resources/compliance-sensors/install.sh b/pts/test-resources/compliance-sensors/install.sh new file mode 100644 index 0000000..ae1d93f --- /dev/null +++ b/pts/test-resources/compliance-sensors/install.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +cat > sensors-check << 'EOT' +<?php +function read_sensors($attribute) +{ + $value = ""; + $sensors = shell_exec("sensors 2>&1"); + $sensors_lines = explode("\n", $sensors); + + for($i = 0; $i < count($sensors_lines) && $value == ""; $i++) + { + $line = explode(": ", $sensors_lines[$i]); + $this_attribute = trim($line[0]); + + if($this_attribute == $attribute) + { + $this_remainder = trim(str_replace(array('+', '°'), ' ', $line[1])); + $value = substr($this_remainder, 0, strpos($this_remainder, ' ')); + } + } + + return $value; +} + +$sensors = array(); +$sensor_results = array(); + +array_push($sensors, read_sensors("VCore")); +array_push($sensors, read_sensors("CPU Fan")); +array_push($sensors, read_sensors("CPU Temp")); +array_push($sensors, read_sensors("Sys Temp")); + +foreach($sensors as $single_sensor) +{ + if(is_numeric($sensors) && $sensors > 1) + array_push($sensor_results, "PASS"); + else + array_push($sensor_results, "FAIL"); +} + +echo implode(",", $sensor_results) . "\n"; + +?> +EOT + +cat > compliance-sensors << 'EOT' +#!/bin/sh +php sensors-check +EOT +chmod +x compliance-sensors diff --git a/pts/test-resources/compliance-sensors/parse-results.php b/pts/test-resources/compliance-sensors/parse-results.php new file mode 100644 index 0000000..82509cf --- /dev/null +++ b/pts/test-resources/compliance-sensors/parse-results.php @@ -0,0 +1 @@ +<?php echo trim($argv[1]); ?> |