r1361 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-08-23 18:28:23 +0000 (Thu, 23 Aug 2012)
New Revision: 1361
Modified:
trunk/Makefile
Log:
R1
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2012-08-02 18:46:13 UTC (rev 1360)
+++ trunk/Makefile 2012-08-23 18:28:23 UTC (rev 1361)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.6.4
-V7_RELEASE := 0
+V7_RELEASE := 1
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
11 years, 8 months
r1360 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-08-02 18:46:13 +0000 (Thu, 02 Aug 2012)
New Revision: 1360
Added:
tags/v7-V1-6.4R0/
Log:
tag version
11 years, 9 months
r1359 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-08-02 18:45:12 +0000 (Thu, 02 Aug 2012)
New Revision: 1359
Modified:
trunk/v7.spec.in
Log:
changelog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2012-08-02 18:27:47 UTC (rev 1358)
+++ trunk/v7.spec.in 2012-08-02 18:45:12 UTC (rev 1359)
@@ -80,6 +80,12 @@
%changelog
+* Thu Aug 02 2012 Greg Nichols <gnichols(a)redhat.com>
+
+V7 1.6.4 R0
+
+ 843565 - v7 test planning should not use a generic device dictionary
+
* Fri Jun 01 2012 Greg Nichols <gnichols(a)redhat.com>
V7 1.5 R32
11 years, 9 months
r1358 - in trunk/tests: audio battery cpuscaling expresscard fencing hwlatdetect infiniband info kdump lid network pccard profiler reboot rteval storage suspend tape usb video wlan
by gnichols@fedoraproject.org
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"""
11 years, 9 months
r1357 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-08-02 18:26:26 +0000 (Thu, 02 Aug 2012)
New Revision: 1357
Removed:
trunk/v7/v7kudzu.py
Modified:
trunk/v7/certificationtest.py
trunk/v7/device.py
trunk/v7/deviceDetector.py
trunk/v7/deviceclassdocument.py
trunk/v7/documentbase.py
trunk/v7/fvtest.py
trunk/v7/hardwaretest.py
trunk/v7/opticalDiskTest.py
trunk/v7/planner.py
trunk/v7/procDeviceDetector.py
trunk/v7/tags.py
trunk/v7/test.py
trunk/v7/udevDeviceDetector.py
Log:
843565 - v7 test planning should not use a generic device dictionary
Modified: trunk/v7/certificationtest.py
===================================================================
--- trunk/v7/certificationtest.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/certificationtest.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -197,10 +197,7 @@
def appendDevice(self, device):
for name in self.deviceClasses:
- if self.deviceClasses[name].registerDevice(device):
- print "%s registered device %s" % (name, device.getUDI())
- pass
-
+ self.deviceClasses[name].registerDevice(device)
def appendTest(self, test):
Modified: trunk/v7/device.py
===================================================================
--- trunk/v7/device.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/device.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -79,7 +79,8 @@
return self.properties
def dump(self):
- output = ""
+ output = "\n%s device: %s" % (self.getSource(), self.getUDI())
+ output += "\n------------------------------------------------------\n"
for (key, value) in self.properties.iteritems():
output += "%s " % key
output += value
@@ -118,34 +119,10 @@
#otherwise
return ""
-
-class KudzuDevice(Device):
- def __init__(self, properties=None):
- Device.__init__(self, None, properties=properties)
- self.udi = self.getProperty("udi")
-
- def getSource(self):
- return Constants.kudzu
- def getProduct(self):
- return ""
-
- def write(self, file):
- separator = " : "
- quote = "\'"
- file.write("\'class\' : \'%s\'\n" % self.getClass())
- keys = self.properties.keys()
- keys.sort()
- for key in keys:
- file.write(" %s%s%s%s" % (quote, key, quote, separator))
- if self.properties[key]:
- file.write("%s%s%s" % (quote, self.properties[key], quote))
- file.write("\n")
- file.write("\n\n")
-
class ProcDevice(Device):
def __init__(self, properties=None):
- Device.__init__(self, 'SerialNumber', properties)
+ Device.__init__(self, 'Sysfs', properties)
def getSource(self):
return Constants.proc
@@ -156,8 +133,7 @@
class UdevDevice(Device):
def __init__(self, properties=None):
- #udiSynonym is None - detector sets it after-the-fact with "P:"
- Device.__init__(self, None, properties)
+ Device.__init__(self, "DEVPATH", properties)
def getSource(self):
return Constants.udev
Modified: trunk/v7/deviceDetector.py
===================================================================
--- trunk/v7/deviceDetector.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/deviceDetector.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
#
# DeviceDetector is an abstract base class for classes using various
-# means to detect hardware devices, such as HAL, Kudzu, or the /proc filesystem.
+# means to detect hardware devices, such as HAL, or the /proc filesystem.
import string, os, sys, copy
Modified: trunk/v7/deviceclassdocument.py
===================================================================
--- trunk/v7/deviceclassdocument.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/deviceclassdocument.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -174,8 +174,6 @@
and ('processor' in device.getProperty("info.category")
or device.getProperty("info.product") == "Computer")):
return True
- if (device.getSource() == Constants.kudzu and device.getProperty("class") == "CPU"):
- return True
if (device.getSource() == Constants.udev and device.getProperty("DRIVER") == "processor"):
return True
return False
@@ -255,9 +253,7 @@
# pick up the controller(s) - 1 is Mass Storage
or device.getProperty("pci.device_class") == PCIDeviceClass.massStorage)):
return True
- if (device.getSource() == Constants.kudzu
- and device.getPropertyString("class") in ["HD", "IDE", "SCSI", "RAID"]):
- return True
+
if (device.getSource() == Constants.udev
and device.getProperty("MAJOR") in [DeviceNumberMajor.scsiBlock, DeviceNumberMajor.ideBlock]):
return True
@@ -276,8 +272,6 @@
def hasDevice(self, device):
if device.getSource() == Constants.hal and 'storage.cdrom' in device.getProperty("info.capabilities"):
return True
- if device.getSource() == Constants.kudzu and 'CDROM' in device.getProperty("class"):
- return True
if (device.getSource() == Constants.udev
and (device.getProperty("DEVTYPE") == 'disk' and device.getProperty("ID_CDROM") == "1")):
return True
@@ -321,8 +315,6 @@
def hasDevice(self, device):
if device.getSource() == Constants.hal and "net" in device.getProperty("info.capabilities"):
return True
- if device.getSource() == Constants.kudzu and device.getProperty("class").lower() == "network":
- return True
if device.getSource() == Constants.udev and device.getProperty("INTERFACE") != "":
return True
return False
Modified: trunk/v7/documentbase.py
===================================================================
--- trunk/v7/documentbase.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/documentbase.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -20,7 +20,7 @@
import xml.dom.ext
from tags import Tags, Attributes, Constants
import version
-from device import Device, HalDevice, ProcDevice, KudzuDevice, UdevDevice
+from device import Device, HalDevice, ProcDevice, UdevDevice
from command import Command, V7CommandException
class DocumentWrapper:
@@ -191,8 +191,6 @@
return ProcDevice(properties)
elif source == Constants.udev:
return UdevDevice(properties)
- elif source == Constants.kudzu:
- return KudzuDevice(properties)
# should never, ever get here!
print "Error: unknown device source %s" % source
Modified: trunk/v7/fvtest.py
===================================================================
--- trunk/v7/fvtest.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/fvtest.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -169,7 +169,7 @@
self.__setUpHypervisor()
- def plan(self, devices):
+ def plan(self, planner):
tests = list()
osSupport = False
# if Red Hat and not RT kernel
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/hardwaretest.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -39,7 +39,6 @@
from v7.planner import Planner
import v7.version
from v7.hal import Hal
-from v7.v7kudzu import Kudzu
from v7.device import Device, HalDevice
from v7.command import Command, V7CommandException
from v7.resultsengine import ResultsEngine
@@ -833,17 +832,7 @@
except dbus_bindings.DBusException, e:
print "Test error: %s" % e
syslog.syslog("Test error: %s" % e)
- success = False
-
- # use Kudzu for old rhr's hardware.out
- if self.redHatRelease.getVersion() <= 6:
- if self.debugLevel != Constants.off:
- print "Getting devices from kudzu"
- kudzu = Kudzu()
- if not kudzu.isValid():
- success = False
- else:
- run.appendDevices(deviceClass.getDevicesFromDetector(kudzu))
+ success = False
return success
Modified: trunk/v7/opticalDiskTest.py
===================================================================
--- trunk/v7/opticalDiskTest.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/opticalDiskTest.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -32,7 +32,6 @@
from v7.hal import Hal
from v7.device import Device
from v7.command import Command, V7CommandException
-from v7.v7kudzu import Kudzu
from v7.redhatrelease import RedHatRelease
class OpticalDiskTest(Test):
@@ -43,9 +42,6 @@
self.supportedMedia = None
self.deviceClass = "CDROM"
self.deviceDetector = Hal()
- devices = self.deviceDetector.getDevices()
- if len(devices) is 0:
- self.deviceDetector = Kudzu()
def hasAnyCDROMType(self, device):
for type in self.mediaTypes:
@@ -67,8 +63,9 @@
return disk
return None
- def plan(self, devices):
+ def plan(self, planner):
tests = dict()
+ devices = planner.getHalDeviceDetector().getDevices()
for device in devices:
disk = None
if 'storage.cdrom' in device.getProperty("info.capabilities") and self.hasAnyCDROMType(device):
Modified: trunk/v7/planner.py
===================================================================
--- trunk/v7/planner.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/planner.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -25,7 +25,6 @@
from v7.opticalDiskTest import OpticalDiskTest
from v7.fvtest import FvTest
from v7.hal import Hal
-from v7.v7kudzu import Kudzu
from v7.udevDeviceDetector import UdevDeviceDetector
from v7.procDeviceDetector import ProcDeviceDetector
from v7.udisksDeviceDetector import UDisksDeviceDetector
@@ -47,6 +46,27 @@
self.virtualization = virtualization
self.plannedTests = list()
self.redHatRelease = redHatRelease
+ self.__initializeDeviceDetectors()
+
+ def __initializeDeviceDetectors(self):
+ self.deviceDetectors = dict()
+ detector = Hal()
+ self.deviceDetectors[detector.getName()] = detector
+ detector = UdevDeviceDetector()
+ self.deviceDetectors[detector.getName()] = detector
+ detector = ProcDeviceDetector()
+ self.deviceDetectors[detector.getName()] = detector
+ detector = UDisksDeviceDetector()
+ self.deviceDetectors[detector.getName()] = detector
+
+ def getHalDeviceDetector(self):
+ return self.deviceDetectors[Constants.hal]
+ def getUdevDeviceDetector(self):
+ return self.deviceDetectors[Constants.udev]
+ def getProcDeviceDetector(self):
+ return self.deviceDetectors[Constants.proc]
+ def getUDisksDeviceDetector(self):
+ return self.deviceDetectors[Constants.udisks]
def analyse(self, testDirectory):
"""Walk through the test directory looking for v7.Test classes"""
@@ -91,13 +111,13 @@
if self.Debugging:
print "...Done."
- def __plan(self, devices):
+ def __plan(self):
tests = list()
for test in self.deviceTests:
if self.Debugging: print "Planning test %s" % test.Name()
- someTests = test.plan(self.devices)
+ someTests = test.plan(self)
if someTests:
if self.Debugging: print " planned %u tests" % len(someTests)
tests.extend(someTests)
@@ -112,8 +132,7 @@
return tests
def plan(self):
- self.__loadDevices()
- self.plannedTests = self.__plan(self.devices)
+ self.plannedTests = self.__plan()
return self.plannedTests
def __loadDevices(self):
@@ -123,13 +142,8 @@
self.devices.extend(udev.getDevices())
proc = ProcDeviceDetector()
self.devices.extend(proc.getDevices())
- if not hal.enabled:
- kudzu = Kudzu()
- self.devices.extend(kudzu.getDevices())
- # run udisks only on RHEL 6 and beyond
- if not "Red Hat Enterprise Linux" in self.redHatRelease.getProduct() or self.redHatRelease.getVersion() > 5:
- udisks = UDisksDeviceDetector()
- self.devices.extend(udisks.getDevices())
+ udisks = UDisksDeviceDetector()
+ self.devices.extend(udisks.getDevices())
def getTestsFor(self, device):
devices = list()
Modified: trunk/v7/procDeviceDetector.py
===================================================================
--- trunk/v7/procDeviceDetector.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/procDeviceDetector.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -11,22 +11,27 @@
class ProcDeviceDetector(DeviceDetector):
"A class for detecting devices via the /proc file system"
+ # some well-known paths into proc
+ inputBusPath = "/proc/bus/input/devices"
+ # pciBusPath = "/proc/bus/pci/devices" - different syntax, nothing to parse this yet. See lspci
def __init__(self):
DeviceDetector.__init__(self, name=Constants.proc)
- self.usbPath = "/proc/bus/usb/devices"
self.nextKey = None
+ self.devices = None
+ self.path = None
+
+ def loadDevices(self, path):
+ self.path = path
+ self.devices = list()
self.__loadDevices()
+ return self.devices
def __loadDevices(self):
- self.devices = list()
- self.__loadUsbDevices()
-
- def __loadUsbDevices(self):
# treat the file as a bunch of attrubute=value strings
- # sepearated by blank lines for each device
+ # seperated by blank lines for each device
try:
- pipe = Command("cat " + self.usbPath)
+ pipe = Command("cat " + self.path)
pipe.start()
properties = dict()
while 1:
@@ -83,12 +88,18 @@
def getDevices(self):
- self.__loadDevices()
return self.devices
+
+ def getDevice(self, udi):
+ if self.devices:
+ for device in self.devices:
+ if device.hasPropertyValue(udi):
+ return device
+ # otherwise
+ return None
def dump(self):
- self.__loadDevices()
for device in self.devices:
print device.getProperties()
@@ -124,5 +135,6 @@
if __name__ == "__main__":
- detector=ProcDeviceDetector("/proc/bus/usb/devices")
+ detector=ProcDeviceDetector()
+ detector.loadDevices(ProcDeviceDetector.inputBusPath)
print detector.dump()
Modified: trunk/v7/tags.py
===================================================================
--- trunk/v7/tags.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/tags.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -33,7 +33,6 @@
test="test"
hal="hal"
udisks="udisks"
- kudzu="kudzu"
system="system"
output="output"
summary="summary"
@@ -146,7 +145,6 @@
ALL = "ALL"
hal = "hal"
udisks="udisks"
- kudzu = "kudzu"
proc = "proc"
user = "user"
DEVICE = "DEVICE"
Modified: trunk/v7/test.py
===================================================================
--- trunk/v7/test.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/test.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -47,7 +47,7 @@
self.deviceClass = None
self.logicalDeviceName = ""
self.mandatory = None # either pre or post for mandatory tests (for each run)
- self.source = None # either hal, kudzu, or manual
+ self.source = None # either hal, udev, udisks, etc, or manual
self.marking = False # is <output> sub-section currently active?
@@ -224,7 +224,7 @@
def install(self):
pass
- def plan(self, devices):
+ def plan(self, planner):
""" returns a list of test instances for the input list of
device objects (v7.device)
This default implementation plans the test once, independant of device """
@@ -232,11 +232,12 @@
tests.append(self.makeCopy())
return tests
- def planWith(self, devices, properties, all=True, strict=False):
+ def planWith(self, detector, properties, all=True, strict=False):
""" Plan for devices matching any property.
if all is true, multiple devices that match will be planned
if strict is true, all properties must match. """
tests = list()
+ devices = detector.getDevices()
for device in devices:
match = False
for key in properties.keys():
Modified: trunk/v7/udevDeviceDetector.py
===================================================================
--- trunk/v7/udevDeviceDetector.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/udevDeviceDetector.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -10,6 +10,7 @@
from v7.deviceDetector import DeviceDetector
from v7.tags import Constants
from v7.documentbase import DocumentWrapper
+from v7.command import Command
class UdevDeviceDetector(DeviceDetector):
"A class for working with udev."
@@ -92,5 +93,5 @@
if __name__ == "__main__":
udev = UdevDeviceDetector()
- for device in udev.getAllDevices():
+ for device in udev.getDevices():
print device.dump()
Deleted: trunk/v7/v7kudzu.py
===================================================================
--- trunk/v7/v7kudzu.py 2012-07-18 15:56:20 UTC (rev 1356)
+++ trunk/v7/v7kudzu.py 2012-08-02 18:26:26 UTC (rev 1357)
@@ -1,111 +0,0 @@
-#!/usr/bin/python
-#
-# Author: Greg Nichols
-
-import os
-
-from v7.device import KudzuDevice
-from v7.deviceDetector import DeviceDetector
-from v7.tags import Constants
-from v7.certificationtest import DocumentWrapper
-
-class Kudzu(DeviceDetector):
- "A class for working with Kudzu."
-
- classNetwork = "NETWORK"
-
- def __init__(self):
- DeviceDetector.__init__(self, name=Constants.kudzu)
- self.devices = None
-
- def isValid(self):
- self.getDevices()
- return self.devices and len(self.devices) > 0
-
-
- def getDevices(self):
- if self.devices is not None:
- return self.devices
- # otherwise
- self.devices = list()
- if os.path.exists("/usr/share/rhn/up2date_client/hardware.py"):
- self.__getDevices("python /usr/share/rhn/up2date_client/hardware.py", "\n")
- else:
- print "Warning: no command /usr/share/rhn/up2date_client/hardware.py"
-
- self.__getDevices("kudzu -p", "-\n")
- return self.devices
-
- def __getDevices(self, command, recordSeparator):
- self.hardwareCommand = command
- self.recordSeparator = recordSeparator
- pipe = os.popen(self.hardwareCommand)
-
- properties = dict()
- docWrapper = DocumentWrapper()
- while 1:
- line = pipe.readline()
- if line:
- if line == self.recordSeparator:
- if len(properties) > 0:
- self.devices.append(KudzuDevice(properties))
- properties = dict()
- else:
- line = docWrapper.removeBadCharacters(line)
- keyvalue = line.split(":", 1)
- if len(keyvalue) is 2:
- # strip leading and trailing spaces, single quotes, and newlines.
- key = keyvalue[0].strip('\ \'\n')
- value = keyvalue[1].strip('\ \'\n')
- properties[key] = value
- else:
- break
-
- pipe.close()
-
- return self.devices
-
- def getDevice(self, udi):
- for device in self.getDevices():
- if device.getProperty("udi") == udi:
- return KudzuDevice(device)
- return None
-
- def dump(self):
- for device in self.getDevices():
- print device.getProperties()
-
- def dumpDevice(self, className=None, busName=None, logicalDeviceName=None):
- output = ""
- if not className and not busName and not logicalDeviceName:
- return ""
-
- for device in self.devices:
- if logicalDeviceName:
- if device.hasPropertyValue(logicalDeviceName):
- output += device.dump()
- if className:
- if device.getClass() == className:
- output += device.dump()
- if busName:
- if device.getBus() == busName:
- output += device.dump()
- return output
-
- def getProduct(self, device):
- return device.getProperty("desc")
-
- def getPCIBusAndID(self, device):
- """rely on Kudzu to check PCI info"""
- try:
- domAndBus = "%s:%s" % (device.getProperty('pcidom'), device.getProperty('pcibus'))
- devAndFn = "%s.%s" % (device.getProperty('pcidev'), device.getProperty('pcifn'))
- deviceID = "%s:%s" % (domAndBus, devAndFn)
- return (domAndBus, devAndFn, deviceID)
- except:
- pass
- return None
-
-if __name__ == "__main__":
- kudzu=Kudzu()
- print kudzu.dump()
11 years, 9 months