Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 318033 Details for
Bug 462349
FEAT: cdrom test should be split into multiple tests by media-type
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
dvd.py - the new DVD test based on the OpticalDiskTest class
dvd.py (text/x-python), 6.97 KB, created by
Greg Nichols
on 2008-09-30 01:37:39 UTC
(
hide
)
Description:
dvd.py - the new DVD test based on the OpticalDiskTest class
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2008-09-30 01:37:39 UTC
Size:
6.97 KB
patch
obsolete
>#!/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 ># 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. ># ># You should have received a copy of the GNU General Public License ># along with this program; if not, write to the Free Software ># Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ># ># Author: Greg Nichols ># YangKun <ykun@redhat.com> ># > >import os >import sys >import commands >import string >import shutil >import curses >import time >import filecmp > >from hts.test import Test >from hts.opticalDiskTest import OpticalDiskTest >from hts.tags import Constants >from hts.hal import Hal >from hts.device import Device >from hts.command import Command, HTSCommandException > >PASSED = 0 >FAILED = 1 > >class DVDTest(OpticalDiskTest): > > def __init__(self): > OpticalDiskTest.__init__(self, name="dvd") > self.mediaTypes = ["dvdrw", "dvdplusrw", "dvdr", "dvdplusr", "dvd"] > > > def askForDisks(self): > > # given that self.supportedMediaTypes is in order of preference, > # find the most preferred media type to test for "-" and "+" incarnations > dvdMode = None > dvdPlusMode = None > for media in self.supportedMedia: > if "plus" in media: > if dvdPlusMode is None: > dvdPlusMode = media > elif dvdMode is None: > dvdMode = media > > # DVD-/+ both ? > if dvdMode is None or dvdPlusMode is None: > dvdBoth = False > else: > dvdBoth = True > > if dvdBoth: > if dvdMode == "dvdrw": > print " --- one good DVD-RW or DVD+RW disk " > elif dvdMode == "dvdr": > print " --- one blank DVD-R or DVD+R disk " > else: > print "\n +++ Error: Unknown dvdMode.\n" > return False > elif dvdMode: > if dvdMode == "dvd": > print " --- one DVD data disk which contains more than 800MiB of data. " > print " (e.g. one RHEL5 install DVD disk) " > elif dvdMode == "dvdr": > print " --- one blank DVD-R disk " > elif dvdMode == "dvdrw": > print " --- one good DVD-RW disk " > else: > print "\n +++ Error: Unknown dvdMode.\n" > return False > elif dvdPlusMode: > if dvdPlusMode == "dvdplusr": > print " --- one blank DVD-R or DVD+R disk " > elif dvdPlusMode == "dvdplusrw": > print " --- one good DVD-RW or DVD+RW disk " > else: > print "\n +++ Error: Unknown dvdPlusMode.\n" > else: > print "\n" > sys.stdout.flush() > return (dvdBoth, dvdMode, dvdPlusMode) > > > def getMediaChoice(self): > (bothPlusAndMinusMedia, dvdMode, dvdPlusMode) = self.askForDisks() > # if support both dvd- and dvd+ > if bothPlusAndMinusMedia: > print "\n" > print " Your DVD drive /dev/%s supports both %s and %s . " % (cdromDevice,dvdMode,dvdPlusMode) > print " To save the testing time, only one of them is required to be tested . " > print " ( Of course you can choose to test both of them :-) )" > > self.mediaChoices = [dvdMode, dvdPlusMode, "both"] > while True: > choice = self.prompt("Which media would you like to test?", self.mediaChoices) > if choice in self.mediaChoices: > self.mediaChoice = choice > return self.mediaChoice > else: > print "please choose one of:" > print self.mediaChoices > > # otherwise > if dvdMode: > self.mediaChoice = dvdMode > elif dvdPlusMode: > rself.mediaChoice = dvdPlusMode > else: > print "Error: could not determine media to test" > > def checkMediaSize(self, size): > if size < 800000 : > print "Error: +++ %s appears NOT to be a DVD !\n" % self.getLogicalDeviceName() > return False > # otherwise > return True > > > def run(self): > """main function""" > if not self.initializeDeviceInfo(): > return FAILED > > # show features we found > print "\n Your CD/DVD device /dev/%s supports %s " % (self.getLogicalDeviceName(), self.showSupportedMedia()) > print " We will check these features. " > print " You need to prepare following media(disks) for this test: \n" > > > self.getMediaChoice() > > # if auto or self-test mode > if self.getMode() != Constants.normal: > print "Warning: Auto test mode - TESTS NOT RUN" > return 0 > > # otherwise, normal test mode > self.prompt("\n Press ENTER when you are ready ! Or press Ctrl-C to quit !") > > # test DVD- only > if self.mediaChoice == "dvd": > returnValue = self.testDisk(message="DVD data", readWriteMode="read", type="dvd") > elif self.mediaChoice == "dvdr": > returnValue = self.testDisk(message="blank DVD-R", readWriteMode="write", type="dvd") > elif self.mediaChoice == "dvdrw": > returnValue = self.testDisk(message="good DVD-RW", readWriteMode="rewrite", type="dvd") > # test DVD+ only > elif self.mediaChoice == "dvdplusr": > returnValue = self.testDisk(message="blank DVD+R", readWriteMode="write", type="dvdplus") > elif self.mediaChoice == "dvdplusrw": > returnValue = self.testDisk(message="good DVD+RW", readWriteMode="rewrite", type="dvdplus") > # test both DVD- and DVD+ > elif self.mediaChoice == "both": > if self.mediaChoices[0] == "dvdr": > if not self.self.testDisk(message="blank DVD-R", readWriteMode="write", type="dvd") or not self.testDVD(message="blank DVD+R", readWriteMode="write", type="dvdplus"): > print "\n +++ DVD-R test failed.\n" > return 1 # return non-zero to HTS means failure > else: > if not self.testDisk(message="good DVD-RW", readWriteMode="rewrite", type="dvd") or not self.testDVD(message="good DVD+RW", readWriteMode="rewrite", type="dvdplus"): > print "\n +++ DVD-RW test failed.\n" > return 1 # return non-zero to HTS means failure > > > if returnValue: > return PASSED > #otherwise > return FAILED > >if __name__ == "__main__": > test = DVDTest() > returnValue = test.do(sys.argv) > sys.exit(returnValue) > > > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 462349
:
318031
|
318032
| 318033