Author: gnichols
Date: 2011-08-22 17:50:12 +0000 (Mon, 22 Aug 2011)
New Revision: 1051
Modified:
trunk/tests/bluray/bluray.py
trunk/tests/dvd/dvd.py
Log:
633652 - [RFE]: v7 bluray test fail on BD-R disk
Modified: trunk/tests/bluray/bluray.py
===================================================================
--- trunk/tests/bluray/bluray.py 2011-08-22 17:47:04 UTC (rev 1050)
+++ trunk/tests/bluray/bluray.py 2011-08-22 17:50:12 UTC (rev 1051)
@@ -40,40 +40,40 @@
def __init__(self):
OpticalDiskTest.__init__(self, name="bluray")
self.mediaTypes = ["bd", "bdr", "bdre"]
- self.mediaNames = ["BD", "BD-R", "BD-RE"]
self.deviceClass = DeviceClass.optical
self.fileSourceDir = "/usr/bin" # ranges from 100MB-270MB
def checkMediaType(self, deviceName, mediaType):
"""verify the media type"""
- print "\n Start testing %s ... \n" % mediaType
+ print "\n Start testing %s ... \n" % self.printMediaName(mediaType)
sys.stdout.flush()
# sleep 15 seconds, waiting for drive init the media
time.sleep(15)
try:
mediaInDrive = Command("dvd+rw-mediainfo /dev/%s " % deviceName).getString(regex="Mounted Media:.*", singleLine=False ).split(":")[1].strip().split(" ")[1].strip()
+ mediaInDrive = self.convertMediaName(mediaInDrive)
except V7CommandException, exception:
print "Error: could not verify the media type."
print exception
return False
if mediaType == mediaInDrive:
- print "Media Matched: Media in drive now is %s\n" % mediaInDrive
+ print "Media Matched: Media in drive now is %s\n" % self.printMediaName(mediaInDrive)
return True
- elif mediaType == "BD" and (mediaInDrive == "BD-ROM" or mediaInDrive in self.mediaNames):
- print "Required media is %s , media in drive now is %s , test continues ... \n" % (mediaType, mediaInDrive)
+ elif mediaType == "bd" and (mediaInDrive == "bdrom" or mediaInDrive in self.mediaNames):
+ print "Required media is %s , media in drive now is %s , test continues ... \n" % (mediaType, self.printMediaName(mediaInDrive))
return True
else:
- print "Error: media is %s, but %s is required" % (mediaInDrive, mediaType)
+ print "Error: media is %s, but %s is required" % (self.printMediaName(mediaInDrive), self.printMediaName(mediaType))
return False
def echoTest(self, deviceName, testType, mediaStatus):
- print "\n Your Blu-ray drive /dev/%s supports %s" % (deviceName, testType)
- print " You need to prepare a %s %s disc to run this test." % (mediaStatus, testType)
- if testType == "BD":
+ print "\n Your Blu-ray drive /dev/%s supports %s" % (deviceName, self.printMediaName(testType))
+ print " You need to prepare a %s %s disc to run this test." % (mediaStatus, self.printMediaName(testType))
+ if testType == "bd":
print "\n Please notice that you need to prepare an unencrypted Blu-ray data disc to run this test."
self.prompt("\n Press ENTER when you are ready ! Or press Ctrl-C to quit !")
os.system("eject /dev/%s 2>/dev/null" % deviceName)
- self.prompt("\n Please insert a %s %s disc into /dev/%s and then press ENTER to continue !" % (mediaStatus, testType, deviceName))
+ self.prompt("\n Please insert a %s %s disc into /dev/%s and then press ENTER to continue !" % (mediaStatus, self.printMediaName(testType), deviceName))
# try to close the tray
try:
Command("eject -t /dev/%s" % deviceName).run()
@@ -134,32 +134,18 @@
if self.getMode() == Constants.auto:
print "Error: The bluray test can not be run in auto mode."
return FAILED
+
+ self.getMediaChoice()
- # if we have a UDI, maybe HAL worked?
- media = None
- if self.udi:
- hal = Hal()
- bdDevice = hal.getDevice(self.udi)
- bdDeviceName = self.getLogicalDeviceName()
- if bdDevice.getProperty("storage.cdrom.bdre"):
- media = "BD-RE"
- elif bdDevice.getProperty("storage.cdrom.bdr"):
- media = "BD-R"
- elif bdDevice.getProperty("storage.cdrom.bd"):
- media = "BD"
-
- # try asking the user
- while media is None or media not in self.mediaNames:
- media = self.prompt("What media would you like to test?", self.mediaNames)
# set the other parameters
- if media == "BD-RE":
+ if self.mediaChoice == "bdre":
description = "good"
mode = "rewrite"
- elif media == "BD-R":
+ elif self.mediaChoice == "bdr":
description = "new"
mode = "write"
- elif media == "BD":
+ elif self.mediaChoice == "bd":
description = "good"
mode = "read"
else:
@@ -167,10 +153,10 @@
return False
# otherwise, got the info, run the test
- self.echoTest(self.getLogicalDeviceName(), media, description)
- if not self.checkMediaType(self.getLogicalDeviceName(), media):
+ self.echoTest(self.getLogicalDeviceName(), self.mediaChoice, description)
+ if not self.checkMediaType(self.getLogicalDeviceName(), self.mediaChoice):
return FAILED
- elif not self.testDisk(message="%s %s" %(description, media), readWriteMode=mode, type="bd"):
+ elif not self.testDisk(message="%s %s" %(description, self.printMediaName(self.mediaChoice)), readWriteMode=mode, type="bd"):
return FAILED
else:
return PASSED
Modified: trunk/tests/dvd/dvd.py
===================================================================
--- trunk/tests/dvd/dvd.py 2011-08-22 17:47:04 UTC (rev 1050)
+++ trunk/tests/dvd/dvd.py 2011-08-22 17:50:12 UTC (rev 1051)
@@ -42,15 +42,6 @@
self.mediaTypes = ["dvdrw", "dvdplusrw", "dvdr", "dvdplusr", "dvd"]
self.deviceClass = DeviceClass.optical
self.fileSourceDir = "/usr/share" # ranges from 970MB-3.5GB
-
- def getMediaChoice(self):
-
- # default to the most-capable media
- self.mediaChoice = self.supportedMedia[0]
- if not self.promptConfirm("Would you like to test %s media?" % self.printMediaName(self.mediaChoice)):
- choice = self.prompt("Please choose the media to be tested: ", map(self.printMediaName, self.supportedMedia))
- self.mediaChoice = self.convertMediaName(choice)
-
def checkMediaSize(self, size):
if size < 800000 :