Author: gnichols Date: 2012-08-02 18:27:47 +0000 (Thu, 02 Aug 2012) New Revision: 1358
Removed: trunk/tests/info/runtest.sh Modified: trunk/tests/audio/audio.py trunk/tests/battery/battery.py trunk/tests/cpuscaling/aperfmperf.py trunk/tests/cpuscaling/cpuscaling.py trunk/tests/expresscard/expresscard.py trunk/tests/fencing/fencing.py trunk/tests/hwlatdetect/v7_hwlatdetect.py trunk/tests/infiniband/infiniband.py trunk/tests/kdump/kdump.py trunk/tests/lid/lid.py trunk/tests/network/network.py trunk/tests/pccard/pccard.py trunk/tests/profiler/profiler.py trunk/tests/reboot/reboot.py trunk/tests/rteval/v7_rteval.py trunk/tests/storage/storage.py trunk/tests/suspend/suspend.py trunk/tests/tape/tape.py trunk/tests/usb/usb.py trunk/tests/video/video.py trunk/tests/wlan/wlan.py Log: 843565 - v7 test planning should not use a generic device dictionary
Modified: trunk/tests/audio/audio.py =================================================================== --- trunk/tests/audio/audio.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/audio/audio.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -26,14 +26,11 @@ Test.__init__(self, name="audio") self.deviceClass = DeviceClass.audio
- def plan(self, devices): + def plan(self, planner): properties = dict() properties['alsa.pcm_class'] = 'generic' properties['alsa.type'] = 'playback' - tests = self.planWith(devices, properties, all=False) - properties = dict() - properties['class'] = 'AUDIO' - tests.extend(self.planWith(devices, properties, all=False)) + tests = self.planWith(planner.getHalDeviceDetector(), properties, all=False) return tests
def getRequiredRPMs(self):
Modified: trunk/tests/battery/battery.py =================================================================== --- trunk/tests/battery/battery.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/battery/battery.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -35,9 +35,10 @@ def getACAdapterDevice(self): return self.acAdapterDevice
- def plan(self, devices): + def plan(self, planner): tests = list() acAdapterDevice = None + devices = planner.getHalDeviceDetector().getDevices() for device in devices: if 'battery' in device.getProperty("info.category") and device.getProperty("battery.present"): test = self.makeCopy()
Modified: trunk/tests/cpuscaling/aperfmperf.py =================================================================== --- trunk/tests/cpuscaling/aperfmperf.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/cpuscaling/aperfmperf.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -14,9 +14,9 @@ #
import struct -
- + + class EffectiveFrequency: """ Simple mechanism to use the Effective Frequency Interface
Modified: trunk/tests/cpuscaling/cpuscaling.py =================================================================== --- trunk/tests/cpuscaling/cpuscaling.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/cpuscaling/cpuscaling.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -209,7 +209,7 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): # check the /sys file system to see if scaling looks possible self.getCPUFreqDirectories() cpuScalingSupported = False
Modified: trunk/tests/expresscard/expresscard.py =================================================================== --- trunk/tests/expresscard/expresscard.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/expresscard/expresscard.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -29,7 +29,6 @@ from v7.tags import Constants, DeviceClass from v7.hal import Hal from v7.procDeviceDetector import ProcDeviceDetector -from v7.v7kudzu import Kudzu from v7.test import Test from v7.device import Device from v7.usbTest import USBTestBase @@ -41,13 +40,14 @@ self.deviceClass = DeviceClass.expresscard
- def plan(self, devices): + def plan(self, planner): tests = list() isXenGuest = False hasUSB = False hasBattery = False hasPCIE = False # run if there's a device with info.product == usb and it's not a Xen guest. + devices = planner.getHalDeviceDetector().getDevices() for device in devices: if device.getProperty("info.product") == "Computer" and device.getProperty("smbios.bios.vendor") == "Xen": isXenGuest = True @@ -66,17 +66,7 @@
self.deviceDetector = Hal() devices = self.deviceDetector.getDevices() - if len(devices) is 0: - print "Note: could not detect PCI devices via HAL, using Kudzu.\n" - self.deviceDetector = Kudzu() - allDevices = self.deviceDetector.getDevices() - devices = list() - for dev in allDevices: - if dev.getProperty('bus') == "PCI": - devices.append(dev) - return devices - else: - return devices + return devices
def checkAllPCIPlugged(self): @@ -202,14 +192,12 @@ self.count = self.count - 1 self.pciInfoOld = self.pciInfo() self.halInfoOld = self.halInfo() - self.kudzuInfoOld = self.kudzuInfo() if not self.promptContinue("Please plug in an ExpressCard device"): result = Constants.ABORT return FAILED # gather new HW info self.pciInfoNew = self.pciInfo() self.halInfoNew = self.halInfo() - self.kudzuInfoNew = self.kudzuInfo()
foundUSB = None if self.count > 0 or not testedUSB: @@ -250,7 +238,6 @@ # print out the detailed HW info for reviewers pciDiff = self.contextDiff(self.pciInfoOld, self.pciInfoNew) halDiff = self.contextDiff(self.halInfoOld, self.halInfoNew) - kudzuDiff = self.contextDiff(self.kudzuInfoOld, self.kudzuInfoNew) print "\n========== Detailed HW info ========== \ \n---------- lspci ---------- \ \n%s \ @@ -258,11 +245,8 @@ \n---------- HAL ---------- \ \n%s \ \n-------------------------------------- \ - \n---------- kudzu ---------- \ - \n%s \ - \n-------------------------------------- \ \n======================================\n"\ - % (pciDiff, halDiff, kudzuDiff) + % (pciDiff, halDiff)
if returnValue == PASSED:
Modified: trunk/tests/fencing/fencing.py =================================================================== --- trunk/tests/fencing/fencing.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/fencing/fencing.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -41,7 +41,7 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): tests = list() # manual planning only, for now # tests.append(self.makeCopy())
Modified: trunk/tests/hwlatdetect/v7_hwlatdetect.py =================================================================== --- trunk/tests/hwlatdetect/v7_hwlatdetect.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/hwlatdetect/v7_hwlatdetect.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -70,7 +70,7 @@ print "Could not open /sys/class/dmi/id/%s ... are you running the right kernel?" % name return None
- def plan(self, devices): + def plan(self, planner): ret = list() if not self.realtime: return ret
Modified: trunk/tests/infiniband/infiniband.py =================================================================== --- trunk/tests/infiniband/infiniband.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/infiniband/infiniband.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -33,20 +33,20 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): properties = dict() tests = list() # x060a bridge to IB properties['pci.device_class'] = 6 properties['pci.device_subclass'] = 10 - tests = self.planWith(devices, properties, all=False, strict=True) + tests = self.planWith(planner.getHalDeviceDetector(), properties, all=False, strict=True) if tests: return tests # otherwise # x0c06 IB serial controller properties['pci.device_class'] = 12 properties['pci.device_subclass'] = 6 - return self.planWith(devices, properties, all=False, strict=True) + return self.planWith(planner.getHalDeviceDetector(), properties, all=False, strict=True)
def getRequiredRPMs(self):
Deleted: trunk/tests/info/runtest.sh =================================================================== --- trunk/tests/info/runtest.sh 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/info/runtest.sh 2012-08-02 18:27:47 UTC (rev 1358) @@ -1,3 +0,0 @@ -#!/bin/bash - -v7-run-simple-test info ./info.py
Modified: trunk/tests/kdump/kdump.py =================================================================== --- trunk/tests/kdump/kdump.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/kdump/kdump.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -53,7 +53,7 @@
return rpms
- def plan(self, devices): + def plan(self, planner): tests = list() # plan kdump twice: once on storage (local disk) and once over network for dumpMethod in [Constants.nfs, Constants.local]:
Modified: trunk/tests/lid/lid.py =================================================================== --- trunk/tests/lid/lid.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/lid/lid.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -18,7 +18,8 @@
from v7.test import Test from v7.tags import Constants, DeviceClass, TestTag -from v7.hal import Hal +from v7.procDeviceDetector import ProcDeviceDetector +from v7.command import Command, V7CommandException
class LidTest(Test):
@@ -29,10 +30,13 @@ def tags(self): return [TestTag.interactive, TestTag.certification, TestTag.portable]
- def plan(self, devices): + def plan(self, planner): tests = list() + detector = planner.getProcDeviceDetector() + devices = detector.loadDevices(ProcDeviceDetector.inputBusPath) + detector.dump() for device in devices: - if 'lid' == device.getProperty("button.type"): + if device.hasPropertyValue("Lid Switch"): test = self.makeCopy() test.setDevice(device) tests.append(test) @@ -40,18 +44,27 @@
def getDevice(self): """ get the lid switch device """ - hal = Hal() - device = hal.getDevice(self.getUDI()) + detector = ProcDeviceDetector() + detector.loadDevices(ProcDeviceDetector.inputBusPath) + device = detector.getDevice(self.getUDI()) if device: self.setDevice(device) + else: + print "Error: could not find device udi %s" % self.getUDI()
return device
def checkLid(self, checkForOpen): - device = self.getDevice() - # button.state.value is true if lid is closed - isOpen = not device.getProperty("button.state.value") - return isOpen == checkForOpen + lidState = Command("cat /proc/acpi/button/lid/LID/state") + try: + lidState.getString("open") + return checkForOpen + except V7CommandException, e: + if self.debug != Constants.off: + print e + + return not checkForOpen +
def run(self): FAILED = 1
Modified: trunk/tests/network/network.py =================================================================== --- trunk/tests/network/network.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/network/network.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -27,7 +27,6 @@ from v7.tags import Constants, DeviceClass from v7.hal import Hal from v7.test import Test, TestTag -from v7.v7kudzu import Kudzu from v7.command import Command, V7CommandException from v7.environment import Environment from v7.hash import hashModule @@ -67,14 +66,13 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): tests = dict() + devices = planner.getHalDeviceDetector().getDevices() for device in devices: logicalDevice = None if "net" in device.getProperty("info.capabilities") and not "xen" in device.getProperty("net.physical_device"): logicalDevice = device.getProperty('net.interface') - elif device.getProperty("class") == Kudzu.classNetwork: - logicalDevice = device.getProperty('device')
""" if network logical device was found, and not already planned, and it's not in the ignore list, add it""" @@ -753,15 +751,7 @@ except V7CommandException: print "Warning: could not determine MAC address"
- try: - kudzu = Command("kudzu -p -c NETWORK ") - kudzu.run() - print "+-----Kudzu-----+" - kudzu.printOutput() - print "" - except V7CommandException, exception: - # ignore kudzu if it errors - pass + print "+-----dmesg-----+" Command("cat /var/log/dmesg | grep %s" % self.interface).echoIgnoreErrors() print ""
Modified: trunk/tests/pccard/pccard.py =================================================================== --- trunk/tests/pccard/pccard.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/pccard/pccard.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -29,11 +29,11 @@ return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): properties = dict() properties['pci.device_subclass'] = 7 properties['pci.device_class'] = 6 - return self.planWith(devices, properties, all=False, strict=True) + return self.planWith(planner.getHalDeviceDetector(), properties, all=False, strict=True)
def run(self): try:
Modified: trunk/tests/profiler/profiler.py =================================================================== --- trunk/tests/profiler/profiler.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/profiler/profiler.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -30,7 +30,7 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner):
tests = list() # don't run on FV or PV
Modified: trunk/tests/reboot/reboot.py =================================================================== --- trunk/tests/reboot/reboot.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/reboot/reboot.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -42,7 +42,7 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): tests = list() # manual planning only return tests
Modified: trunk/tests/rteval/v7_rteval.py =================================================================== --- trunk/tests/rteval/v7_rteval.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/rteval/v7_rteval.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -61,7 +61,7 @@ return None
- def plan(self, devices): + def plan(self, planner): ret = list() if not self.realtime: return ret
Modified: trunk/tests/storage/storage.py =================================================================== --- trunk/tests/storage/storage.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/storage/storage.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -43,81 +43,73 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): tests = dict() self.controllers = '' + self.planUDisks(planner, tests) + self.planHAL(planner, tests) + + + return tests.values() + + def planUDisks(self, planner, tests): + + devices = planner.getUDisksDeviceDetector().getDevices() for device in devices: - disk = self.planUDisks(device, devices) - - if not disk: - disk = self.planHAL(device, devices) - - if not disk: - disk = self.planKudzu(device) - - + disk = None + if isinstance(device, UDisksDrive): + if device.getProperty("DeviceIsPartitionTable"): + disk = device.getProperty("DeviceFile") + # get rid of the "/dev/" + if '/'in disk: + disk = disk.split('/')[-1] if disk and not disk in tests: test = self.makeCopy() test.setDevice(device) test.setLogicalDeviceName(disk) tests[disk] = test - return tests.values() - - def planUDisks(self, device, devices): - disk = None - if isinstance(device, UDisksDrive): - if device.getProperty("DeviceIsPartitionTable"): - disk = device.getProperty("DeviceFile") - # get rid of the "/dev/" - if '/'in disk: - disk = disk.split('/')[-1] - return disk - - def planHAL(self, device, devices): - disk = None - if 'storage' in device.getProperty("info.capabilities") and device.getProperty("storage.drive_type") in ["disk", "sd_mmc"]: - disk = device.getProperty("block.device") - # bug#437866 , plan by each controller, block device's parent is the HD, HD's parent is the controller, so need to track back twice - # what's the HD's ID ? - blockDeviceParent = device.getProperty("info.parent") - # and what's the HD's parent's ID ? - controllerId = 'none' - for deviceItem in devices: - if blockDeviceParent in deviceItem.getProperty("info.udi"): - # then the contoller's ID is found - controllerId = deviceItem.getProperty("info.parent") - continue - if controllerId in self.controllers: - print "the controller %s is already in testplan, will skip the block device %s" % (controllerId, disk) - disk = '' - else: - # add the controller to the plan and record it - self.controllers = self.controllers + ', ' + controllerId - # chop off /dev/ (5 characters) - if disk and len(disk) > 5: - disk = disk[5:] - # handle cciss devices - elif device.getProperty("info.linux.driver") == "cciss": - sysfsPath = device.getProperty("pci.linux.sysfs_path") - # grep for the block device name, if one cciss controller has - # multiple "drives" attached, we pick only one(the first one) to test - storageDevice = commands.getoutput("ls %s | grep block | head -n 1 | colrm 1 12" % sysfsPath) - disk = 'cciss/' + storageDevice
- return disk +
- def planKudzu(self, device): + def planHAL(self, planner, tests): disk = None - if "HD" in device.getPropertyString("class"): - if "SERVERAID" in device.getProperty("desc"): - disk = device.getProperty("device") - elif "cciss" in device.getProperty("device"): - disk = device.getProperty("device") # the value should be something like 'cciss/c0d0' etc. - else: - disk = device.getProperty("device") + devices = planner.getHalDeviceDetector().getDevices() + for device in devices: + disk = None + if 'storage' in device.getProperty("info.capabilities") and device.getProperty("storage.drive_type") in ["disk", "sd_mmc"]: + disk = device.getProperty("block.device") + # bug#437866 , plan by each controller, block device's parent is the HD, HD's parent is the controller, so need to track back twice + # what's the HD's ID ? + blockDeviceParent = device.getProperty("info.parent") + # and what's the HD's parent's ID ? + controllerId = 'none' + for deviceItem in devices: + if blockDeviceParent in deviceItem.getProperty("info.udi"): + # then the contoller's ID is found + controllerId = deviceItem.getProperty("info.parent") + continue + if controllerId in self.controllers: + print "the controller %s is already in testplan, will skip the block device %s" % (controllerId, disk) + disk = '' + else: + # add the controller to the plan and record it + self.controllers = self.controllers + ', ' + controllerId + # chop off /dev/ (5 characters) + if disk and len(disk) > 5: + disk = disk[5:] + # handle cciss devices + elif device.getProperty("info.linux.driver") == "cciss": + sysfsPath = device.getProperty("pci.linux.sysfs_path") + # grep for the block device name, if one cciss controller has + # multiple "drives" attached, we pick only one(the first one) to test + storageDevice = commands.getoutput("ls %s | grep block | head -n 1 | colrm 1 12" % sysfsPath) + disk = 'cciss/' + storageDevice + + if disk and not disk in tests: + test = self.makeCopy() + test.setDevice(device) + test.setLogicalDeviceName(disk)
- return disk -
def doDt(self, minBs, maxBs, size, options): """Helper function: run dt with various block sizes and reasonable defaults."""
Modified: trunk/tests/suspend/suspend.py =================================================================== --- trunk/tests/suspend/suspend.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/suspend/suspend.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -41,9 +41,10 @@ def tags(self): return [TestTag.interactive, TestTag.certification, TestTag.portable]
- def plan(self, devices): + def plan(self, planner): tests = list() acAdapterDevice = None + devices = planner.getHalDeviceDetector().getDevices() for device in devices: if 'battery' in device.getProperty("info.category"): test = self.makeCopy()
Modified: trunk/tests/tape/tape.py =================================================================== --- trunk/tests/tape/tape.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/tape/tape.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -35,8 +35,9 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): tests = list() + devices = planner.getHalDeviceDetector().getDevices() for device in devices: if 'tape' in device.getProperty("storage.drive_type") == 7 or device.getProperty("info.linux.driver") == 'st' or device.getProperty("info.linux.driver")[0:4] == 'tape': test = self.makeCopy()
Modified: trunk/tests/usb/usb.py =================================================================== --- trunk/tests/usb/usb.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/usb/usb.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -53,10 +53,11 @@ self.requires = ""
- def plan(self, devices): + def plan(self, planner): tests = list() isXenGuest = False hasUSB = False + devices = planner.getHalDeviceDetector().getDevices() # run if there's a device with info.product == usb and it's not a Xen guest. for device in devices: if device.getProperty("info.product") == "Computer" and device.getProperty("smbios.bios.vendor") == "Xen":
Modified: trunk/tests/video/video.py =================================================================== --- trunk/tests/video/video.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/video/video.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -59,16 +59,12 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): # HAL discovery properties = dict() properties["pci.device_subclass"] = 0 properties["pci.device_class"] = 3 - tests = self.planWith(devices, properties, all=False, strict=True) - # Kudzu Discovery - properties = dict() - properties["class"] = "VIDEO" - tests.extend(self.planWith(devices, properties, all=False, strict=True)) + tests = self.planWith(planner.getHalDeviceDetector(), properties, all=False, strict=True) return tests
def getRequiredRPMs(self):
Modified: trunk/tests/wlan/wlan.py =================================================================== --- trunk/tests/wlan/wlan.py 2012-08-02 18:26:26 UTC (rev 1357) +++ trunk/tests/wlan/wlan.py 2012-08-02 18:27:47 UTC (rev 1358) @@ -26,7 +26,6 @@ from v7.tags import Constants, DeviceClass from v7.hal import Hal from v7.test import Test, TestTag -from v7.v7kudzu import Kudzu from v7.command import Command, V7CommandException from v7.environment import Environment
@@ -44,14 +43,13 @@ def tags(self): return [TestTag.noninteractive, TestTag.certification]
- def plan(self, devices): + def plan(self, planner): tests = dict() + devices = planner.getUdevDeviceDetector().getDevices() for device in devices: logicalDevice = None - if "net" in device.getProperty("info.capabilities") and not "xen" in device.getProperty("net.physical_device"): - logicalDevice = device.getProperty('net.interface') - elif device.getProperty("class") == Kudzu.classNetwork: - logicalDevice = device.getProperty('device') + if "net" == device.getProperty("SUBSYSTEM"): + logicalDevice = device.getProperty('INTERFACE')
""" if network logical device was found, and not already planned, and it's not in the ignore list, add it"""