Author: gnichols
Date: 2012-08-27 18:44:38 +0000 (Mon, 27 Aug 2012)
New Revision: 1368
Removed:
trunk/tests/audio/runtest.sh
Modified:
trunk/tests/audio/Makefile
trunk/tests/audio/audio.py
Log:
843607 - audio test should not use HAL
Modified: trunk/tests/audio/Makefile
===================================================================
--- trunk/tests/audio/Makefile 2012-08-23 19:05:55 UTC (rev 1367)
+++ trunk/tests/audio/Makefile 2012-08-27 18:44:38 UTC (rev 1368)
@@ -15,22 +15,16 @@
.PHONY: all install download clean
-BUILT_FILES=
+BUILT_FILES=
FILES=runtest.sh audio.py
run: $(FILES) build
- ./runtest.sh
build: $(BUILT_FILES)
- chmod a+x ./runtest.sh audio.py
+ chmod a+x audio.py
clean:
- rm -f $(BUILT_FILES)
+ rm -f $(BUILT_FILES)
-
# Include Common Makefile
include $(DESTDIR)/usr/share/v7/lib/v7-make.include
-
-
-
-
Modified: trunk/tests/audio/audio.py
===================================================================
--- trunk/tests/audio/audio.py 2012-08-23 19:05:55 UTC (rev 1367)
+++ trunk/tests/audio/audio.py 2012-08-27 18:44:38 UTC (rev 1368)
@@ -1,9 +1,9 @@
#!/usr/bin/python
-# Copyright (c) 2006 Red Hat, Inc. All rigv7 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 rigv7 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.
@@ -17,57 +17,47 @@
from v7.test import Test
from v7.tags import Constants, DeviceClass
-from v7.hal import Hal
-from v7.redhatrelease import RedHatRelease
+from v7.udevDeviceDetector import UdevDeviceDetector
-class AudioTest(Test):
-
+class AudioTest(Test):
+
def __init__(self):
Test.__init__(self, name="audio")
self.deviceClass = DeviceClass.audio
-
+
def plan(self, planner):
properties = dict()
- properties['alsa.pcm_class'] = 'generic'
- properties['alsa.type'] = 'playback'
- tests = self.planWith(planner.getHalDeviceDetector(), properties, all=False)
+ properties['SUBSYSTEM'] = 'sound'
+ properties['SOUND_INITIALIZED'] = '1'
+ tests = self.planWith(planner.getUdevDeviceDetector(), properties, all=False)
return tests
-
+
def getRequiredRPMs(self):
- rpms = ["sox"]
- redhat = RedHatRelease()
- if "Fedora" in redhat.getProduct() or ("Red Hat" in
redhat.getProduct() and redhat.getVersion() >= 6):
- rpms.append("alsa-utils") # for sound samples in
/usr/share/sounds/alsa
- else:
- rpms.append("system-config-soundcard") # for sound samples in
/usr/share/system-config-soundcard
- return rpms
-
+ return ["sox", "alsa-utils"]
+
def logSoundCardInfo(self):
- if self.getUDI():
- hal = Hal()
- self.device = hal.getDevice(self.getUDI())
+ if self.udi:
+ self.device = UdevDeviceDetector().getDevice(self.udi)
if self.device:
- parentUDI = self.device.getProperty("info.parent")
- if parentUDI:
- print "\nSound Card:"
- print hal.dumpDevice(parentUDI)
- print ""
- return True
+ print "\nSound Card:"
+ print self.device.dump()
+ print ""
+ return True
# otherwise
return False
-
+
def run(self):
FAILED = 1
PASSED = 0
-
+
if not self.logSoundCardInfo():
print "Error: could not log sound card information"
return FAILED
-
+
if self.getMode() == Constants.auto:
print("Error: Test Mode: %s: The audio test can not be run in auto mode
since audio functions must be verified by the tester." % self.getMode())
return FAILED
-
+
# otherwise
print "This test plays a sound sample and records it to another file."
print "Please use the Volume Control application and insure that the "
@@ -75,12 +65,11 @@
if not self.promptConfirm("Continue?"):
self.result = Constants.FAIL
return FAILED
-
- waveFiles=["/usr/share/system-config-soundcard/sound-sample.wav",
- "/usr/share/sounds/alsa/Front_Right.wav",
+
+ waveFiles=["/usr/share/sounds/alsa/Front_Right.wav",
"/usr/share/sounds/alsa/Front_Left.wav"]
recordedWaveFile="./test.wav"
- print "starting recording"
+ print "starting recording"
for waveFile in waveFiles:
if os.path.exists(waveFile):
if not os.system("play %s &" % waveFile) is 0:
@@ -91,40 +80,36 @@
print "Error: record command failed"
self.result = Constants.FAIL
return FAILED
-
+
waitTime = 7
print "Waiting %d sec" % waitTime
sys.stdout.flush()
time.sleep(waitTime)
os.system("killall -w -9 rec sox")
-
+
if not self.promptConfirm("Did you hear the sound?"):
self.result = Constants.FAIL
return FAILED
-
+
print "playing recorded sound"
if not os.system("play %s" % recordedWaveFile) is 0:
print "Error: play command failed"
self.result = Constants.FAIL
return FAILED
-
+
if not self.promptConfirm("Did you hear the sound?"):
self.result = Constants.FAIL
return FAILED
-
+
outputDirectory = os.path.dirname(self.outputFile)
shutil.copy(recordedWaveFile, outputDirectory)
print "Copied recorded sound %s to %s" % (recordedWaveFile,
outputDirectory)
-
+
self.result = Constants.PASS
return PASSED
-
+
if __name__ == "__main__":
test = AudioTest()
returnValue = test.do(sys.argv)
sys.exit(returnValue)
-
-
-
-
Deleted: trunk/tests/audio/runtest.sh
===================================================================
--- trunk/tests/audio/runtest.sh 2012-08-23 19:05:55 UTC (rev 1367)
+++ trunk/tests/audio/runtest.sh 2012-08-27 18:44:38 UTC (rev 1368)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-v7-run-simple-test info ./audio.py
Show replies by date