Author: gnichols
Date: 2010-07-16 16:44:57 +0000 (Fri, 16 Jul 2010)
New Revision: 587
Modified:
trunk/tests/core/core.py
Log:
568467 - FEAT: v7 needs a cpu clocks test
Modified: trunk/tests/core/core.py
===================================================================
--- trunk/tests/core/core.py 2010-07-15 16:50:39 UTC (rev 586)
+++ trunk/tests/core/core.py 2010-07-16 16:44:57 UTC (rev 587)
@@ -14,16 +14,101 @@
#
# Author: Greg Nichols
#
+import sys
from v7.test import Test
from v7.tags import DeviceClass
+from v7.command import Command, V7CommandException
+from v7.redhatrelease import RedHatRelease
class CoreTest(Test):
def __init__(self):
Test.__init__(self, name="core")
self.deviceClass = DeviceClass.processor
+ self.redHatRelease = RedHatRelease()
+
+ def getClockInfo(self):
+ print "Clock Info: ------------------------------------------"
+ clockInfo = Command("dmesg")
+ clockInfo.run()
+ tsc = False
+ clocksource = None
+ for line in clockInfo.output:
+ if "TSC" in line or "clocksource" in line or " tsc
" in line:
+ print line
+ if "tsc" in line and "clocksource" in line:
+ tsc = True
+ clocksource = "TSC"
+ elif "clocksource" in line: # clocksource set to some other
clock
+ tsc = False
+ clocksource = line.split()[-1]
+
+ print ""
+ if clocksource:
+ print "Clock Source per system log: " + clocksource
+ else:
+ print "Warning: could not determine clocksource"
+
+ sysCurrentClockSource =
"/sys/devices/system/clocksource/clocksource*/current_clocksource"
+ sys = Command("cat " + sysCurrentClockSource)
+ clocksource = sys.getString()
+ print "Clock Source in " + sysCurrentClockSource + ": " +
clocksource
+ print ""
+ return tsc
+
+ def isIntel(self):
+ try:
+ intel = Command("cat /proc/cpuinfo")
+ vendor = intel.getString(regex="^vendor_id[^:]*:\ *(?P<vendor>[^\
]*$)", regexGroup="vendor", singleLine=False)
+ print "CPU Vendor: " + vendor
+ sys.stdout.flush()
+ if vendor in ["Intel", "GenuineIntel"]:
+ return True
+ return False
+ except V7CommandException, e:
+
+ return False
+
+
+
+ def run(self):
+ FAIL = 1
+ PASS = 0
+ result = PASS
+ # run the old CORE2 script
+ try:
+ # run script for extra cpu stuff (ia64 and ppc64
+ if self.redHatRelease.getArch() in ["ia64", "ppc64"]:
+ core2 = Command("./CORE2")
+ core2.echo()
+
+ # run clock tests - jitter and direction
+ usingTSC = self.getClockInfo()
+ if self.isIntel() and not usingTSC:
+ print "Error: Intel processor(s) not using TSC"
+ result = FAIL
+
+ print "Running clock tests"
+ sys.stdout.flush()
+ clocktest = Command("./clocktest")
+ clocktest.echo()
+ sys.stdout.flush()
+
+ limit = 10 # min.
+ print "Running stress for %u min." % limit
+ sys.stdout.flush()
+ stress = Command("stress --cpu 12 --io 12 --vm 12 --vm-bytes 128M
--timeout %um" % limit)
+ stress.echo()
+ except V7CommandException, e:
+ print "Error:"
+ print e
+ e.command.printErrors()
+ return FAIL
+
+ return result
+
if __name__ == "__main__":
test = CoreTest()
returnValue = test.do(sys.argv)
Show replies by date