summaryrefslogtreecommitdiff
path: root/test-cli/test/tests/qaudio.py
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-03-06 12:46:27 +0100
committerHector Fernandez <hector@iatec.biz>2020-03-06 12:46:27 +0100
commit9f07a57d89a927aa9b172c1bf20c7ab563658c73 (patch)
tree3691cb8d09862db185a628c7bb07df6dd50a64bb /test-cli/test/tests/qaudio.py
parent98d40cecc9818360984188755e455aa53933aab0 (diff)
downloadboard-9f07a57d89a927aa9b172c1bf20c7ab563658c73.zip
board-9f07a57d89a927aa9b172c1bf20c7ab563658c73.tar.gz
board-9f07a57d89a927aa9b172c1bf20c7ab563658c73.tar.bz2
Fixed multiple errors.
Diffstat (limited to 'test-cli/test/tests/qaudio.py')
-rw-r--r--test-cli/test/tests/qaudio.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py
index fe57be2..ef4da67 100644
--- a/test-cli/test/tests/qaudio.py
+++ b/test-cli/test/tests/qaudio.py
@@ -1,38 +1,39 @@
from test.helpers.syscmd import SysCommand
import unittest
-#class name
+
+
class Qaudio(unittest.TestCase):
- # Initialize the variables
+ params = None
- def __init__(self, testname, testfunc, dtmfFile):
- # Doing this we will initialize the class and later on perform a particular method inside this class
+ def __init__(self, testname, testfunc, varlist):
+ self.params = varlist
super(Qaudio, self).__init__(testfunc)
self._testMethodDoc = testname
- self._dtmfFile=dtmfFile
- self.__sum=0
- self.__refSum = 25 # 1+3+5+7+9
+ if "dtmfFile" in varlist:
+ self._dtmfFile = varlist["dtmfFile"]
+ else:
+ raise Exception('undercurrent param inside Qamp must be defined')
+ self.__sum = 0
+ self.__refSum = 25 # 1+3+5+7+9
def execute(self):
- str_cmd = "aplay test/files/dtmf-13579.wav & arecord -r 8000 -d 1 recorded.wav" #.format(self.__dtmfFile)
+ str_cmd = "aplay test/files/dtmf-13579.wav & arecord -r 8000 -d 1 recorded.wav" # .format(self.__dtmfFile)
audio_loop = SysCommand("command-name", str_cmd)
- if audio_loop.execute() == -1:# BUG: Returns -1 but work
+ if audio_loop.execute() == -1: # BUG: Returns -1 but work
lines = audio_loop.getOutput().splitlines()
str_cmd = "multimon -t wav -a DTMF recorded.wav -q"
dtmf_decoder = SysCommand("command-name", str_cmd)
- a=dtmf_decoder.execute()
- if dtmf_decoder.execute() == -1: # BUG: Returns -1 but work
+ a = dtmf_decoder.execute()
+ if dtmf_decoder.execute() == -1: # BUG: Returns -1 but work
self.__raw_out = dtmf_decoder.getOutput()
if self.__raw_out == "":
- return -1
+ self.fail("failed: can not execute multimon command")
lines = dtmf_decoder.getOutput().splitlines()
for i in range(0, 5):
- aux=[int(s) for s in lines[i].split() if s.isdigit()]
- self.__sum=self.__sum+aux[0]
+ aux = [int(s) for s in lines[i].split() if s.isdigit()]
+ self.__sum = self.__sum + aux[0]
self.failUnless(self.__sum == self.__refSum), "failed: incorrect dtmf code" + str(self.__sum)
else:
self.fail("failed: fail reading recorded file")
- return -1
else:
self.fail("failed: fail playing/recording file")
- return -1
- return 0 \ No newline at end of file