diff options
author | Manel Caro <mcaro@iseebcn.com> | 2019-03-09 21:38:10 +0100 |
---|---|---|
committer | Manel Caro <mcaro@iseebcn.com> | 2019-03-09 21:38:10 +0100 |
commit | fa1e1822769d735745869ef02671408d006f2b13 (patch) | |
tree | ed36d7f424d7535eff2bf5d089847dc1fe3a31be /test-cli/test/tests/qaudio.py | |
parent | e4366bb1f2dc3a43a1289f6f76967f1005278954 (diff) | |
download | board-fa1e1822769d735745869ef02671408d006f2b13.zip board-fa1e1822769d735745869ef02671408d006f2b13.tar.gz board-fa1e1822769d735745869ef02671408d006f2b13.tar.bz2 |
Change some test
Update some tests
Diffstat (limited to 'test-cli/test/tests/qaudio.py')
-rw-r--r-- | test-cli/test/tests/qaudio.py | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/test-cli/test/tests/qaudio.py b/test-cli/test/tests/qaudio.py index b262c2d..a1572ca 100644 --- a/test-cli/test/tests/qaudio.py +++ b/test-cli/test/tests/qaudio.py @@ -13,32 +13,25 @@ class Qaudio(unittest.TestCase): self.__refSum = 25 # 1+3+5+7+9 def execute(self): - str_cmd = "amixer -c 0 sset 'PCM' 100 2> /dev/null" # .format(self.__dtmfFile) - #Some cases de volume level is not enough to the tes. It needs to be increased - volume_up = SysCommand("volume_up", str_cmd) - if volume_up.execute() == 0: - str_cmd = "aplay test/files/dtmf-13579.wav 2> /dev/null & arecord -r 8000 -d 1 recorded.wav 2> /dev/null" #.format(self.__dtmfFile) - audio_loop = SysCommand("audio_loop", str_cmd) - if audio_loop.execute() == 0: - lines = audio_loop.getOutput().splitlines() - str_cmd = "multimon -t wav -a DTMF recorded.wav -q 2> /dev/null" - dtmf_decoder = SysCommand("dtmf_decoder", str_cmd) - if dtmf_decoder.execute() == 0: - self.__raw_out = dtmf_decoder.getOutput() - if self.__raw_out == "": - return -1 - 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] - self.failUnless(self.__sum == self.__refSum), "failed: incorrect dtmf code" + str(self.__sum) - else: - self.fail("failed: fail reading recorded file") + str_cmd = "aplay test/files/dtmf-13579.wav 2> /dev/null & arecord -r 8000 -d 1 recorded.wav 2> /dev/null" #.format(self.__dtmfFile) + audio_loop = SysCommand("command-name", str_cmd) + if audio_loop.execute() == 0:# BUG: Returns -1 but work + lines = audio_loop.getOutput().splitlines() + str_cmd = "multimon -t wav -a DTMF recorded.wav -q 2> /dev/null" + dtmf_decoder = SysCommand("command-name", str_cmd) + if dtmf_decoder.execute() == 0: # BUG: Returns -1 but work + self.__raw_out = dtmf_decoder.getOutput() + if self.__raw_out == "": return -1 + 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] + self.failUnless(self.__sum == self.__refSum), "failed: incorrect dtmf code" + str(self.__sum) else: - self.fail("failed: fail playing/recording file") + self.fail("failed: fail reading recorded file") return -1 else: - self.fail("failed: could not increase loud level") + self.fail("failed: fail playing/recording file") return -1 return 0 |