r1380 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-25 14:46:56 +0000 (Tue, 25 Sep 2012)
New Revision: 1380
Added:
tags/v7-V1-6.4R3/
Log:
tag version
11 years, 7 months
r1379 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-25 14:46:05 +0000 (Tue, 25 Sep 2012)
New Revision: 1379
Modified:
trunk/v7.spec.in
Log:
changelog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2012-09-25 14:45:42 UTC (rev 1378)
+++ trunk/v7.spec.in 2012-09-25 14:46:05 UTC (rev 1379)
@@ -80,6 +80,12 @@
%changelog
+* Wed Sep 19 2012 Greg Nichols <gnichols(a)redhat.com>
+
+V7 1.6.4 R3
+
+ 843605 - expresscard test should not use HAL
+
* Mon Aug 27 2012 Greg Nichols <gnichols(a)redhat.com>
V7 1.6.4 R2
11 years, 7 months
r1378 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-25 14:45:42 +0000 (Tue, 25 Sep 2012)
New Revision: 1378
Modified:
trunk/Makefile
Log:
R3
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2012-09-19 15:38:04 UTC (rev 1377)
+++ trunk/Makefile 2012-09-25 14:45:42 UTC (rev 1378)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.6.4
-V7_RELEASE := 2
+V7_RELEASE := 3
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, 7 months
r1377 - trunk/tests/expresscard
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-19 15:38:04 +0000 (Wed, 19 Sep 2012)
New Revision: 1377
Removed:
trunk/tests/expresscard/runtest.sh
Modified:
trunk/tests/expresscard/Makefile
trunk/tests/expresscard/expresscard.py
Log:
843605 - expresscard test should not use HAL
Modified: trunk/tests/expresscard/Makefile
===================================================================
--- trunk/tests/expresscard/Makefile 2012-09-06 15:43:38 UTC (rev 1376)
+++ trunk/tests/expresscard/Makefile 2012-09-19 15:38:04 UTC (rev 1377)
@@ -15,17 +15,15 @@
.PHONY: all install download clean
-FILES=$(METADATA) runtest.sh expresscard.py
+FILES=expresscard.py
run: $(FILES) build
- ./runtest.sh
build: $(BUILT_FILES)
- chmod a+x ./runtest.sh ./expresscard.py
+ chmod a+x ./expresscard.py
clean:
rm -f $(BUILT_FILES)
# Include Common Makefile
include $(DESTDIR)/usr/share/v7/lib/v7-make.include
-
Modified: trunk/tests/expresscard/expresscard.py
===================================================================
--- trunk/tests/expresscard/expresscard.py 2012-09-06 15:43:38 UTC (rev 1376)
+++ trunk/tests/expresscard/expresscard.py 2012-09-19 15:38:04 UTC (rev 1377)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
-# is made available to anyone wishing to use, modify, copy, or
-# redistribute it subject to the terms and conditions of the GNU General
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -20,116 +20,105 @@
import string
import signal
import sys
-import commands
+import commands
import re
import time
import dbus
import curses
from v7.tags import Constants, DeviceClass
-from v7.hal import Hal
-from v7.procDeviceDetector import ProcDeviceDetector
from v7.test import Test
from v7.device import Device
from v7.usbTest import USBTestBase
+from v7.command import Command
class ExpressCardTest(USBTestBase):
def __init__(self):
USBTestBase.__init__(self, name="expresscard")
self.deviceClass = DeviceClass.expresscard
-
-
+ self.lspciCommand = "lspci -D"
+
+ def getRequiredRPMs(self):
+ return ["pciutils"]
+
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
- if device.getProperty("info.bus") == "usb":
- hasUSB = True
- if 'battery' in device.getProperty("info.category"):
- hasBattery = True
- if device.getProperty("info.linux.driver") in ["pcieport-driver", "pcieport"]:
- hasPCIE = True
- if hasUSB and hasBattery and hasPCIE and not isXenGuest:
- test = self.makeCopy()
- tests.append(test)
+ # manually planned for now
return tests
def getPCIDevices(self):
-
- self.deviceDetector = Hal()
- devices = self.deviceDetector.getDevices()
+ devices = list()
+ pattern = re.compile("(?P<id>[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]) (?P<name>.*$)")
+ try:
+ pipe = Command(self.lspciCommand)
+ pipe.start()
+ while 1:
+ line = pipe.readline()
+ if not line or line.strip() == "":
+ break
+ match = pattern.match(line)
+ # every list is a tuple containing information like:
+ # ('00:00.0','Host bridge: Intel Corporation Core Processor DRAM Controller (rev 02)')
+ dev = match.groups()
+ devices.append(dev)
+ except Exception, e:
+ print "Error: could not read PCI device from lspci command"
+ print e
+ return None
+
return devices
-
- def checkAllPCIPlugged(self):
+ def checkAllPCIUnplugged(self):
devices = self.getPCIDevices()
+ if not devices:
+ return None
self.pluggedInPCIDevices = list()
- returnValue = True
for dev in devices:
- found = self.deviceDetector.getPCIBusAndID(dev)
- if found:
- (domAndBus, devAndFn, deviceID) = found
- self.pluggedInPCIDevices.append(deviceID)
- if domAndBus and devAndFn:
- try:
- print " %s appears to be attached on PCI bus: %s:%s" % (self.deviceDetector.getProduct(dev), domAndBus, devAndFn)
- except KeyError:
- pass
+ (id, name) = dev
+ if id:
+ self.pluggedInPCIDevices.append(id)
+ print " %s appears to be attached on PCI bus: %s" % (name, id)
def addNewPCIPlugged(self, verifiedDevices):
devices = self.getPCIDevices()
+ if not devices:
+ return None
for dev in devices:
- found = self.deviceDetector.getPCIBusAndID(dev)
- if found:
- (domAndBus, devAndFn, deviceID) = found
- if (not deviceID in self.pluggedInPCIDevices) and domAndBus and devAndFn:
- if deviceID in verifiedDevices:
- print "\n Note: Same device been plugged into the same slot.\n"
- return None
- else:
- deviceName = self.deviceDetector.getProduct(dev)
- if deviceName == "":
- deviceName = deviceID
- print "\n Device attached to PCI bus: \
- \n %s appears to be attached on PCI bus: %s:%s" % (self.deviceDetector.getProduct(dev), domAndBus, devAndFn)
- return (domAndBus, devAndFn, deviceID)
+ (id, name) = dev
+ # should execute checkAllPCIUnplugged() first
+ if id and not id in self.pluggedInPCIDevices:
+ if id in verifiedDevices:
+ print "\n Note: Same device been plugged into the same slot.\n"
+ return None
+ else:
+ print "\n Device attached to PCI bus: \
+ \n %s appears to be attached on PCI bus: %s" % (name, id)
+ return id
return None
- def confirmPCIUnplugged(self, searchDeviceID):
+ def confirmPCIUnplugged(self, searchID):
devices = self.getPCIDevices()
+ if not devices:
+ return True
for dev in devices:
- found = self.deviceDetector.getPCIBusAndID(dev)
- if found:
- (domAndBus, devAndFn, deviceID) = found
- if deviceID == searchDeviceID:
- return False
+ (id, name) = dev
+ if id == searchID:
+ return False
+
return True
-
def pciInfo(self):
"""return detailed PCI info"""
pciinfo = commands.getoutput("lspci -vvvv")
return pciinfo
- def halInfo(self):
- """return current HAL info"""
- halinfo = commands.getoutput("lshal")
- return halinfo
+ def udevInfo(self):
+ """return current udev info"""
+ udevinfo = commands.getoutput("udevadm info --export-db")
+ return udevinfo
- def kudzuInfo(self):
- """return current Kudzu info"""
- kudzuinfo = commands.getoutput("kudzu -p")
- return kudzuinfo
-
def contextDiff(self, context1, context2):
"""compare two "files" and return the diff parts"""
tmpFile1 = "/tmp/v7ExpressCardTmpFile1"
@@ -161,11 +150,8 @@
print ("\n---- Current USB devices ----")
self.checkAllUSBPortsUnplugged()
- # load the pciehp module on RHEL5 in case it's not loaded yet
- print("\nChecking pciehp module...")
- self.loadKernelModule("pciehp")
print ("\n---- Current PCI devices ----")
- self.checkAllPCIPlugged()
+ self.checkAllPCIUnplugged()
# ask user how many ExpressCard slots are there ?
while True:
self.input = self.prompt("How many ExpressCard slots are there ? ")
@@ -191,13 +177,13 @@
self.count = self.count - 1
self.pciInfoOld = self.pciInfo()
- self.halInfoOld = self.halInfo()
+ self.udevInfoOld = self.udevInfo()
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.udevInfoNew = self.udevInfo()
foundUSB = None
if self.count > 0 or not testedUSB:
@@ -216,43 +202,43 @@
# confirm USB
if foundUSB:
- (busNumber, portNumber, deviceID) = foundUSB
- if self.confirmUSBPortUnplugged(deviceID):
+ deviceID = foundUSB
+ if self.confirmUSBPortUnplugged(searchID=deviceID):
print "Confirmed USB device %s" % deviceID
verifiedDevices.append(deviceID)
self.pluggedInDevices.append(deviceID)
confirmed = True
testedUSB = True
if foundPCIE:
- (busNumber, portNumber, deviceID) = foundPCIE
- if self.confirmPCIUnplugged(deviceID):
+ deviceID = foundPCIE
+ if self.confirmPCIUnplugged(searchID=deviceID):
print "Confirmed PCIE device %s" % deviceID
verifiedDevices.append(deviceID)
self.pluggedInPCIDevices.append(deviceID)
confirmed = True
testedPCIE = True
- if not foundPCIE and not foundUSB:
+ if not foundPCIE and not foundUSB:
print "Error: Did not confirm the device !"
print "Please re-try"
# print out the detailed HW info for reviewers
pciDiff = self.contextDiff(self.pciInfoOld, self.pciInfoNew)
- halDiff = self.contextDiff(self.halInfoOld, self.halInfoNew)
+ udevDiff = self.contextDiff(self.udevInfoOld, self.udevInfoNew)
print "\n========== Detailed HW info ========== \
\n---------- lspci ---------- \
\n%s \
\n-------------------------------------- \
- \n---------- HAL ---------- \
+ \n---------- udev ---------- \
\n%s \
\n-------------------------------------- \
\n======================================\n"\
- % (pciDiff, halDiff)
+ % (pciDiff, udevDiff)
if returnValue == PASSED:
result = "passed"
else:
- returnValue = FAILED
+ returnValue = FAILED
result = "failed"
print "ExpressCard test %s" % result
return returnValue
Deleted: trunk/tests/expresscard/runtest.sh
===================================================================
--- trunk/tests/expresscard/runtest.sh 2012-09-06 15:43:38 UTC (rev 1376)
+++ trunk/tests/expresscard/runtest.sh 2012-09-19 15:38:04 UTC (rev 1377)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-v7-run-simple-test ${TEST:-$(basename $PWD)} ./expresscard.py
11 years, 7 months
r1376 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-06 15:43:38 +0000 (Thu, 06 Sep 2012)
New Revision: 1376
Added:
tags/v7-V1-6.4R2/
Log:
tag version
11 years, 7 months
r1375 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-06 15:41:48 +0000 (Thu, 06 Sep 2012)
New Revision: 1375
Modified:
trunk/v7.spec.in
Log:
changelog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2012-09-06 15:40:10 UTC (rev 1374)
+++ trunk/v7.spec.in 2012-09-06 15:41:48 UTC (rev 1375)
@@ -80,6 +80,18 @@
%changelog
+* Mon Aug 27 2012 Greg Nichols <gnichols(a)redhat.com>
+
+V7 1.6.4 R2
+
+ 843607 - audio test should not use HAL
+ 843609 - network test should not use HAL
+ 822246 - clocktest use of CPUSET_S not completely correct.
+ 843615 - usb test should not use HAL
+ 843604 - battery test should not use HAL
+ 843608 - lid test should not use HAL
+ 843600 - storage test should not use HAL
+
* Thu Aug 23 2012 Greg Nichols <gnichols(a)redhat.com>
V7 1.6.4 R1
11 years, 7 months
r1374 - trunk/tests/storage
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-06 15:40:10 +0000 (Thu, 06 Sep 2012)
New Revision: 1374
Removed:
trunk/tests/storage/runtest.sh
Modified:
trunk/tests/storage/Makefile
trunk/tests/storage/storage.py
Log:
843600 - storage test should not use HAL
Modified: trunk/tests/storage/Makefile
===================================================================
--- trunk/tests/storage/Makefile 2012-09-06 15:26:19 UTC (rev 1373)
+++ trunk/tests/storage/Makefile 2012-09-06 15:40:10 UTC (rev 1374)
@@ -15,17 +15,15 @@
.PHONY: all install download clean
-FILES=runtest.sh storage.py
+FILES=storage.py
run: $(FILES) build
- ./runtest.sh
build: $(BUILT_FILES)
- chmod a+x ./runtest.sh ./storage.py
+ chmod a+x ./storage.py
clean:
rm -f $(BUILT_FILES)
# Include Common Makefile
include $(DESTDIR)/usr/share/v7/lib/v7-make.include
-
Deleted: trunk/tests/storage/runtest.sh
===================================================================
--- trunk/tests/storage/runtest.sh 2012-09-06 15:26:19 UTC (rev 1373)
+++ trunk/tests/storage/runtest.sh 2012-09-06 15:40:10 UTC (rev 1374)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-v7-run-simple-test ${TEST:-$(basename $PWD)} ./storage.py
Modified: trunk/tests/storage/storage.py
===================================================================
--- trunk/tests/storage/storage.py 2012-09-06 15:26:19 UTC (rev 1373)
+++ trunk/tests/storage/storage.py 2012-09-06 15:40:10 UTC (rev 1374)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
-# is made available to anyone wishing to use, modify, copy, or
-# redistribute it subject to the terms and conditions of the GNU General
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -27,7 +27,7 @@
from v7.tags import DeviceClass
from v7.dbusDevice import UDisksDrive
-class StorageTest(Test):
+class StorageTest(Test):
def __init__(self):
Test.__init__(self, name="storage")
@@ -39,7 +39,7 @@
# Maximum size of the test area, in KB. (defaults to 1GB)
self.maxSize = 1048576
self.deviceClass = DeviceClass.hard_disk
-
+
def tags(self):
return [TestTag.noninteractive, TestTag.certification]
@@ -47,13 +47,9 @@
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 = None
@@ -68,49 +64,7 @@
test.setDevice(device)
test.setLogicalDeviceName(disk)
tests[disk] = test
-
-
- def planHAL(self, planner, tests):
- disk = None
- 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)
-
-
def doDt(self, minBs, maxBs, size, options):
"""Helper function: run dt with various block sizes and reasonable defaults."""
records = size * 1024 / maxBs
@@ -136,7 +90,7 @@
if "direct" in otherOptions:
otherOptions = otherOptions + " rlimit=%s" % (size * 1024)
ran_opt = "of=%s iotype=random dispose=keep enable=verify ralign=%s rseed=%s dlimit=%s %s" % (file, minBs, seed, size, otherOptions)
- # start
+ # start
print "--- sequential write/read"
sys.stdout.flush()
returnValue1 = self.doDt(minBs, maxBs, size, seq_opt)
@@ -151,7 +105,7 @@
def devSize(self,testdevice):
# Use 1GB or the device size whichever is smaller.
- size = self.maxSize
+ size = self.maxSize
(status,output) = commands.getstatusoutput("cat /sys/block/%s/size" % testdevice)
# Why is the /sys size value 2x what /proc shows?
if status == 0:
@@ -243,7 +197,7 @@
exception.command.printErrors()
try:
Command("swapon %s" % swaponDevice).run()
- print "done."
+ print "done."
except V7CommandException, exception:
print "Error: could not restore swap"
print exception
@@ -509,7 +463,7 @@
if returnValue == 0:
result = "passed"
else:
- returnValue = 1
+ returnValue = 1
result = "failed"
print "\nStorage test on device %s %s" % (storageDevice, result)
return (returnValue == 0)
11 years, 7 months
r1373 - trunk/tests/battery
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-06 15:26:19 +0000 (Thu, 06 Sep 2012)
New Revision: 1373
Removed:
trunk/tests/battery/runtest.sh
Modified:
trunk/tests/battery/battery.py
Log:
843604 - battery test should not use HAL
Modified: trunk/tests/battery/battery.py
===================================================================
--- trunk/tests/battery/battery.py 2012-09-06 15:11:11 UTC (rev 1372)
+++ trunk/tests/battery/battery.py 2012-09-06 15:26:19 UTC (rev 1373)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
-# is made available to anyone wishing to use, modify, copy, or
-# redistribute it subject to the terms and conditions of the GNU General
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -18,179 +18,183 @@
from v7.test import Test
from v7.tags import Constants, DeviceClass, TestTag
-from v7.hal import Hal
+from v7.udevDeviceDetector import UdevDeviceDetector
-class BatteryTest(Test):
-
+class BatteryTest(Test):
+
def __init__(self):
Test.__init__(self, name="battery")
self.acAdapterDevice = None
self.deviceClass = DeviceClass.battery
-
+ self.unitFactor = 1000 # parse from mu-Ah to mAh
+ self.units = "mAh"
+
def tags(self):
- return [TestTag.interactive, TestTag.certification, TestTag.portable]
-
+ return [TestTag.interactive, TestTag.certification, TestTag.portable]
+
def setACAdapterDevice(self, device):
self.acAdapterDevice = device
def getACAdapterDevice(self):
return self.acAdapterDevice
-
+
def plan(self, planner):
tests = list()
acAdapterDevice = None
- devices = planner.getHalDeviceDetector().getDevices()
+ devices = planner.getUdevDeviceDetector().getDevices()
for device in devices:
- if 'battery' in device.getProperty("info.category") and device.getProperty("battery.present"):
- test = self.makeCopy()
- test.setDevice(device)
- tests.append(test)
- if 'ac_adapter' in device.getProperty("info.category"):
- acAdapterDevice = device
+ if "power_supply" in device.getProperty("SUBSYSTEM"):
+ if "BAT" in device.getProperty("POWER_SUPPLY_NAME"):
+ test = self.makeCopy()
+ test.setDevice(device)
+ tests.append(test)
+ if "AC" in device.getProperty("POWER_SUPPLY_NAME"):
+ acAdapterDevice = device
if acAdapterDevice:
for test in tests:
test.setACAdapterDevice(acAdapterDevice)
return tests
-
+
def getDevices(self):
""" get the battery and ac adapter devices """
- hal = Hal()
- for device in hal.getDevices():
- if "ac_adapter" in device.getProperty("info.category"):
- self.setACAdapterDevice(device)
- if device.getUDI() == self.getUDI():
- if device.getProperty("battery.present"):
+ devices = UdevDeviceDetector().getDevices()
+ for device in devices:
+ if "power_supply" in device.getProperty("SUBSYSTEM"):
+ if "AC" in device.getProperty("POWER_SUPPLY_NAME"):
+ self.setACAdapterDevice(device)
+ if "BAT" in device.getProperty("POWER_SUPPLY_NAME"):
self.setDevice(device)
- else:
- print "Error: battery %s is not present" % device.getUDI()
-
+
+ if not self.getDevice():
+ print "Error: battery is not present"
if not self.getDevice() or not self.getACAdapterDevice():
- print "Error: could not find HAL device for battery and AC Adapter"
+ print "Error: could not find udev device for battery and AC Adapter"
return False
-
+
return True
-
+
def getStatus(self):
+ levelFull = ''
+ level = ''
""" get battery and ac adapter status """
if self.getDevices():
- self.acAdapterPresent = self.acAdapterDevice.getProperty("ac_adapter.present")
- self.levelPercentage = self.device.getProperty("battery.charge_level.percentage")
- self.level = self.device.getProperty("battery.charge_level.current")
- self.levelUnits = self.device.getProperty("battery.charge_level.unit")
- self.isCharging = self.device.getProperty("battery.rechargeable.is_charging")
- self.isDischarging = self.device.getProperty("battery.rechargeable.is_discharging")
+ self.acAdapterPresent = bool(int(self.getACAdapterDevice().getProperty("POWER_SUPPLY_ONLINE")))
+ # fedora uses "ENERGY" instead of "CHARGE"
+ levelFull = self.device.getProperty("POWER_SUPPLY_CHARGE_FULL")
+ if not levelFull:
+ levelFull = self.device.getProperty("POWER_SUPPLY_ENERGY_FULL")
+ if levelFull:
+ self.levelFull = int(levelFull) / self.unitFactor
+ level = self.device.getProperty("POWER_SUPPLY_CHARGE_NOW")
+ if not level:
+ level = self.device.getProperty("POWER_SUPPLY_ENERGY_NOW")
+ self.level = int(level) / self.unitFactor
+ self.chargingStatus = self.device.getProperty("POWER_SUPPLY_STATUS").lower()
return True
-
- #otherwise
+
+ #otherwise
return False
-
+
def printStatus(self):
- state = "is not"
- if self.acAdapterPresent:
- state = "is"
+ state = "is" if self.acAdapterPresent else "is not"
+ print "-------------------------------"
print "AC Adapter %s connected" % state
print "Battery:"
- print " charged to %s%% - %s %s" % ( self.levelPercentage, self.level, self.levelUnits)
- state = "is not"
- if self.isCharging:
- state = "is"
- print " %s charging" % state
- state = "is not"
- if self.isDischarging:
- state = "is"
- print " %s discharging" % state
-
+ levelPercentage = 100 * self.level / self.levelFull
+ print " charged to %s%% - %s %s" % ( levelPercentage, self.level, self.units)
+ print " current charging status is %s" % self.chargingStatus
+ print "-------------------------------"
+
def checkStatus(self):
success = True
delta = 10 # in units of charge level
- waitTime = 10 # seconds to wait each try
+ waitTime = 10 # seconds to wait each try
tryLimit = 10 # number of times to look for level change
-
+
self.getStatus()
-
- state = None
- if self.isDischarging:
- state = "discharging"
+
+ if self.chargingStatus == "discharging":
if self.acAdapterPresent:
print "Error: battery is discharging while AC adapter is connected"
success = False
-
- if self.isCharging:
- state = "charging"
+
+ if self.chargingStatus == "charging":
if not self.acAdapterPresent:
print "Error: battery is charging while AC adapter is disconnected"
success = False
-
-
- if self.isDischarging or self.isCharging:
-
+
+ if self.chargingStatus == "charging" or self.chargingStatus == "discharging":
+
# check for changes in battery level.
tries = 0
level = self.level
while True:
self.getStatus()
- if ((self.isCharging and self.level > level + delta)
- or (self.isDischarging and self.level < level - delta)):
- print "verified battery is %s" % state
+ if ((self.chargingStatus == "charging" and self.level > level + delta)
+ or (self.chargingStatus == "discharging" and self.level < level - delta)):
+ print "verified battery is %s" % self.chargingStatus
break
if tries > tryLimit:
- print "Error: could not verify battery %s" % state
+ print "Error: could not verify battery %s" % self.chargingStatus
success = False
break
tries = tries + 1
- print "waiting to verify battery %s more than %s %s" % (state, delta, self.levelUnits)
+ print "waiting to verify battery %s more than %s %s" % (self.chargingStatus, delta, self.units)
sys.stdout.flush()
time.sleep(waitTime)
-
+ else:
+ print "Error: could not verify battery charging status, current status is %s" % self.chargingStatus
+ success = False
return success
-
-
+
+
def run(self):
FAILED = 1
PASSED = 0
-
+
if self.getMode() == Constants.auto:
print "Error: battery test can not be run in auto mode, as it requires the tester to disconnect power"
return FAILED
-
+
+ if not self.getStatus():
+ return FAILED
+ self.printStatus()
+
action = None
testedConnected = False
testedDisconnected = False
- while True:
-
+ while not testedConnected or not testedDisconnected:
+ # ask user to add/remove AC power
+ action = "disconnect" if self.acAdapterPresent else "connect"
+ if not self.promptConfirm("Please %s AC Power - continue? " % action):
+ return FAILED
+
if not self.getStatus():
return FAILED
- self.printStatus()
+ if action == "connect":
+ if self.acAdapterPresent:
+ testedConnected = True
+ else:
+ print "AC Power is not connected!"
+ continue
+ elif action == "disconnect":
+ if self.acAdapterPresent:
+ print "AC Power is not disconnected!"
+ continue
+ else:
+ testedDisconnected = True
+
if not self.checkStatus():
return FAILED
-
- # ask user to add/remove AC power
- if self.acAdapterPresent:
- testedConnected = True
- action = "disconnect"
- else:
- testedDisconnected = True
- action = "connect"
-
- if not testedConnected or not testedDisconnected:
- if not self.promptConfirm("Please %s AC Power - continue? " % action):
- return FAILED
- else:
- break
-
+
+ if not self.getStatus():
+ return FAILED
+ self.printStatus()
+
return PASSED
-
+
if __name__ == "__main__":
test = BatteryTest()
returnValue = test.do(sys.argv)
sys.exit(returnValue)
-
-
-
-
-
-
-
-
-
Deleted: trunk/tests/battery/runtest.sh
===================================================================
--- trunk/tests/battery/runtest.sh 2012-09-06 15:11:11 UTC (rev 1372)
+++ trunk/tests/battery/runtest.sh 2012-09-06 15:26:19 UTC (rev 1373)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-v7-run-simple-test ${TEST:-$(basename $PWD)} ./battery.py
11 years, 7 months
r1372 - in trunk: tests/usb v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-09-06 15:11:11 +0000 (Thu, 06 Sep 2012)
New Revision: 1372
Removed:
trunk/tests/usb/runtest.sh
Modified:
trunk/tests/usb/Makefile
trunk/tests/usb/usb.py
trunk/v7/procDeviceDetector.py
trunk/v7/usbTest.py
Log:
843615 - usb test should not use HAL
Modified: trunk/tests/usb/Makefile
===================================================================
--- trunk/tests/usb/Makefile 2012-08-28 13:17:21 UTC (rev 1371)
+++ trunk/tests/usb/Makefile 2012-09-06 15:11:11 UTC (rev 1372)
@@ -15,17 +15,15 @@
.PHONY: all install download clean
-FILES= runtest.sh usb.py
+FILES=usb.py
run: $(FILES) build
- ./runtest.sh
build: $(BUILT_FILES)
- chmod a+x ./runtest.sh ./usb.py
+ chmod a+x ./usb.py
clean:
rm -f $(BUILT_FILES)
# Include Common Makefile
include $(DESTDIR)/usr/share/v7/lib/v7-make.include
-
Deleted: trunk/tests/usb/runtest.sh
===================================================================
--- trunk/tests/usb/runtest.sh 2012-08-28 13:17:21 UTC (rev 1371)
+++ trunk/tests/usb/runtest.sh 2012-09-06 15:11:11 UTC (rev 1372)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-v7-run-simple-test ${TEST:-$(basename $PWD)} ./usb.py
Modified: trunk/tests/usb/usb.py
===================================================================
--- trunk/tests/usb/usb.py 2012-08-28 13:17:21 UTC (rev 1371)
+++ trunk/tests/usb/usb.py 2012-09-06 15:11:11 UTC (rev 1372)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
-# is made available to anyone wishing to use, modify, copy, or
-# redistribute it subject to the terms and conditions of the GNU General
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -25,58 +25,35 @@
# sys.path.append("/home/gnichols/devel/v7")
from v7.tags import Constants
-from v7.hal import Hal
-from v7.procDeviceDetector import ProcDeviceDetector
+#from v7.udevDeviceDetector import UdevDeviceDetector
from v7.test import Test
from v7.device import Device
from v7.usbTest import USBTestBase
-class USBTest(USBTestBase):
+class USBTest(USBTestBase):
def __init__(self):
USBTestBase.__init__(self, name="usb")
-
- # metadata AKA testinfo.desc
- self.owner = "Greg Nichols <gnichols(a)redhat.com>"
- self.nameSpace = "V7"
- self.testPackage = "v7"
- self.spaceName = ""
- self.path = "v7/tests/usb"
- self.version = "1.1"
- self.description = "USB Device/Port test"
- self.testTime = "5m"
- self.runFor = ""
- # was: "\'usb\' == info.bus and \'hub\' == info.linux.driver"
- # change to run once on what ever USB is there.
- self.runOn = "info.product == 'Computer' and not smbios.bios.vendor == 'Xen'"
- self.interactive = True
- self.requires = ""
-
-
+
+ def getRequiredRPMs(self):
+ return ["usbutils"]
+
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.
+ devices = planner.getUdevDeviceDetector().getDevices()
+ # run if there's a device with SUBSYSTEM == usb
for device in devices:
- if device.getProperty("info.product") == "Computer" and device.getProperty("smbios.bios.vendor") == "Xen":
- isXenGuest = True
- if device.getProperty("info.bus") == "usb":
- hasUSB = True
- if device.getProperty("class") == "USB":
- hasUSB = True
- if hasUSB and not isXenGuest:
- test = self.makeCopy()
- tests.append(test)
+ if device.getProperty("SUBSYSTEM") == "usb":
+ test = self.makeCopy()
+ tests.append(test)
+ break
return tests
-
def run(self):
# ask user for the number of ports:
print "USB test:"
self.pluggedPorts = list()
- # check for USB devices, print info about them
+
self.checkAllUSBPortsUnplugged()
self.fixedDevices = len(self.pluggedInDevices)
if self.getMode() == Constants.auto:
@@ -90,22 +67,18 @@
self.result = Constants.PASS
return 0
-
-
# otherwise
-
- while len(self.pluggedInDevices)-self.fixedDevices < self.numberOfSockets:
+ while len(self.pluggedInDevices) - self.fixedDevices < self.numberOfSockets:
print "testing socket %s of %s..." % (len(self.pluggedInDevices)-self.fixedDevices+1, self.numberOfSockets)
if self.promptContinue("Please plug in a USB device"):
# find out which port was plugged
- found = self.addNewPluggedUSBPort()
- if found:
- (busNumber, portNumber, deviceID) = found
+ id = self.addNewPluggedUSBPort()
+ if id:
if self.promptContinue("Please unplug the device"):
- if self.confirmUSBPortUnplugged(deviceID):
- print "confirmed device %s" % deviceID
- self.pluggedInDevices.append(deviceID)
+ if self.confirmUSBPortUnplugged(searchID=id):
+ print "confirmed device %s unplugged" % id
+ self.pluggedInDevices.append(id)
else:
print "Did not confirm the device - repeating test."
else:
@@ -121,7 +94,6 @@
else:
self.returnValue = 1
self.result = Constants.FAIL
-
return self.returnValue
@@ -132,7 +104,3 @@
# usbTest.run()
returnValue = usbTest.do(sys.argv)
sys.exit(returnValue)
-
-
-
-
Modified: trunk/v7/procDeviceDetector.py
===================================================================
--- trunk/v7/procDeviceDetector.py 2012-08-28 13:17:21 UTC (rev 1371)
+++ trunk/v7/procDeviceDetector.py 2012-09-06 15:11:11 UTC (rev 1372)
@@ -68,7 +68,7 @@
try:
key = keyvalue[0].strip()
except IndexError:
- return
+ return
try:
value = keyvalue[1].strip()
@@ -95,7 +95,7 @@
for device in self.devices:
if device.hasPropertyValue(udi):
return device
- # otherwise
+ # otherwise
return None
@@ -120,16 +120,6 @@
output += device.dump()
return output
- def getUSBBusAndPort(self, device):
- try:
- bus = device.getProperty("Bus")
- port = device.getProperty("Port")
- id = "%s.%s.%s" % (bus, port, device.getProperty("Dev#"))
- return (bus, port, id)
- except:
- pass
- return None
-
def getProduct(self, device):
return device.getProperty("Product")
Modified: trunk/v7/usbTest.py
===================================================================
--- trunk/v7/usbTest.py 2012-08-28 13:17:21 UTC (rev 1371)
+++ trunk/v7/usbTest.py 2012-09-06 15:11:11 UTC (rev 1372)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
-# is made available to anyone wishing to use, modify, copy, or
-# redistribute it subject to the terms and conditions of the GNU General
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
# Public License v.2.
-#
+#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -24,76 +24,75 @@
import dbus
from v7.tags import Constants, DeviceClass
-from v7.hal import Hal
-from v7.procDeviceDetector import ProcDeviceDetector
from v7.test import Test
from v7.device import Device
+from v7.command import Command
-class USBTestBase(Test):
+class USBTestBase(Test):
def __init__(self, name):
Test.__init__(self, name)
- self.deviceDetector = None
+ self.lsusbCommand = "lsusb"
+ self.pluggedInDevices = list()
self.deviceClass = DeviceClass.usb
-
def getUSBDevices(self):
- #first time - find a working device detector
- if not self.deviceDetector:
- self.deviceDetector = Hal()
- devices = self.deviceDetector.getDevices()
- if len(devices) is 0:
- print "Note: could not detect USB devices via HAL, using /proc"
- self.deviceDetector = ProcDeviceDetector()
- devices = self.deviceDetector.getDevices()
-
- return devices
+ devices = list()
+ pattern = re.compile("Bus (?P<bus>\d{3}) Device (?P<port>\d{3}): ID (?P<devid>[0-9a-f]{4}:[0-9a-f]{4}) (?P<name>.*$)")
+ try:
+ pipe = Command(self.lsusbCommand)
+ pipe.start()
+ while 1:
+ line = pipe.readline()
+ if not line or line.strip() == "":
+ break
+ match = pattern.match(line)
+ # a single dev list is a tuple containing information like:
+ # ('001','002','8087:0020','Intel Corp. Integrated Rate Matching Hub')
+ dev = match.groups()
+ devices.append(dev)
+ except Exception, e:
+ print "Error: could not read usb devices from lsusb command"
+ print e
+ return None
+
+ return devices
- # otherwise
- return self.deviceDetector.getDevices()
-
def checkAllUSBPortsUnplugged(self):
devices = self.getUSBDevices()
+ if not devices:
+ return None
self.pluggedInDevices = list()
- returnValue = True
for dev in devices:
- found = self.deviceDetector.getUSBBusAndPort(dev)
- if found:
- (busNumber, portNumber, id) = found
- self.pluggedInDevices.append(id)
- if busNumber and portNumber:
- try:
- print "%s appears to be plugged into bus %s port %s" %(self.deviceDetector.getProduct(dev), busNumber, portNumber)
- except KeyError:
- pass
+ (busID, portID, devID, name) = dev
+ # generate an unique id combined from busID+portID+devID
+ # e.g.: 001.002.8087:0020
+ id = "%s.%s.%s" % (busID, portID, devID)
+ self.pluggedInDevices.append(id)
+ if busID and portID:
+ print "%s (dev id: %s) appears to be plugged into bus %s port %s" % (name, devID, busID, portID)
def addNewPluggedUSBPort(self):
devices = self.getUSBDevices()
- for dev in devices:
- found = self.deviceDetector.getUSBBusAndPort(dev)
- if found:
- (busNumber, portNumber, deviceID) = found
- if (not deviceID in self.pluggedInDevices) and busNumber and portNumber:
- deviceName = self.deviceDetector.getProduct(dev)
- if deviceName == "":
- deviceName = deviceID
- print "%s appears to be plugged into bus %s port %s" %(deviceName, busNumber, portNumber)
-
- return (busNumber, portNumber, deviceID)
+ if not devices:
+ return None
+ for dev in devices:
+ (busID, portID, devID, name) = dev
+ id = "%s.%s.%s" % (busID, portID, devID)
+ # should execute checkAllUSBPortsUnplugged() first
+ if (not id in self.pluggedInDevices) and busID and portID:
+ print "%s (dev id: %s) appears to be plugged into bus %s port %s" % (name, devID, busID, portID)
+ return id
return None
- def confirmUSBPortUnplugged(self, searchDeviceID):
+ def confirmUSBPortUnplugged(self, searchID):
devices = self.getUSBDevices()
+ if not devices:
+ return True
for dev in devices:
- found = self.deviceDetector.getUSBBusAndPort(dev)
- if found:
- (busNumber, portNumber, deviceID) = found
- if deviceID == searchDeviceID:
- return False
- return True
-
+ (busID, portID, devID, name) = dev
+ id = "%s.%s.%s" % (busID, portID, devID)
+ if id == searchID:
+ return False
-
-
-
-
+ return True
11 years, 7 months